Search code examples
javascriptace-editorshortcut

Ace editor - shortcuts with double letters


Right now, I'm working on key binds.

I have found, that I'm not able to make a key bind, which has two letters next to each other. The key bind I'm trying to make, looks like this:

editor.commands.addCommands([{
                name: "test",
                bindKey: {
                    win: "Ctrl-K-D",
                    mac: "Command-K-D"
                },
                exec: function (editor, line) {
                    alert("test");
                },
                readOnly: true
            }])

It returns this error in the console: invalid modifier k in Ctrl-K-D

It doesn't seem to work. However, if I bind a function to say, Ctrl-Shift-A It works fine.

Is there a way to have a key bind with two letters next to each other?

Thanks in advance!


Solution

  • Use "Ctrl-K Ctrl-D" if you want to allow pressing D when K is already released. There is no way yet to bind to a key the same way as to a modifier, that is allowing any order of K and D keys and requiring them to be pressed down at the same time.