mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 00:50:13 +01:00
This commit is contained in:
parent
f1e875698a
commit
55bb5e4348
2 changed files with 4 additions and 3 deletions
|
|
@ -93,8 +93,9 @@ export const highlightRender = (element: Element, cdn = Constants.PROTYLE_CDN) =
|
|||
block.classList.add("protyle-linenumber");
|
||||
setTimeout(() => {
|
||||
// windows 需等待字体下载完成再计算,否则导致不换行,高度计算错误
|
||||
// https://github.com/siyuan-note/siyuan/issues/9029
|
||||
lineNumberRender(block);
|
||||
}, 20);
|
||||
}, Constants.TIMEOUT_DBLCLICK);
|
||||
if (languageElement) {
|
||||
languageElement.style.marginLeft = "3.6em";
|
||||
}
|
||||
|
|
@ -151,7 +152,7 @@ export const lineNumberRender = (block: HTMLElement) => {
|
|||
let lineHeight = "";
|
||||
if (isWrap) {
|
||||
lineNumberTemp.textContent = line || "\n";
|
||||
const height = lineNumberTemp.getBoundingClientRect().height;
|
||||
const height = lineNumberTemp.getBoundingClientRect().height.toFixed(1);
|
||||
lineHeight = ` style="height:${height}px;"`;
|
||||
}
|
||||
lineNumberHTML += `<span${lineHeight}></span>`;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue