diff --git a/CHANGELOG.md b/CHANGELOG.md index 826c95c1..b2a9cfe5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,9 @@ - bug fixes - range: value update issue (internal touch state not updated properly) - - scripting: send(): ignore `ignoreDefaults` property + - scripting: send(): ignore `ignoreDefaults` property + - script: onKeyboard script not cleaned upon edition / removal + - editor: some variables not appearing as defined in `onKeyboard` ## 1.15.7 diff --git a/package.json b/package.json index 7bba5837..771800d7 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "open-stage-control", "productName": "Open Stage Control", "description": "Libre and modular OSC / MIDI controller", - "version": "1.15.7", + "version": "1.15.8", "author": { "name": "Jean-Emmanuel Doucet", "email": "jean-emmanuel@ammd.net" diff --git a/resources/docs/docs/widgets/properties-reference.md b/resources/docs/docs/widgets/properties-reference.md index 94765f03..3b315b23 100644 --- a/resources/docs/docs/widgets/properties-reference.md +++ b/resources/docs/docs/widgets/properties-reference.md @@ -917,7 +917,7 @@ | property | type |default | description | | --- | --- | --- | --- | |
onKeyboard#
| `script` | "" | Script executed whenever the widget receives a keyboard event if `keyBinding` is set). See documentation. | - |
keyBinding#
| `string`|
`array` | "" | Key combo `string` or `array` of strings (see KeyboardJS documentation).

If the editor is enabled, some keys / combos will not work. | + |
keyBinding#
| `string`|
`array` | "" | Key combo `string` or `array` of strings (see KeyboardJS documentation).

If the editor is enabled, some keys / combos will not work.

To process all keystroke events, write `['']` | |
keyRepeat#
| `boolean` | true | Set to `false` to prevent keydown repeats when holding the key combo pressed | |
keyType#
| `string` | "keydown" | Determines which key event trigger the script's execution

Choices: `keydown`, `keyup`, `both` | diff --git a/src/client/ui/ui-code-editor.js b/src/client/ui/ui-code-editor.js index d39c39aa..a634bdd9 100644 --- a/src/client/ui/ui-code-editor.js +++ b/src/client/ui/ui-code-editor.js @@ -166,12 +166,8 @@ class CodeEditor { if (this.language === 'javascript') { let globals = {} - if (this.name === 'onEvent') { - if (this.widget.getProp('event') === 'value') { - globals = {id: true, value: true, touch: true} - } else if (this.widget.getProp('event') === 'keyboard') { - globals = {type: true, key: true, code: true, ctrl: true, shift: true, alt: true, meta: true} - } + if (this.name === 'onKeyboard') { + globals = {type: true, key: true, code: true, ctrl: true, shift: true, alt: true, meta: true} } else if (this.name === 'onValue') { globals = {id: true, value: true, touch: true} } else if (this.name === 'onDraw') { diff --git a/src/client/widgets/scripts/script-widget.js b/src/client/widgets/scripts/script-widget.js index b75fed2a..5c06f6df 100644 --- a/src/client/widgets/scripts/script-widget.js +++ b/src/client/widgets/scripts/script-widget.js @@ -26,7 +26,8 @@ class ScriptWidget extends Widget { keyBinding: {type: 'string|array', value: '', help: [ 'Key combo `string` or `array` of strings (see KeyboardJS documentation).', - 'If the editor is enabled, some keys / combos will not work.' + 'If the editor is enabled, some keys / combos will not work.', + 'To process all keystroke events, write `[\'\']`' ]}, keyRepeat: {type: 'boolean', value: true, help: 'Set to `false` to prevent keydown repeats when holding the key combo pressed'}, keyType: {type: 'string', value: 'keydown', choices: ['keydown', 'keyup', 'both'], help: 'Determines which key event trigger the script\'s execution'}, @@ -107,7 +108,7 @@ class ScriptWidget extends Widget { onRemove() { - if (this.getProp('event') === 'keyboard' && this.getProp('keyBinding')) { + if (this.getProp('onKeyboard') && this.getProp('keyBinding')) { keyboardJS.withContext('global', ()=>{