Преглед на файлове

website: enable onedrive via url hash

cc @arturi
ifedapoolarewaju преди 5 години
родител
ревизия
4d8bdb282c
променени са 2 файла, в които са добавени 17 реда и са изтрити 11 реда
  1. 8 8
      website/src/examples/dashboard/app.es6
  2. 9 3
      website/src/examples/dashboard/app.html

+ 8 - 8
website/src/examples/dashboard/app.es6

@@ -6,7 +6,7 @@ const GoogleDrive = require('@uppy/google-drive')
 const Dropbox = require('@uppy/dropbox')
 const Instagram = require('@uppy/instagram')
 const Facebook = require('@uppy/facebook')
-// const OneDrive = require('@uppy/onedrive')
+const OneDrive = require('@uppy/onedrive')
 const Url = require('@uppy/url')
 const Webcam = require('@uppy/webcam')
 const Tus = require('@uppy/tus')
@@ -123,13 +123,13 @@ function uppySetOptions () {
     window.uppy.removePlugin(FacebookInstance)
   }
 
-  // const OneDriveInstance = window.uppy.getPlugin('OneDrive')
-  // if (opts.OneDrive && !OneDriveInstance) {
-  //   window.uppy.use(OneDrive, { target: Dashboard, companionUrl: COMPANION })
-  // }
-  // if (!opts.OneDrive && OneDriveInstance) {
-  //   window.uppy.removePlugin(OneDriveInstance)
-  // }
+  const OneDriveInstance = window.uppy.getPlugin('OneDrive')
+  if (opts.OneDrive && !OneDriveInstance) {
+    window.uppy.use(OneDrive, { target: Dashboard, companionUrl: COMPANION })
+  }
+  if (!opts.OneDrive && OneDriveInstance) {
+    window.uppy.removePlugin(OneDriveInstance)
+  }
 
   const WebcamInstance = window.uppy.getPlugin('Webcam')
   if (opts.Webcam && !WebcamInstance) {

+ 9 - 3
website/src/examples/dashboard/app.html

@@ -14,7 +14,7 @@
     <li><label for="opts-Dropbox"><input type="checkbox" id="opts-Dropbox" checked/> Dropbox</label></li>
     <li><label for="opts-Instagram"><input type="checkbox" id="opts-Instagram" checked/> Instagram</label></li>
     <li id="facebook-checkbox"><label for="opts-Facebook"><input type="checkbox" id="opts-Facebook" checked/> Facebook</label></li>
-    <!-- <li><label for="opts-OneDrive"><input type="checkbox" id="opts-OneDrive" checked/> OneDrive</label></li> -->
+    <li id="onedrive-checkbox"><label for="opts-OneDrive"><input type="checkbox" id="opts-OneDrive" checked/> OneDrive</label></li>
     <li><label for="opts-Url"><input type="checkbox" id="opts-Url" checked/> Url</label></li>
   </ul>
 
@@ -41,7 +41,7 @@
     Dropbox: document.querySelector('#opts-Dropbox'),
     Instagram: document.querySelector('#opts-Instagram'),
     Facebook: document.querySelector('#opts-Facebook'),
-    // OneDrive: document.querySelector('#opts-OneDrive'),
+    OneDrive: document.querySelector('#opts-OneDrive'),
     Url: document.querySelector('#opts-Url'),
     autoProceed: document.querySelector('#opts-autoProceed'),
     restrictions: document.querySelector('#opts-restrictions'),
@@ -54,7 +54,7 @@
     GoogleDrive: true,
     Instagram: true,
     Dropbox: true,
-    // OneDrive: true,
+    OneDrive: true,
     Facebook: false,
     Url: true,
     autoProceed: false,
@@ -108,5 +108,11 @@
     facebookCheckbox.style.display = 'inline-block'
   }
 
+  const onedriveCheckbox = document.getElementById('onedrive-checkbox')
+  onedriveCheckbox.style.display = 'none'
+  if (document.location.hash === '#enable-onedrive') {
+    onedriveCheckbox.style.display = 'inline-block'
+  }
+
   toggleModalBtn()
 </script>