From eed0866bb22b3834194a025356ebf1817e20000a Mon Sep 17 00:00:00 2001 From: JavenLu233 <92708008+JavenLu233@users.noreply.github.com> Date: Sat, 9 May 2026 16:20:53 +0800 Subject: [PATCH] Fix/issue 17604 (#17627) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 🎨 https://github.com/siyuan-note/siyuan/issues/17604 * Potential fix for pull request finding 更加严格的校验 Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * fix: get nearest li from precise block * fix: 修正range逻辑 * fix: 撤销对原逻辑的改动 * fix: 代码更正 --------- Co-authored-by: JavenLu233 Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- app/src/protyle/wysiwyg/index.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts index 344ac9035..f09939d6f 100644 --- a/app/src/protyle/wysiwyg/index.ts +++ b/app/src/protyle/wysiwyg/index.ts @@ -3211,9 +3211,18 @@ export class WYSIWYG { if (embedElement) { blockElement = embedElement; } - newRange = focusBlock(blockElement, undefined, event.clientX < rect.left + parseInt(this.element.style.paddingLeft)) || newRange; - if (protyle.options.render.breadcrumb) { - protyle.breadcrumb.render(protyle, false, blockElement); + + // 如果是列表块(list/li),不修正 range https://github.com/siyuan-note/siyuan/issues/17604 + if (blockElement.classList.contains("list") || blockElement.classList.contains("li")) { + if (protyle.options.render.breadcrumb) { + const breadcrumbElement = hasClosestBlock(newRange.startContainer); + protyle.breadcrumb.render(protyle, false, breadcrumbElement); + } + } else { + newRange = focusBlock(blockElement, undefined, event.clientX < rect.left + parseInt(this.element.style.paddingLeft)) || newRange; + if (protyle.options.render.breadcrumb) { + protyle.breadcrumb.render(protyle, false, blockElement); + } } } }