Vanessa 2025-01-10 11:17:40 +08:00
parent 029d824834
commit 736fdb2d7e
3 changed files with 9 additions and 5 deletions

View file

@ -37,10 +37,7 @@ export const globalClick = (event: MouseEvent & { target: HTMLElement }) => {
window.siyuan.menus.menu.remove();
}
}
// protyle.toolbar 点击空白处时进行隐藏
if (!hasClosestByClassName(event.target, "protyle-toolbar")) {
hideAllElements(["toolbar"]);
}
if (!hasClosestByClassName(event.target, "pdf__outer")) {
hideAllElements(["pdfutil"]);
}

View file

@ -19,6 +19,7 @@ import {Tab} from "../../layout/Tab";
import {hideTooltip} from "../../dialog/tooltip";
import {openFileById} from "../../editor/util";
import {checkFold} from "../../util/noRelyPCFunction";
import {hideAllElements} from "../../protyle/ui/hideElements";
export const initWindowEvent = (app: App) => {
document.body.addEventListener("mouseleave", () => {
@ -57,6 +58,13 @@ export const initWindowEvent = (app: App) => {
}
});
window.addEventListener("mousedown", (event) => {
// protyle.toolbar 点击空白处时进行隐藏
if (!hasClosestByClassName(event.target as Element, "protyle-toolbar")) {
hideAllElements(["toolbar"]);
}
});
window.addEventListener("keyup", (event) => {
windowKeyUp(app, event);
});

View file

@ -2656,7 +2656,6 @@ export class WYSIWYG {
if (newRange.toString().replace(Constants.ZWSP, "") !== "") {
protyle.toolbar.render(protyle, newRange);
} else {
hideElements(["toolbar"], protyle);
// https://github.com/siyuan-note/siyuan/issues/9785
protyle.toolbar.range = newRange;
}