This commit is contained in:
DianaXWiki 2025-04-22 19:40:09 +03:00 committed by yflory
parent 5b748c26ec
commit 3002877418
2 changed files with 3 additions and 13 deletions

View File

@ -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();
}
});

View File

@ -1160,6 +1160,7 @@ define([
for (var k in actions) {
let $b = $('<button>', {
'data-notippy':1,
'data-type': k,
'class': 'pure-button cp-markdown-' + k,
'title': Messages['mdToolbar_' + k] || k,
'aria-label': Messages['mdToolbar_' + k] || k