diff --git a/CHANGELOG.md b/CHANGELOG.md index b5a69c06..124189f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,8 @@ - eq: add support for n-poles lowpass and highpass filters with the filter's `poles` property - eq: adapt sampling frequency to the x-axis range - xy/multixy: add `auto` choice to to `axisLock` (locks on the first moved axis) - + - file: `extension` can now be an array of strings + ## 1.27.5 - bug fixes @@ -18,6 +19,7 @@ - widget: regression causing error when emptying the css property and leaving only class declarations - modal: incorrect position in scrolled containers when `relative` is `true` - menu: incorrect position in scrlled containers depending on menu's alignment + - button: `locals.touchCoords` not updated upon release and incorrect when `doubleTap` is set ## 1.27.4 diff --git a/src/client/widgets/basics/file.js b/src/client/widgets/basics/file.js index 39e44296..a75cd835 100644 --- a/src/client/widgets/basics/file.js +++ b/src/client/widgets/basics/file.js @@ -21,7 +21,7 @@ module.exports = class File extends Widget { }, class_specific: { directory: {type: 'string', value: 'auto', help: 'Default browsing directory'}, - extension: {type: 'string', value: '*', help: 'Only display files with this extension'}, + extension: {type: 'string|array', value: '*', help: 'Only display files with this extension. Multiple extensions can be specified with an array of strings (`["jpg", "jpeg"]`)'}, allowDir: {type: 'boolean', value: false, help: 'Allow selecting a folder (by pressing "open" when no file is selected)'} } }) @@ -43,12 +43,18 @@ module.exports = class File extends Widget { if (this.getProp('hidePath')) this.widget.classList.add('hide-path') this.text = DOM.get(this.widget, '.text')[0] + + var ext = this.getProp('extension') + if (Array.isArray(ext)) { + ext = '(' + ext.join('|') + ')' + } + this.on('fast-click', (e)=>{ if (e.capturedByEditor === true) return uiFilebrowser({ - extension: this.getProp('extension').replace(/^\.?(.*)$/, '$1'), + extension: ext.replace(/^\.?(.*)$/, '$1'), directory: this.getProp('directory') === 'auto' ? undefined : this.getProp('directory'), loadDir: this.getProp('allowDir'), save: this.getProp('mode') === 'save'