From 05c2e93d286b97d9957e1c2c299519324e4b005c Mon Sep 17 00:00:00 2001 From: markfijneman <48481393+markfijneman@users.noreply.github.com> Date: Fri, 11 Apr 2025 17:24:49 +0200 Subject: [PATCH] Remove custom CodeMirror shortcuts, disable hotkeys.js element filter --- front/public/hotkeys-iframe.js | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/front/public/hotkeys-iframe.js b/front/public/hotkeys-iframe.js index a03ab294c..e48cf86a8 100644 --- a/front/public/hotkeys-iframe.js +++ b/front/public/hotkeys-iframe.js @@ -359,6 +359,12 @@ // above is the hotkeys.js library code // CTFNote code starts here: +// Disable hotkeys.js INPUT, SELECT and TEXTAREA filter (https://wangchujiang.com/hotkeys-js/#filter) +// This is required for shortcuts to work in HedgeDoc's CodeMirror editor +hotkeys.filter = function() { + return true; +} + hotkeys('ctrl+k, command+k', function (event) { event.stopImmediatePropagation(); event.preventDefault(); @@ -372,23 +378,3 @@ hotkeys('ctrl+s, command+s', function (event) { parent.postMessage('solveTask', '*'); }); - -// Hotkeys for HedgeDoc CodeMirror editor -editor.setOption('extraKeys', { - 'Ctrl-K': () => { - parent.postMessage('showSearchDialog', '*'); - return false; - }, - 'Cmd-K': () => { - parent.postMessage('showSearchDialog', '*'); - return false; - }, - 'Ctrl-S': () => { - parent.postMessage('solveTask', '*'); - return false; - }, - 'Cmd-S': () => { - parent.postMessage('solveTask', '*'); - return false; - }, -});