Fix/issue 17604 (#17627)

* 🎨 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 <javenlu233@163.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
JavenLu233
2026-05-09 16:20:53 +08:00
committed by GitHub
parent bc4978db03
commit eed0866bb2

View File

@@ -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);
}
}
}
}