From b0d543b5fb3589c16f43e61ccbdfbb79e7a7ec80 Mon Sep 17 00:00:00 2001 From: DianaXWiki Date: Mon, 14 Apr 2025 13:19:26 +0300 Subject: [PATCH] Add escape key to markdown toolbar #1831 --- www/common/common-ui-elements.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index c3de21053..2a00c5321 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1171,6 +1171,14 @@ define([ var href = Messages.mdToolbar_tutorial; common.openUnsafeURL(href); }).appendTo($toolbar); + + $toolbar.on('keydown', function (e) { + if (e.key === 'Escape' || e.keyCode === 27) { + editor.focus(); + e.preventDefault(); + } + }); + return $toolbar; }; UIElements.createMarkdownToolbar = function (common, editor, opts) {