diff --git a/CHANGELOG.md b/CHANGELOG.md index 63c3e6c8..99758c59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 1.8.4 + +- widgets + - file: add `mode` property, for choosing between `open` and `save` modes + ## 1.8.3 - bug fixes diff --git a/src/client/widgets/basics/file.js b/src/client/widgets/basics/file.js index d05f369d..5fc81593 100644 --- a/src/client/widgets/basics/file.js +++ b/src/client/widgets/basics/file.js @@ -17,6 +17,7 @@ module.exports = class File extends Widget { _separator_file_style: 'File style', align: {type: 'string', value: 'center', choices: ['center', 'left', 'right'], help: 'Set to `left` or `right` to change text alignment (otherwise center)'}, hidePath: {type: 'boolean', value: false, help: 'Set to `true` to only display the filename (the whole path will still be used as value)'}, + mode: {type: 'string', value: 'open', choices: ['open', 'save'], help: 'File browser mode'}, }, class_specific: { directory: {type: 'string', value: 'auto', help: 'Default browsing directory'}, @@ -47,7 +48,8 @@ module.exports = class File extends Widget { uiFilebrowser({ extension: this.getProp('extension').replace(/^\.?(.*)$/, '$1'), directory: this.getProp('directory') === 'auto' ? undefined : this.getProp('directory'), - loadDir: this.getProp('allowDir') + loadDir: this.getProp('allowDir'), + save: this.getProp('mode') === 'save' }, (path)=>{ this.setValue(path.join(path[0][0] === '/' ? '/' : '\\'), {