file: add mode property, for choosing between open and save modes
This commit is contained in:
parent
68aeecd8b0
commit
8e3e6266c5
2 changed files with 8 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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] === '/' ? '/' : '\\'), {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue