From 8ef75ad01c3c5c9b4283e43846e1b8482f70afde Mon Sep 17 00:00:00 2001 From: rebornix Date: Wed, 9 Aug 2017 14:25:59 -0700 Subject: [PATCH] Fix #538. Update action registration with key chord. --- ...-the-editor-adding-an-action-to-an-editor-instance.html | 7 ++++++- .../adding-an-action-to-an-editor-instance/sample.js | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/test/playground.generated/interacting-with-the-editor-adding-an-action-to-an-editor-instance.html b/test/playground.generated/interacting-with-the-editor-adding-an-action-to-an-editor-instance.html index 0c138693..a3876230 100644 --- a/test/playground.generated/interacting-with-the-editor-adding-an-action-to-an-editor-instance.html +++ b/test/playground.generated/interacting-with-the-editor-adding-an-action-to-an-editor-instance.html @@ -53,6 +53,7 @@ var editor = monaco.editor.create(document.getElementById("container"), { // Explanation: // Press F1 (Alt-F1 in IE) => the action will appear and run if it is enabled // Press Ctrl-F10 => the action will run if it is enabled +// Press Chord Ctrl-K, Ctrl-M => the action will run if it is enabled editor.addAction({ // An unique identifier of the contributed action. @@ -62,7 +63,11 @@ editor.addAction({ label: 'My Label!!!', // An optional array of keybindings for the action. - keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyCode.F10], + keybindings: [ + monaco.KeyMod.CtrlCmd | monaco.KeyCode.F10, + // chord + monaco.KeyMod.chord(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KEY_K, monaco.KeyMod.CtrlCmd | monaco.KeyCode.KEY_M) + ], // A precondition for this action. precondition: null, diff --git a/website/playground/new-samples/interacting-with-the-editor/adding-an-action-to-an-editor-instance/sample.js b/website/playground/new-samples/interacting-with-the-editor/adding-an-action-to-an-editor-instance/sample.js index 2993571b..18e2ec7c 100644 --- a/website/playground/new-samples/interacting-with-the-editor/adding-an-action-to-an-editor-instance/sample.js +++ b/website/playground/new-samples/interacting-with-the-editor/adding-an-action-to-an-editor-instance/sample.js @@ -15,6 +15,7 @@ var editor = monaco.editor.create(document.getElementById("container"), { // Explanation: // Press F1 (Alt-F1 in IE) => the action will appear and run if it is enabled // Press Ctrl-F10 => the action will run if it is enabled +// Press Chord Ctrl-K, Ctrl-M => the action will run if it is enabled editor.addAction({ // An unique identifier of the contributed action. @@ -24,7 +25,11 @@ editor.addAction({ label: 'My Label!!!', // An optional array of keybindings for the action. - keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyCode.F10], + keybindings: [ + monaco.KeyMod.CtrlCmd | monaco.KeyCode.F10, + // chord + monaco.KeyMod.chord(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KEY_K, monaco.KeyMod.CtrlCmd | monaco.KeyCode.KEY_M) + ], // A precondition for this action. precondition: null,