Any way to add a keyboard entry to ACE/Monaco editor?

Hi all,

I keep triggering my muscle memory for save when I'm using the file editor in uibuilder :older_adult: I doubt I'm the only person.

So I'd like to add an override for ctrl-s when focused on that element. Is there a way of doing this? I've been rather going round in circles looking for an answer.

Thanks. J.

With Monaco ...

Paste this...

var jsCode = '"use strict";'
var editor = monaco.editor.create(document.getElementById('container'), {
	value: jsCode,
	language: 'javascript'

editor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyS, function() {
    alert('SAVE pressed!');

... into the playground : Monaco Editor Playground

So yes, monaco can bind CTRL+S

However, node-red API does not export this right now. Something to perhaps consider for V3?

Thanks Steve. Definitely would be nice to see custom save handling in v3 - I realise that it isn't really needed for things like the function node, only for nodes that need some kind of external save - uibuilder mostly I suspect but maybe the blockly node?

I was actually hoping that there would be something I could do at the jQuery level. Maybe attaching a keycode event to the parent element? As that would possibly work for both ACE and Monaco.

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