Przeglądaj źródła

:art: fix https://github.com/siyuan-note/siyuan/issues/10244

Vanessa 1 rok temu
rodzic
commit
58f1cea811

+ 1 - 1
app/src/protyle/scroll/event.ts

@@ -33,7 +33,7 @@ export const scrollEvent = (protyle: IProtyle, element: HTMLElement) => {
         }
         }
 
 
         if (!window.siyuan.dragElement) { // https://ld246.com/article/1649638389841
         if (!window.siyuan.dragElement) { // https://ld246.com/article/1649638389841
-            hideElements(["gutter"], protyle);
+            hideElements(["gutterOnly"], protyle);
         }
         }
 
 
         if (protyle.scroll && !protyle.scroll.element.classList.contains("fn__none")) {
         if (protyle.scroll && !protyle.scroll.element.classList.contains("fn__none")) {

+ 5 - 0
app/src/protyle/ui/hideElements.ts

@@ -27,6 +27,11 @@ export const hideElements = (panels: string[], protyle?: IProtyle, focusHide = f
             item.classList.remove("protyle-wysiwyg--hl");
             item.classList.remove("protyle-wysiwyg--hl");
         });
         });
     }
     }
+    //  不能 remove("protyle-wysiwyg--hl") 否则打开页签的时候 "cb-get-hl" 高亮会被移除
+    if (protyle.gutter && panels.includes("gutterOnly")) {
+        protyle.gutter.element.classList.add("fn__none");
+        protyle.gutter.element.innerHTML = "";
+    }
     if (protyle.toolbar && panels.includes("toolbar")) {
     if (protyle.toolbar && panels.includes("toolbar")) {
         protyle.toolbar.element.classList.add("fn__none");
         protyle.toolbar.element.classList.add("fn__none");
         protyle.toolbar.element.style.display = "";
         protyle.toolbar.element.style.display = "";

+ 1 - 1
app/src/protyle/util/onGet.ts

@@ -57,7 +57,7 @@ export const onGet = (options: {
             return;
             return;
         }
         }
     }
     }
-    hideElements(["gutter"], options.protyle);
+    hideElements(["gutterOnly"], options.protyle);
     options.protyle.block.parentID = options.data.data.parentID;
     options.protyle.block.parentID = options.data.data.parentID;
     options.protyle.block.parent2ID = options.data.data.parent2ID;
     options.protyle.block.parent2ID = options.data.data.parent2ID;
     options.protyle.block.rootID = options.data.data.rootID;
     options.protyle.block.rootID = options.data.data.rootID;

+ 1 - 1
app/src/protyle/util/resize.ts

@@ -6,7 +6,7 @@ import {lineNumberRender} from "../render/highlightRender";
 import {stickyRow} from "../render/av/row";
 import {stickyRow} from "../render/av/row";
 
 
 export const resize = (protyle: IProtyle) => {
 export const resize = (protyle: IProtyle) => {
-    hideElements(["gutter"], protyle);
+    hideElements(["gutterOnly"], protyle)
     const abs = setPadding(protyle);
     const abs = setPadding(protyle);
     const MIN_ABS = 4;
     const MIN_ABS = 4;
     // 不能 clearTimeout,否则 split 时左侧无法 resize
     // 不能 clearTimeout,否则 split 时左侧无法 resize

+ 1 - 1
app/src/protyle/util/setEditMode.ts

@@ -34,5 +34,5 @@ export const setEditMode = (protyle: IProtyle, type: TEditorMode) => {
         /// #endif
         /// #endif
         resize(protyle);
         resize(protyle);
     }
     }
-    hideElements(["gutter", "toolbar", "select", "hint", "util"], protyle);
+    hideElements(["gutterOnly", "toolbar", "select", "hint", "util"], protyle);
 };
 };