This commit is contained in:
Vanessa 2024-09-03 23:29:54 +08:00 committed by Daniel
parent fe7b942225
commit 473a159ef2
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -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 ((item.nextElementSibling as HTMLElement).style.wordBreak === "break-word") {
if ((window.siyuan.config.editor.codeSyntaxHighlightLineNum && block.parentElement.getAttribute("lineNumber") !== "false" && lineNumberRender(item.parentElement);
window.siyuan.config.editor.codeLineWrap && block.parentElement.getAttribute("linewrap") !== "false") ||
(block.parentElement.getAttribute("lineNumber") === "true" && block.parentElement.getAttribute("linewrap") === "true")) {
lineNumberRender(block);
} }
}); });
// 保持光标位置不变 https://ld246.com/article/1673704873983/comment/1673765814595#comments // 保持光标位置不变 https://ld246.com/article/1673704873983/comment/1673765814595#comments