Vanessa 10 months ago
parent
commit
473a159ef2
1 changed files with 2 additions and 5 deletions
  1. 2 5
      app/src/protyle/util/resize.ts

+ 2 - 5
app/src/protyle/util/resize.ts

@@ -29,11 +29,8 @@ export const resize = (protyle: IProtyle) => {
                 });
                 });
             }
             }
             protyle.wysiwyg.element.querySelectorAll(".code-block .protyle-linenumber__rows").forEach((item: HTMLElement) => {
             protyle.wysiwyg.element.querySelectorAll(".code-block .protyle-linenumber__rows").forEach((item: HTMLElement) => {
-                const block = item.parentElement;
-                if ((window.siyuan.config.editor.codeSyntaxHighlightLineNum && block.parentElement.getAttribute("lineNumber") !== "false" &&
-                        window.siyuan.config.editor.codeLineWrap && block.parentElement.getAttribute("linewrap") !== "false") ||
-                    (block.parentElement.getAttribute("lineNumber") === "true" && block.parentElement.getAttribute("linewrap") === "true")) {
-                    lineNumberRender(block);
+                if ((item.nextElementSibling as HTMLElement).style.wordBreak === "break-word") {
+                    lineNumberRender(item.parentElement);
                 }
                 }
             });
             });
             // 保持光标位置不变 https://ld246.com/article/1673704873983/comment/1673765814595#comments
             // 保持光标位置不变 https://ld246.com/article/1673704873983/comment/1673765814595#comments