From 3595312920f56c3476abc6d1f62cfa3d6a1f9c01 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Tue, 1 Jul 2025 21:42:20 +0800 Subject: [PATCH] :recycle: https://github.com/siyuan-note/siyuan/pull/15138 --- app/src/protyle/preview/index.ts | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/app/src/protyle/preview/index.ts b/app/src/protyle/preview/index.ts index c3c119649..013fd3bb1 100644 --- a/app/src/protyle/preview/index.ts +++ b/app/src/protyle/preview/index.ts @@ -235,22 +235,18 @@ export class Preview { }); }); // 处理任务列表(微信公众号不能显示input[type="checkbox"]) - copyElement.querySelectorAll('li.protyle-task').forEach(taskItem => { - // Set checkbox input opacity to 0 - const checkbox = taskItem.querySelector('input[type="checkbox"]'); + copyElement.querySelectorAll("li.protyle-task").forEach((taskItem: HTMLElement) => { + const checkbox = taskItem.querySelector('input[type="checkbox"]') as HTMLInputElement; if (checkbox) { - checkbox.style.opacity = '0'; - } - - const isDone = taskItem.classList.contains('protyle-task--done'); - if (isDone) { - taskItem.style.setProperty('list-style-type', "'✅'", 'important'); - } - else { - taskItem.style.setProperty('list-style-type', "'▢'", 'important'); + checkbox.style.opacity = "0"; + if (checkbox.checked) { + taskItem.style.setProperty("list-style-type", "'✅'", "important"); + } else { + taskItem.style.setProperty("list-style-type", "'▢'", "important"); + } } }); - if(typeof window.MathJax === "undefined") { + if (typeof window.MathJax === "undefined") { window.MathJax = { svg: { fontCache: "none" @@ -262,7 +258,7 @@ export class Preview { copyElement.querySelectorAll('[data-subtype="math"]').forEach(mathElement => { const node = window.MathJax.tex2svg(Lute.UnEscapeHTMLStr(mathElement.getAttribute("data-content")).trim(), {display: mathElement.tagName === "DIV"}); node.querySelector("mjx-assistive-mml").remove(); - mathElement.innerHTML= node.outerHTML; + mathElement.innerHTML = node.outerHTML; }); } else if (type === "zhihu") { this.link2online(copyElement);