diff --git a/src/client/app/ui/utils.js b/src/client/app/ui/utils.js index c740d407..91baa042 100644 --- a/src/client/app/ui/utils.js +++ b/src/client/app/ui/utils.js @@ -309,7 +309,7 @@ module.exports = { document.removeEventListener('keydown', keyHandler) }) - ipc.send('listDir', {}) + ipc.send('listDir', {path: [options.directory]}) } diff --git a/src/client/app/widgets/index.js b/src/client/app/widgets/index.js index 300d8347..925bbd13 100644 --- a/src/client/app/widgets/index.js +++ b/src/client/app/widgets/index.js @@ -58,6 +58,7 @@ module.exports.widgets = { keys: require('./inputs/keys'), script: require('./inputs/script'), gyroscope: require('./inputs/gyroscope'), + file: require('./inputs/file'), // maths // deprecated / hidden @@ -73,5 +74,5 @@ module.exports.categories = { 'Plots':['plot','eq','visualizer','led', 'rgbled','meter','text', 'image', 'svg', 'frame'], 'Containers':['panel','strip','modal', 'clone'], 'Switchers':['switcher','crossfader'], - 'Inputs':['input', 'keys', 'script', 'gyroscope'] + 'Inputs':['input', 'keys', 'script', 'gyroscope', 'file'] } diff --git a/src/client/app/widgets/inputs/file.js b/src/client/app/widgets/inputs/file.js new file mode 100644 index 00000000..17185b16 --- /dev/null +++ b/src/client/app/widgets/inputs/file.js @@ -0,0 +1,63 @@ +var Widget = require('../common/widget'), + html = require('nanohtml'), + {remoteBrowse} = require('../../ui/utils') + +module.exports = class Input extends Widget { + + static defaults() { + + return super.defaults({ + + _input:'input', + + directory: {type: 'string', value: 'auto', help: 'Default browsing directory'}, + extension: {type: 'string', value: '*', help: 'Only display files with this extension'}, + hidePath: {type: 'boolean', value: false, help: 'Set to `true` to only display the filename (the whole path will still be used as value)'} + + }) + + } + + constructor(options) { + + super({...options, html: html` +