# Shortcuts for Monaco editor

**URL:** <https://discourse.nodered.org/t/shortcuts-for-monaco-editor/62855>\
**Category:** General\
**Tags:** monaco\
**Created:** [19 May 2022 15:23 UTC](https://discourse.nodered.org/t/shortcuts-for-monaco-editor/62855 "2022-05-19T15:23:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![hazymat](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hazymat/32/108159_2.png) [@hazymat](https://discourse.nodered.org/u/hazymat)\
**Post date:** [19 May 2022 15:23 UTC](https://discourse.nodered.org/t/shortcuts-for-monaco-editor/62855/1 "2022-05-19T15:23:09Z")

</div>

Question about the Monaco text editor, apologies if this is somewhat off-topic, please remove my post if so.

But last year when this was added, I noted here on the forums, and possibly by raising an issue separately, that pressing Ctrl-Enter used to close the editor box, whereas in Monaco it would so something different, I don't recall what - something like insert a new line.

Has this been resolved? Sorry for the vague hand-wavy post, but I just don't have access to my home server this minute and wanted to write this here in case I forgot to mention it.

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [19 May 2022 15:47 UTC](https://discourse.nodered.org/t/shortcuts-for-monaco-editor/62855/2 "2022-05-19T15:47:47Z")

</div>

@hazymat - This post moved to its own topic.  
The original topic is about a new beta version...

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [19 May 2022 17:42 UTC](https://discourse.nodered.org/t/shortcuts-for-monaco-editor/62855/3 "2022-05-19T17:42:01Z")

</div>

> [@hazymat](#):
>
> Has this been resolved

Yes. Search the GitHub repo issues for the word monaco

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [22 May 2022 06:31 UTC](https://discourse.nodered.org/t/shortcuts-for-monaco-editor/62855/4 "2022-05-22T06:31:43Z")

</div>

> <https://github.com/node-red/node-red/issues/3093>
>
> \### Current Behavior
> 
> Users have reported pressing CTRL-Enter when monaco edit…or has focus, does not operate the Done button (accept changes and close the tray)
> 
> Reported \[here \](https://discourse.nodered.org/t/using-monaco-editor-monaco-branch-now-in-fork-pr-2971/26561/144)and \[here\](https://discourse.nodered.org/t/node-red-2-0-3-released/48816/25?u=steve-mcl) 
> 
> \### Expected Behavior
> 
> Pressing CTRL-Enter while monaco has focus should close the tray (and accept changes)
> 
> 
> \### Steps To Reproduce
> 
> press CTRL-Enter when monaco editor has focus
> 
> \### Solution...
> 
> I would normally raise a PR but my dev env needs some work - so if you pick this up great, if not, it is here for reference...
> 
> Add the below code after the creation of the monaco editor (\[here\](https://github.com/node-red/node-red/blob/889d23e9bd4e8408685969b56120fd449b214620/packages/node\_modules/%40node-red/editor-client/src/js/ui/editors/code-editors/monaco.js#L923))
> \`\`\`
> //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) { }
> \`\`\`
> 
> \### Environment
> 
> \- Node-RED version: 2.x
> \- Node.js version: 14
> \- npm version: 7
> \- Platform/OS: All
> \- Browser: chrom

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [21 July 2022 06:32 UTC](https://discourse.nodered.org/t/shortcuts-for-monaco-editor/62855/5 "2022-07-21T06:32:21Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
