فهرست منبع

Fix uppy.io homepage example

Artur Paikin 2 سال پیش
والد
کامیت
1765f10fe8
1فایلهای تغییر یافته به همراه18 افزوده شده و 25 حذف شده
  1. 18 25
      website/themes/uppy/layout/index.ejs

+ 18 - 25
website/themes/uppy/layout/index.ejs

@@ -187,21 +187,19 @@
   <p>© <%- date(Date.now(), 'YYYY') %> <a href="https://transloadit.com" target="_blank">Transloadit</a></p>
 </footer>
 
-<link href="https://releases.transloadit.com/uppy/v3.0.0-beta.5/uppy.min.css" rel="stylesheet">
-<script src="https://releases.transloadit.com/uppy/v3.0.0-beta.5/uppy.min.js" type="module"></script>
-<script src="https://releases.transloadit.com/uppy/v3.0.0-beta.5/uppy.legacy.min.js" nomodule></script>
+<link href="https://releases.transloadit.com/uppy/v3.0.0/uppy.min.css" rel="stylesheet">
 
-<script>
+<script type="module">
+  import { Uppy, Dashboard, RemoteSources, Webcam, ImageEditor, Audio, ScreenCapture } from "https://releases.transloadit.com/uppy/v3.0.0/uppy.min.mjs"
   window.addEventListener('DOMContentLoaded', function() {
-    'use strict'
-    var TUS_ENDPOINT = 'https://tusd.tusdemo.net/files/'
-    var COMPANION_ENDPOINT = 'http://localhost:3020'
+    const TUS_ENDPOINT = 'https://tusd.tusdemo.net/files/'
+    let COMPANION_ENDPOINT = 'http://localhost:3020'
     if (location.hostname === 'uppy.io') {
       COMPANION_ENDPOINT = '//companion.uppy.io'
     }
-    
-    var uppy = new Uppy.Core({ debug: true })
-      .use(Uppy.Dashboard, {
+
+    const uppy = new Uppy({ debug: true })
+      .use(Dashboard, {
         target: '#demo',
         inline: true,
         metaFields: [
@@ -209,21 +207,16 @@
           { id: 'caption', name: 'Caption', placeholder: 'describe what the image is about' }
         ]
       })
-      .use(Uppy.GoogleDrive, { target: Uppy.Dashboard, companionUrl: COMPANION_ENDPOINT })
-      .use(Uppy.Instagram, { target: Uppy.Dashboard, companionUrl: COMPANION_ENDPOINT })
-      .use(Uppy.Facebook, { target: Uppy.Dashboard, companionUrl: COMPANION_ENDPOINT })
-      .use(Uppy.Dropbox, { target: Uppy.Dashboard, companionUrl: COMPANION_ENDPOINT })
-      .use(Uppy.Box, { target: Uppy.Dashboard, companionUrl: COMPANION_ENDPOINT })
-      .use(Uppy.Unsplash, { target: Uppy.Dashboard, companionUrl: COMPANION_ENDPOINT })
-      .use(Uppy.OneDrive, { target: Uppy.Dashboard, companionUrl: COMPANION_ENDPOINT })
-      .use(Uppy.Webcam, { target: Uppy.Dashboard })
-      .use(Uppy.Audio, { target: Uppy.Dashboard })
-      .use(Uppy.ScreenCapture, { target: Uppy.Dashboard })
-      .use(Uppy.Url, { target: Uppy.Dashboard, companionUrl: COMPANION_ENDPOINT })
-      .use(Uppy.Tus, { endpoint: TUS_ENDPOINT})
-    
-    uppy.on('success', function (files) {
-      console.log('Upload complete! We’ve uploaded these files:', files)
+      .use(RemoteSources, { companionUrl: COMPANION_ENDPOINT })
+      .use(Webcam, { target: Dashboard })
+      .use(Audio, { target: Dashboard })
+      .use(ImageEditor, { target: Dashboard })
+      .use(ScreenCapture, { target: Dashboard })
+      .use(Tus, { endpoint: TUS_ENDPOINT})
+
+    uppy.on('complete', ({ successful, failed }) => {
+      console.log('Upload complete!')
+      console.log(successful)
     })
     window.uppy = uppy
   })