Skip to content

Commit

Permalink
🎨 #13653
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Jan 10, 2025
1 parent 029d824 commit 736fdb2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
5 changes: 1 addition & 4 deletions app/src/boot/globalEvent/click.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"]);
}
Expand Down
8 changes: 8 additions & 0 deletions app/src/boot/globalEvent/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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", () => {
Expand Down Expand Up @@ -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);
});
Expand Down
1 change: 0 additions & 1 deletion app/src/protyle/wysiwyg/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 736fdb2

Please sign in to comment.