From 1363595f0fb03d3139231c9d99e3106821996a69 Mon Sep 17 00:00:00 2001 From: indigoxela Date: Sat, 30 Sep 2023 14:47:34 +0200 Subject: [PATCH] Issue #18: Keyboard navigation, shortcuts --- js/tinymce-integration.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/js/tinymce-integration.js b/js/tinymce-integration.js index f646072..9704c5a 100644 --- a/js/tinymce-integration.js +++ b/js/tinymce-integration.js @@ -50,6 +50,19 @@ editor.ui.registry.addIcon(name, icons[name]); } } + // @see https://github.com/backdrop-contrib/tinymce/issues/18 + editor.shortcuts.add('ctrl+1', 'Jump to menubar', function () { + let menuBar = document.getElementsByClassName('tox-menubar'); + if (menuBar.length) { + menuBar[0].getElementsByTagName('button')[0].focus(); + } + }); + editor.shortcuts.add('ctrl+2', 'Jump to toolbar', function () { + let myToolBar = document.getElementsByClassName('tox-toolbar-overlord'); + if (myToolBar.length) { + myToolBar[0].getElementsByTagName('button')[0].focus(); + } + }); }); };