Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: fix https://github.com/siyuan-note/siyuan/issues/9714

Vanessa22a1339079e2
diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts
index 70da892ffe..8a8dbe76c0 100644
--- a/app/src/protyle/wysiwyg/index.ts
+++ b/app/src/protyle/wysiwyg/index.ts
@@ -1030,9 +1030,10 @@ export class WYSIWYG {
let endBlockElement: false | HTMLElement;
if (mouseUpEvent.detail === 3 && range.endContainer.nodeType !== 3 && (range.endContainer as HTMLElement).tagName === "DIV" && range.endOffset === 0) {
// 三击选中段落块时,rangeEnd 会在下一个块
- if ((range.endContainer as HTMLElement).classList.contains("protyle-attr")) {
+ if ((range.endContainer as HTMLElement).classList.contains("protyle-attr") && startBlockElement) {
// 三击在悬浮层中会选择到 attr https://github.com/siyuan-note/siyuan/issues/4636
- setLastNodeRange((range.endContainer as HTMLElement).previousElementSibling, range, false);
+ // 需要获取可编辑元素,使用 previousElementSibling 的话会 https://github.com/siyuan-note/siyuan/issues/9714
+ setLastNodeRange(getContenteditableElement(startBlockElement), range, false);
}
} else {
endBlockElement = hasClosestBlock(range.endContainer);