mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 09:30:14 +01:00
🐛 https://github.com/siyuan-note/siyuan/pull/15324 切换是否显示行号异常
This commit is contained in:
parent
69987028ae
commit
76e1a4b169
1 changed files with 2 additions and 9 deletions
|
|
@ -132,7 +132,8 @@ export const lineNumberRender = (block: HTMLElement, zoom = 1) => {
|
|||
if (lineList[lineList.length - 1] === "" && lineList.length > 1) {
|
||||
lineList.pop();
|
||||
}
|
||||
|
||||
block.firstElementChild.innerHTML = `<span>${lineList.length}</span>`;
|
||||
codeElement.style.paddingLeft = `${block.firstElementChild.clientWidth + 16}px`;
|
||||
let lineNumberHTML = "";
|
||||
if (codeElement.style.wordBreak === "break-word") {
|
||||
// 代码块开启了换行
|
||||
|
|
@ -164,14 +165,6 @@ padding-right:0;max-height: none;box-sizing: border-box;position: absolute;paddi
|
|||
}
|
||||
|
||||
block.firstElementChild.innerHTML = lineNumberHTML;
|
||||
|
||||
// 用最后一个行号元素计算宽度
|
||||
const lastLineNumberElement = block.firstElementChild.lastElementChild as HTMLElement;
|
||||
if (lastLineNumberElement) {
|
||||
lastLineNumberElement.textContent = lineList.length.toString();
|
||||
codeElement.style.paddingLeft = `${lastLineNumberElement.offsetWidth + 16}px`;
|
||||
lastLineNumberElement.textContent = "";
|
||||
}
|
||||
|
||||
// https://github.com/siyuan-note/siyuan/issues/12726
|
||||
if (block.scrollHeight > block.clientHeight) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue