From 54c657e4a9d388e36c7e66422cebfeeb1af7c9ba Mon Sep 17 00:00:00 2001 From: Vanessa Date: Tue, 24 Feb 2026 09:51:03 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/17092 --- app/src/protyle/wysiwyg/index.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts index d7a1c4986..f91efd3b8 100644 --- a/app/src/protyle/wysiwyg/index.ts +++ b/app/src/protyle/wysiwyg/index.ts @@ -1751,11 +1751,10 @@ export class WYSIWYG { } if (selectElement.length > 0) { range.collapse(true); - if (range.commonAncestorContainer.nodeType === 1 && - range.startContainer.childNodes[range.startOffset] && - range.startContainer.childNodes[range.startOffset].nodeType === 1 && - (range.commonAncestorContainer as HTMLElement).classList.contains("protyle-wysiwyg")) { - focusBlock(range.startContainer.childNodes[range.startOffset] as Element); + // https://github.com/siyuan-note/siyuan/issues/17092 & https://github.com/siyuan-note/siyuan/issues/15296 + const endElement = hasClosestBlock(mouseUpEvent.target as HTMLElement); + if (endElement && document.activeElement.classList.contains("protyle-wysiwyg")) { + focusBlock(endElement); } return; }