Fix focus issues #1831

This commit is contained in:
DianaXWiki 2025-06-17 13:55:36 +03:00
parent d183557828
commit ac02106bea
3 changed files with 21 additions and 2 deletions

View File

@ -1304,7 +1304,7 @@ define([
}
}
if (appType !== 'code') {
if (appType !== 'code' && appType !== 'slide') {
$(window).on('resize', updateToolbarVisibility);
updateToolbarVisibility();
}

View File

@ -1098,6 +1098,7 @@ define([
editor.setOption("extraKeys", {
"Esc": function () {
editor.display.input.blur();
$(cancelBlock).focus();
},
});
editor.setOption('lineNumbers', true);
@ -1115,7 +1116,12 @@ define([
}
editor.refresh();
editor.save();
editor.focus();
var firstBtn = $(markdownTb.toolbar).find('button').get(0);
if (firstBtn) {
firstBtn.focus();
} else {
editor.focus(); // fallback
}
});
var toggleRow = h('div.cp-markdown-toggle-row');
@ -5580,6 +5586,7 @@ define([
var editor = APP.responseEditor = cm.editor;
editor.setOption("extraKeys", {
"Esc": function() {
editor.display.input.blur();
$(preview).focus();
}
});
@ -5613,6 +5620,14 @@ define([
$preview.hide();
editor.refresh();
$tb.show();
setTimeout(function () {
var firstBtn = $(markdownTb.toolbar).find('button').get(0);
if (firstBtn) {
firstBtn.focus();
} else {
editor.focus(); // fallback
}
}, 0);
});
APP.$e = $e;
APP.$p = $p;

View File

@ -551,6 +551,10 @@ define([
$(code).show();
APP.editor.refresh();
$(button).hide();
var firstBtn = $(markdownTb.toolbar).find('button').get(0);
if (firstBtn) {
firstBtn.focus();
}
});
$(save).click(function () {
$(save).hide();