diff --git a/CHANGELOG.md b/CHANGELOG.md index d4d0d55f..ee901e96 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,8 @@ - widgets - frames: allow loading local html files without requiring a web server to serve them - text: escape html tags characters (`<` & `>`) - + - input: added `asYouType` property + ## 0.47.4 - bug fixes diff --git a/src/client/app/widgets/inputs/input.js b/src/client/app/widgets/inputs/input.js index a8f18aae..9dea5330 100644 --- a/src/client/app/widgets/inputs/input.js +++ b/src/client/app/widgets/inputs/input.js @@ -19,7 +19,8 @@ module.exports = class Input extends Canvas { vertical: {type: 'boolean', value: false, help: 'Set to `true` to display the text vertically'}, align: {type: 'string', value: '', help: 'Set to `left` or `right` to change text alignment (otherwise center)'}, unit: {type: 'string', value: '', help: 'Unit will be appended to the displayed widget\'s value (it doesn\'t affect osc messages)'}, - editable: {type: 'boolean', value: true, help: 'Set to `false` to make the input non-editable'} + editable: {type: 'boolean', value: true, help: 'Set to `false` to make the input non-editable'}, + asYouType: {type: 'boolean', value: false, help: 'Set to `true` to make the input send its value at each keystroke'} }) @@ -51,10 +52,16 @@ module.exports = class Input extends Canvas { this.blur(this.tabKeyBlur) this.tabKeyBlur = false }) + var asYouType = this.getProp('asYouType') this.input.addEventListener('keydown', (e)=>{ if (e.keyCode === 13) this.blur() // enter else if (e.keyCode === 27) this.blur(false) // esc else if (e.keyCode === 9) this.tabKeyBlur = true // tab + else if (asYouType) { + setTimeout(()=>{ + this.inputChange() + }) + } }) } else { this.widget.classList.add('not-editable')