Skip to content

Commit

Permalink
🎨 fix #9793
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Nov 30, 2023
1 parent 4928e8e commit 44d3db3
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 4 deletions.
12 changes: 12 additions & 0 deletions app/src/boot/globalEvent/click.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@ export const globalClick = (event: MouseEvent & { target: HTMLElement }) => {
if (!hasClosestByClassName(event.target, "pdf__outer")) {
hideAllElements(["pdfutil"]);
}
// dock float 时,点击空白处,隐藏 dock。场景:文档树上重命名后
if (!isWindow() && window.siyuan.layout.leftDock &&
!hasClosestByClassName(event.target, "b3-dialog--open", true) &&
!hasClosestByClassName(event.target, "b3-menu") &&
!hasClosestByClassName(event.target, "block__popover") &&
!hasClosestByClassName(event.target, "dock") &&
!hasClosestByClassName(event.target, "layout--float", true)
) {
window.siyuan.layout.bottomDock.hideDock();
window.siyuan.layout.leftDock.hideDock();
window.siyuan.layout.rightDock.hideDock();
}

const copyElement = hasTopClosestByClassName(event.target, "protyle-action__copy");
if (copyElement) {
Expand Down
5 changes: 1 addition & 4 deletions app/src/boot/globalEvent/mousemove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,7 @@ export const windowMouseMove = (event: MouseEvent & { target: HTMLElement }, mou
if (!mouseIsEnter &&
event.buttons === 0 && // 鼠标按键被按下时不触发
window.siyuan.layout.bottomDock &&
!isWindow() &&
!hasClosestByClassName(event.target, "b3-dialog", true) &&
!hasClosestByClassName(event.target, "block__popover", true) &&
!hasClosestByClassName(event.target, "b3-menu")) {
!isWindow()) {
if (event.clientX < 43) {
if (!window.siyuan.layout.leftDock.pin && window.siyuan.layout.leftDock.layout.element.clientWidth > 0 &&
// 隐藏停靠栏会导致点击两侧内容触发浮动面板弹出,因此需减小鼠标范围
Expand Down
21 changes: 21 additions & 0 deletions app/src/layout/dock/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,18 @@ export class Dock {
this.layout.element.clientHeight === 0 && this.layout.element.style.height.startsWith("0")) {
return;
}
if ((
document.querySelector(".b3-dialog") ||
document.querySelector(".block__popover") ||
document.querySelector("#commonMenu:not(.fn__none)")
) && (
window.siyuan.layout.leftDock?.layout.element.style.opacity === "1" ||
window.siyuan.layout.rightDock?.layout.element.style.opacity === "1" ||
window.siyuan.layout.bottomDock?.layout.element.style.opacity === "1"
)) {
return;
}

if (!reset) {
this.layout.element.style.opacity = "1";
}
Expand All @@ -280,6 +292,15 @@ export class Dock {
if (document.activeElement && this.layout.element.contains(document.activeElement) && document.activeElement.classList.contains("b3-text-field")) {
return;
}
const dialogElement = document.querySelector(".b3-dialog") as HTMLElement
const blockElement = document.querySelector(".block__popover") as HTMLElement
const menuElement = document.querySelector("#commonMenu:not(.fn__none)") as HTMLElement
if ((dialogElement && dialogElement.style.zIndex > this.layout.element.style.zIndex) || // 文档树上修改 emoji 时
(blockElement && blockElement.style.zIndex > this.layout.element.style.zIndex) || // 文档树上弹出悬浮层
(menuElement && menuElement.style.zIndex > this.layout.element.style.zIndex) // 面板上弹出菜单时
) {
return;
}
if (this.position === "Left") {
this.layout.element.style.transform = `translateX(-${this.layout.element.clientWidth + 8}px)`;
this.layout.element.style.left = "";
Expand Down

0 comments on commit 44d3db3

Please sign in to comment.