From 3002877418b44c052ddbbc6f52ff9fe0ee29175b Mon Sep 17 00:00:00 2001 From: DianaXWiki Date: Tue, 22 Apr 2025 19:40:09 +0300 Subject: [PATCH] Fix #1831 --- www/code/inner.js | 15 ++------------- www/common/common-ui-elements.js | 1 + 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/www/code/inner.js b/www/code/inner.js index fcad5e5c0..ddf595abc 100644 --- a/www/code/inner.js +++ b/www/code/inner.js @@ -580,19 +580,8 @@ define([ editor.setOption("extraKeys", { "Esc": function() { - const $toolbar = $('.cp-markdown-toolbar:visible'); - if ($toolbar.length) { - const $btn = $toolbar.find('button:visible').first(); - if ($btn.length) { - setTimeout(() => { - $btn[0].focus(); - $btn[0].scrollIntoView({ block: 'center', behavior: 'smooth' }); // if toolbar is visible then escape key focuses on first button of toolbar - }, 0); - } - } - else { - $(body).focus(); //fallback - } + e.preventDefault(); + $(body).focus(); } }); diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index c22f7dccf..c1619fa66 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1160,6 +1160,7 @@ define([ for (var k in actions) { let $b = $('