Vanessa 2025-03-15 18:13:01 +08:00
parent 90a8e679b3
commit c845e0acd9
4 changed files with 13 additions and 4 deletions

View File

@ -1418,7 +1418,7 @@ export const windowKeyDown = (app: App, event: KeyboardEvent) => {
window.siyuan.menus.menu.element.style.zIndex < (window.siyuan.dialogs[0].element.querySelector(".b3-dialog") as HTMLElement).style.zIndex) {
// 窗口高于菜单时,先关闭窗口,如 av 修改列 icon 时
} else {
window.siyuan.menus.menu.remove();
window.siyuan.menus.menu.remove(true);
return;
}
}

View File

@ -97,7 +97,16 @@ export class Menu {
window.removeEventListener(isMobile() ? "touchmove" : this.wheelEvent, this.preventDefault, false);
}
public remove() {
public remove(isKeyEvent = false) {
if (isKeyEvent) {
const subElement = window.siyuan.menus.menu.element.querySelector(".b3-menu__item--show");
if (subElement) {
subElement.classList.remove("b3-menu__item--show");
subElement.classList.add("b3-menu__item--current");
subElement.querySelector(".b3-menu__item--current")?.classList.remove("b3-menu__item--current");
return;
}
}
if (window.siyuan.menus.menu.removeCB) {
window.siyuan.menus.menu.removeCB();
window.siyuan.menus.menu.removeCB = undefined;

View File

@ -1580,7 +1580,7 @@ export class WYSIWYG {
} else if (range.toString() !== "" && startContainer.isSameNode(range.endContainer) &&
range.startContainer.nodeType === 3 &&
// 需使用 wholeText https://github.com/siyuan-note/siyuan/issues/14339
range.endOffset === range.endContainer.wholeText.length &&
range.endOffset === (range.endContainer as Text).wholeText.length &&
range.startOffset === 0 &&
!["DIV", "TD", "TH", "TR"].includes(range.startContainer.parentElement.tagName)) {
// 选中整个内联元素

View File

@ -1248,7 +1248,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
protyle.hint.enableExtend = false;
} else if (!window.siyuan.menus.menu.element.classList.contains("fn__none")) {
// 防止 ESC 时选中当前块
window.siyuan.menus.menu.remove();
window.siyuan.menus.menu.remove(true);
} else if (nodeElement.classList.contains("protyle-wysiwyg--select")) {
hideElements(["select"], protyle);
countBlockWord([], protyle.block.rootID);