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

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
}