From 22a1339079e2f6c19540b227512ddfa0eec8bded Mon Sep 17 00:00:00 2001 From: Vanessa Date: Wed, 22 Nov 2023 17:14:27 +0800 Subject: [PATCH] :art: fix https://github.com/siyuan-note/siyuan/issues/9714 --- app/src/protyle/wysiwyg/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts index 70da892ff..8a8dbe76c 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);