Browse Source

:art: https://github.com/siyuan-note/siyuan/issues/12141

Vanessa 10 months ago
parent
commit
49d6f297a1

+ 0 - 3
app/src/block/Panel.ts

@@ -183,9 +183,6 @@ export class BlockPanel {
                 },
                 },
                 typewriterMode: false,
                 typewriterMode: false,
                 after: (editor) => {
                 after: (editor) => {
-                    editorElement.addEventListener("mouseleave", () => {
-                        hideElements(["gutter"], editor.protyle);
-                    });
                     if (response.data.rootID !== this.nodeIds[index]) {
                     if (response.data.rootID !== this.nodeIds[index]) {
                         editor.protyle.breadcrumb.element.parentElement.lastElementChild.classList.remove("fn__none");
                         editor.protyle.breadcrumb.element.parentElement.lastElementChild.classList.remove("fn__none");
                     }
                     }

+ 12 - 0
app/src/boot/globalEvent/mousemove.ts

@@ -35,6 +35,7 @@ export const windowMouseMove = (event: MouseEvent & { target: HTMLElement }, mou
     coordinates.screenX = event.screenX;
     coordinates.screenX = event.screenX;
     coordinates.screenY = event.screenY;
     coordinates.screenY = event.screenY;
 
 
+    // breadcrumb
     if (window.siyuan.hideBreadcrumb) {
     if (window.siyuan.hideBreadcrumb) {
         window.siyuan.hideBreadcrumb = false;
         window.siyuan.hideBreadcrumb = false;
         getAllEditor().forEach(item => {
         getAllEditor().forEach(item => {
@@ -44,6 +45,8 @@ export const windowMouseMove = (event: MouseEvent & { target: HTMLElement }, mou
             }
             }
         });
         });
     }
     }
+
+    // Dock
     if (!mouseIsEnter &&
     if (!mouseIsEnter &&
         event.buttons === 0 &&  // 鼠标按键被按下时不触发
         event.buttons === 0 &&  // 鼠标按键被按下时不触发
         window.siyuan.layout.bottomDock &&
         window.siyuan.layout.bottomDock &&
@@ -79,6 +82,8 @@ export const windowMouseMove = (event: MouseEvent & { target: HTMLElement }, mou
             window.siyuan.layout.bottomDock.showDock();
             window.siyuan.layout.bottomDock.showDock();
         }
         }
     }
     }
+
+    // gutter
     const eventPath0 = event.composedPath()[0] as HTMLElement;
     const eventPath0 = event.composedPath()[0] as HTMLElement;
     if (eventPath0 && eventPath0.nodeType !== 3 && eventPath0.classList.contains("protyle-wysiwyg") && eventPath0.style.paddingLeft) {
     if (eventPath0 && eventPath0.nodeType !== 3 && eventPath0.classList.contains("protyle-wysiwyg") && eventPath0.style.paddingLeft) {
         // 光标在编辑器右边也需要进行显示
         // 光标在编辑器右边也需要进行显示
@@ -179,6 +184,13 @@ export const windowMouseMove = (event: MouseEvent & { target: HTMLElement }, mou
         return;
         return;
     }
     }
 
 
+    if (!hasClosestByClassName(event.target, "protyle", true)) {
+        document.querySelectorAll(".protyle-gutters").forEach(item => {
+            item.classList.add("fn__none");
+            item.innerHTML = "";
+        });
+    }
+
     const target = event.target as Element;
     const target = event.target as Element;
     const blockElement = hasClosestByClassName(target, "table");
     const blockElement = hasClosestByClassName(target, "table");
     if (blockElement && blockElement.style.cursor !== "col-resize" && !hasClosestByClassName(blockElement, "protyle-wysiwyg__embed")) {
     if (blockElement && blockElement.style.cursor !== "col-resize" && !hasClosestByClassName(blockElement, "protyle-wysiwyg__embed")) {

+ 1 - 1
app/src/protyle/ui/hideElements.ts

@@ -4,7 +4,7 @@ import {getCurrentEditor} from "../../mobile/editor";
 import {getAllEditor} from "../../layout/getAll";
 import {getAllEditor} from "../../layout/getAll";
 /// #endif
 /// #endif
 
 
-// "gutter", "toolbar", "select", "hint", "util", "dialog"
+// "gutter", "toolbar", "select", "hint", "util", "dialog", "gutterOnly"
 export const hideElements = (panels: string[], protyle?: IProtyle, focusHide = false) => {
 export const hideElements = (panels: string[], protyle?: IProtyle, focusHide = false) => {
     if (!protyle) {
     if (!protyle) {
         if (panels.includes("dialog")) {
         if (panels.includes("dialog")) {