scripting: scripting functions not working inside browseFile() callback
This commit is contained in:
parent
28d06cc14a
commit
aa1ee85f62
2 changed files with 16 additions and 1 deletions
|
|
@ -569,14 +569,28 @@ class ScriptVm extends Vm {
|
|||
callback = options
|
||||
options = {}
|
||||
}
|
||||
|
||||
|
||||
if (typeof callback === 'function') {
|
||||
|
||||
var widget = this.getWidget(),
|
||||
valueOptions = this.getValueOptions()
|
||||
|
||||
uiFilebrowser({
|
||||
extension: options.extention || '*',
|
||||
directory: options.directory || undefined,
|
||||
loadDir: !!options.allowDir,
|
||||
save: options.mode === 'save'
|
||||
}, (path)=>{
|
||||
callback(path.join(path[0][0] === '/' ? '/' : '\\'))
|
||||
this.setWidget(widget)
|
||||
this.setValueOptions(valueOptions)
|
||||
try {
|
||||
callback(path.join(path[0][0] === '/' ? '/' : '\\'))
|
||||
} catch(e) {
|
||||
widget.errorProp('script', 'browseFile', e)
|
||||
}
|
||||
this.setWidget()
|
||||
this.setValueOptions()
|
||||
})
|
||||
} else {
|
||||
widget.errorProp('script', 'browseFile', 'callback argument must be a function')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue