From 8b1a2d49d7d6b64b8680ab4b872663e5ed7594fb Mon Sep 17 00:00:00 2001 From: Tron Date: Tue, 1 Jul 2025 21:36:35 +0800 Subject: [PATCH] Update index.ts (#15138) --- app/src/protyle/preview/index.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/src/protyle/preview/index.ts b/app/src/protyle/preview/index.ts index 2f1d5f2e9..c3c119649 100644 --- a/app/src/protyle/preview/index.ts +++ b/app/src/protyle/preview/index.ts @@ -234,6 +234,22 @@ 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"]'); + 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'); + } + }); if(typeof window.MathJax === "undefined") { window.MathJax = { svg: {