diff --git a/app/src/boot/globalEvent/click.ts b/app/src/boot/globalEvent/click.ts index 01b869415ae..bcf9f050ad5 100644 --- a/app/src/boot/globalEvent/click.ts +++ b/app/src/boot/globalEvent/click.ts @@ -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"]); } diff --git a/app/src/boot/globalEvent/event.ts b/app/src/boot/globalEvent/event.ts index 273a42facd3..57e098d63b9 100644 --- a/app/src/boot/globalEvent/event.ts +++ b/app/src/boot/globalEvent/event.ts @@ -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); }); diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts index a496d3c6858..fbb7d0c360f 100644 --- a/app/src/protyle/wysiwyg/index.ts +++ b/app/src/protyle/wysiwyg/index.ts @@ -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; }