This commit is contained in:
Vanessa 2023-10-09 23:25:48 +08:00
parent ff6220abaa
commit a3094fe3ea

View File

@ -160,10 +160,17 @@ const editKeydown = (app: App, event: KeyboardEvent) => {
if (getSelection().rangeCount > 0) {
range = getSelection().getRangeAt(0);
}
const activePanelElement = document.querySelector(".layout__tab--active");
let isFileFocus = false;
if (activePanelElement && activePanelElement.classList.contains("sy__file")) {
isFileFocus = true;
}
if (range) {
window.siyuan.dialogs.find(item => {
if (item.editor && item.editor.protyle.element.contains(range.startContainer)) {
protyle = item.editor.protyle;
// https://github.com/siyuan-note/siyuan/issues/9384
isFileFocus = false;
return true;
}
});
@ -224,11 +231,6 @@ const editKeydown = (app: App, event: KeyboardEvent) => {
return false;
}
}
const activePanelElement = document.querySelector(".layout__tab--active");
let isFileFocus = false;
if (activePanelElement && activePanelElement.classList.contains("sy__file")) {
isFileFocus = true;
}
let searchKey = "";
if (matchHotKey(window.siyuan.config.keymap.general.replace.custom, event)) {
searchKey = window.siyuan.config.keymap.general.replace.custom;
@ -254,7 +256,7 @@ const editKeydown = (app: App, event: KeyboardEvent) => {
return true;
}
if (!isFileFocus && matchHotKey(window.siyuan.config.keymap.editor.general.quickMakeCard.custom, event)) {
if (protyle.title.editElement.contains(range.startContainer)) {
if (protyle.title?.editElement.contains(range.startContainer)) {
quickMakeCard(protyle, [protyle.title.element]);
} else {
const selectElement: Element[] = [];