Skip to content

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

:art: https://github.com/siyuan-note/siyuan/issues/17092

Vanessa54c657e4a9d3
diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts
index d7a1c49865..f91efd3b88 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;
}