V 2024-11-16 09:58:30 +08:00 committed by Daniel
parent 53e2953d65
commit c93b0f6ace
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
2 changed files with 6 additions and 5 deletions

View file

@ -1371,6 +1371,11 @@ export const windowKeyDown = (app: App, event: KeyboardEvent) => {
return;
}
// 闪卡长按 Esc 光标定位到闪卡按钮上 https://github.com/siyuan-note/siyuan/issues/12989
if (document.activeElement && hasClosestByClassName(document.activeElement, "card__action")) {
return;
}
if (window.siyuan.dialogs.length > 0) {
window.siyuan.dialogs[window.siyuan.dialogs.length - 1].destroy();
return;
@ -1404,10 +1409,6 @@ export const windowKeyDown = (app: App, event: KeyboardEvent) => {
return;
}
// 闪卡长按 Esc 光标定位到闪卡按钮上 https://github.com/siyuan-note/siyuan/issues/12989
if (document.activeElement && hasClosestByClassName(document.activeElement, "card__action")) {
return;
}
// 光标在文档树等面板中,按 Esc 回到编辑器中 https://github.com/siyuan-note/siyuan/issues/4289
if (getSelection().rangeCount > 0) {
const range = getSelection().getRangeAt(0);

View file

@ -1180,7 +1180,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
// https://github.com/siyuan-note/siyuan/issues/12989
const cardElement = hasClosestByClassName(range.startContainer, "card__main", true);
if (cardElement && document.activeElement && document.activeElement.classList.contains("protyle-wysiwyg")) {
(cardElement.querySelector(".card__action:not(.fn__none) button") as HTMLElement).focus();
(cardElement.querySelector(".card__action:not(.fn__none) button:not([disabled])") as HTMLElement).focus();
hideElements(["select"], protyle);
}
} else {