Remove default ctrl-enter keybinding from monaco editor

Fixes #3093
This commit is contained in:
Nick O'Leary 2021-07-30 11:50:21 +01:00
parent 889d23e9bd
commit 27ed81614b
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
1 changed files with 22 additions and 13 deletions

View File

@ -921,6 +921,15 @@ RED.editor.codeEditor.monaco = (function() {
/*********** Create the monaco editor ***************/
var ed = monaco.editor.create(el, editorOptions);
//Unbind ctrl-Enter (default action is to insert a newline in editor) This permits the shortcut to close the tray.
try {
ed._standaloneKeybindingService.addDynamicKeybinding(
'-editor.action.insertLineAfter', // command ID prefixed by '-'
null, // keybinding
() => {} // need to pass an empty handler
);
} catch (error) { }
ed.nodered = {
refreshModuleLibs: refreshModuleLibs //expose this for function node externalModules refresh
}