mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 17:10:12 +01:00
This commit is contained in:
parent
736fdb2d7e
commit
1ee7848f93
1 changed files with 2 additions and 1 deletions
|
|
@ -138,8 +138,9 @@ export const lineNumberRender = (block: HTMLElement) => {
|
||||||
|
|
||||||
const lineNumberTemp = document.createElement("div");
|
const lineNumberTemp = document.createElement("div");
|
||||||
lineNumberTemp.className = "hljs";
|
lineNumberTemp.className = "hljs";
|
||||||
|
// 不能使用 codeElement.clientWidth,被忽略小数点导致宽度不一致
|
||||||
lineNumberTemp.setAttribute("style", `padding-left:${codeElement.style.paddingLeft};
|
lineNumberTemp.setAttribute("style", `padding-left:${codeElement.style.paddingLeft};
|
||||||
width: ${codeElement.clientWidth}px;
|
width: ${codeElement.getBoundingClientRect().width}px;
|
||||||
white-space:${codeElement.style.whiteSpace};
|
white-space:${codeElement.style.whiteSpace};
|
||||||
word-break:${codeElement.style.wordBreak};
|
word-break:${codeElement.style.wordBreak};
|
||||||
font-variant-ligatures:${codeElement.style.fontVariantLigatures};
|
font-variant-ligatures:${codeElement.style.fontVariantLigatures};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue