file: allow selecting folders (#588)
This commit is contained in:
parent
4c0636c7a4
commit
fe7d70ca40
3 changed files with 9 additions and 6 deletions
|
|
@ -204,7 +204,7 @@ module.exports = {
|
|||
|
||||
var choice = DOM.get(list, ':checked')[0]
|
||||
|
||||
if (!choice && (!save || !saveInput.value)) return
|
||||
if (!choice && (!save || !saveInput.value) && !options.loadDir) return
|
||||
|
||||
if (choice && choice.classList.contains('folder') && (!save || !saveInputFocus)) {
|
||||
ipc.send('listDir', {path: [path, choice.value]})
|
||||
|
|
@ -216,7 +216,7 @@ module.exports = {
|
|||
callback([path, saveInput.value])
|
||||
popup.close()
|
||||
} else {
|
||||
callback([path, choice.value])
|
||||
callback([path, choice && options.loadDir ? choice.value : ''])
|
||||
popup.close()
|
||||
}
|
||||
}
|
||||
|
|
@ -260,7 +260,7 @@ module.exports = {
|
|||
break
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (index !== -1) {
|
||||
list.childNodes[index].firstElementChild.click()
|
||||
list.childNodes[index].firstElementChild.focus()
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ module.exports = class Input extends Widget {
|
|||
|
||||
static description() {
|
||||
|
||||
return 'File selector (server-side).'
|
||||
return 'File/Folder selector (server-side).'
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -38,10 +38,12 @@ module.exports = class Input extends Widget {
|
|||
|
||||
remoteBrowse({
|
||||
extension: this.getProp('extension').replace(/^\.?(.*)$/, '$1'),
|
||||
directory: this.getProp('directory') === 'auto' ? undefined : this.getProp('directory')
|
||||
directory: this.getProp('directory') === 'auto' ? undefined : this.getProp('directory'),
|
||||
loadDir: true
|
||||
}, (path)=>{
|
||||
|
||||
this.setValue(path.join(path[0][0] === '/' ? '/' : '\\'), {
|
||||
var newPath = path[1] === '' ? path[0] : path.join(path[0][0] === '/' ? '/' : '\\')
|
||||
this.setValue(newPath, {
|
||||
sync: true,
|
||||
send: true
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue