dashboard.js 759 B

123456789101112131415161718192021222324252627282930
  1. const createUppy = require('./createUppy')
  2. const addDashboardPlugin = require('./addDashboardPlugin')
  3. const addTransloaditPlugin = require('./addTransloaditPlugin')
  4. const addProviders = require('./addProviders')
  5. function dashboard (target, opts = {}) {
  6. const inline = opts.inline == null ? true : opts.inline
  7. const pluginId = 'Dashboard'
  8. const uppy = createUppy(opts)
  9. addTransloaditPlugin(uppy, opts)
  10. addDashboardPlugin(uppy, opts, {
  11. id: pluginId,
  12. inline,
  13. target,
  14. closeAfterFinish: false
  15. })
  16. if (Array.isArray(opts.providers)) {
  17. addProviders(uppy, opts.providers, {
  18. ...opts,
  19. // Install providers into the Dashboard.
  20. target: uppy.getPlugin(pluginId)
  21. })
  22. }
  23. return uppy
  24. }
  25. module.exports = dashboard