|
@@ -0,0 +1,82 @@
|
|
|
+---
|
|
|
+title: "Uppy 1.26: Dashboard “disabled”, per-file headers"
|
|
|
+date: 2021-02-26
|
|
|
+author: arturi
|
|
|
+image: "https://uppy.io/images/blog/1.26/dashboard-disabled.jpg"
|
|
|
+published: true
|
|
|
+---
|
|
|
+
|
|
|
+Uppy 1.26 brings a new `disabled` option for the Dashboad, ability to set headers per file with XHR Upload, and fixes for the Transloadit plugin.
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+<!--more-->
|
|
|
+
|
|
|
+## Dashboard “Disabled”
|
|
|
+
|
|
|
+You can now specify a `disabled` option for the Dashboard, in order to make it non-interactive and grayed out. Users won’t be able to click on buttons or drop files.
|
|
|
+
|
|
|
+This is useful when you need to confitionally enable/disable file uploading or manipulation, based on a condition in your app.
|
|
|
+
|
|
|
+<video alt="Demo video showing Uppy with Dashboard disabled vs enabled state" poster="/images/blog/1.26/dashboard-disabled.jpg" muted autoplay loop>
|
|
|
+ <source src="/images/blog/1.26/dashboard-disabled-vs-enabled.mp4" type="video/mp4">
|
|
|
+ Your browser does not support the video tag: https://uppy.io/images/blog/images/blog/1.26/dashboard-disabled-vs-enabled.mp4
|
|
|
+</video>
|
|
|
+
|
|
|
+This option can be set on init:
|
|
|
+
|
|
|
+```js
|
|
|
+uppy.use(Dashboard, {
|
|
|
+ disabled: true
|
|
|
+})
|
|
|
+```
|
|
|
+
|
|
|
+and via API:
|
|
|
+
|
|
|
+```js
|
|
|
+const dashboard = uppy.getPlugin('Dashboard')
|
|
|
+dashboard.setOptions({ disabled: true })
|
|
|
+
|
|
|
+userNameInput.addEventListener('change', () => {
|
|
|
+ dashboard.setOptions({ disabled: false })
|
|
|
+})
|
|
|
+```
|
|
|
+
|
|
|
+[See the docs](https://uppy.io/docs/dashboard/#disabled-false).
|
|
|
+
|
|
|
+## XHR Upload Per File headers
|
|
|
+
|
|
|
+`@uppy/xhr-upload` now accept a `headers: (file) => {}` function, so you can do:
|
|
|
+
|
|
|
+```js
|
|
|
+uppy.use(XHRUpload, {
|
|
|
+ headers: file => ({
|
|
|
+ 'authorization': `bearer ${global.userToken}`,
|
|
|
+ 'header-name': file.meta.someMetaValue
|
|
|
+ })
|
|
|
+})
|
|
|
+```
|
|
|
+
|
|
|
+to determine file-specific headers.
|
|
|
+
|
|
|
+The function syntax for `headers` is only available if the `bundle` option is `false` (the default). `bundle` uploads share only one set of headers.
|
|
|
+
|
|
|
+## Build System Improvements
|
|
|
+
|
|
|
+- build: set legacy-peer-deps for npm 7. We have some peerDependency mismatches in our install tree. In npm 6 this was OK (maybe reason for a warning) but in npm 7 they hard fail the install
|
|
|
+- build: added npm version check (33e656cad32b865f960dbd88abf4d3839c8377f0 / @goto-bus-stop)
|
|
|
+
|
|
|
+## Transloadit Plugin
|
|
|
+
|
|
|
+- Fixed a case where the plugin used stale file data.
|
|
|
+- Fixed polling fallback bugs.
|
|
|
+- Url concatenation is now more robust.
|
|
|
+
|
|
|
+## Misc
|
|
|
+
|
|
|
+- @uppy/companion: Docker tag release (#2771 / @kiloreux)
|
|
|
+- @uppy/companion: Companion should respect previously set value for Accesss-Control-Allow-Methods (#2726 / @tim-kos, @mifi, @so-steve)
|
|
|
+- @uppy/transloadit: fix polling fallback bugs (#2759 / @goto-bus-stop)
|
|
|
+- @uppy/utils: added mp4 file type support — Safari 14.0 on Mac records audio using audio/mp4 MIME type which isn't currently recognised by Uppy (#2753 / @dominiceden)
|
|
|
+
|
|
|
+See [changelog](https://github.com/transloadit/uppy/blob/master/CHANGELOG.md#1260) for details.
|