This commit is contained in:
Vanessa 2023-08-24 11:57:00 +08:00
parent f1e875698a
commit 55bb5e4348
2 changed files with 4 additions and 3 deletions

View File

@ -27,7 +27,7 @@
<div id="progress" <div id="progress"
style="position: absolute;height: 1px;background-color: #d23f31;transition: width 50ms cubic-bezier(0, 0, 0.2, 1);top:0"></div> style="position: absolute;height: 1px;background-color: #d23f31;transition: width 50ms cubic-bezier(0, 0, 0.2, 1);top:0"></div>
<div id="details" <div id="details"
style="color: #9aa0a6;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;padding: 8px;"></div> style="color: #9aa0a6;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;padding: 8px;line-height: 1.25"></div>
</div> </div>
<script> <script>
const sleep = (ms) => { const sleep = (ms) => {

View File

@ -93,8 +93,9 @@ export const highlightRender = (element: Element, cdn = Constants.PROTYLE_CDN) =
block.classList.add("protyle-linenumber"); block.classList.add("protyle-linenumber");
setTimeout(() => { setTimeout(() => {
// windows 需等待字体下载完成再计算,否则导致不换行,高度计算错误 // windows 需等待字体下载完成再计算,否则导致不换行,高度计算错误
// https://github.com/siyuan-note/siyuan/issues/9029
lineNumberRender(block); lineNumberRender(block);
}, 20); }, Constants.TIMEOUT_DBLCLICK);
if (languageElement) { if (languageElement) {
languageElement.style.marginLeft = "3.6em"; languageElement.style.marginLeft = "3.6em";
} }
@ -151,7 +152,7 @@ export const lineNumberRender = (block: HTMLElement) => {
let lineHeight = ""; let lineHeight = "";
if (isWrap) { if (isWrap) {
lineNumberTemp.textContent = line || "\n"; lineNumberTemp.textContent = line || "\n";
const height = lineNumberTemp.getBoundingClientRect().height; const height = lineNumberTemp.getBoundingClientRect().height.toFixed(1);
lineHeight = ` style="height:${height}px;"`; lineHeight = ` style="height:${height}px;"`;
} }
lineNumberHTML += `<span${lineHeight}></span>`; lineNumberHTML += `<span${lineHeight}></span>`;