An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: fix https://github.com/siyuan-note/siyuan/issues/8731
Vanessaf8aafb439a26
diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.tsindex 100c6372fb..37c6ff2e3f 100644--- a/app/src/protyle/wysiwyg/index.ts+++ b/app/src/protyle/wysiwyg/index.ts@@ -1016,15 +1016,12 @@ export class WYSIWYG {private bindEvent(protyle: IProtyle) {this.element.addEventListener("focusout", () => {- if (getSelection().rangeCount > 0 && !this.element.contains(getSelection().getRangeAt(0).startContainer)) {- // 对 ctrl+tab 切换后 range 已经在新页面中才会触发的 focusout 进行忽略,因为在切换之前已经 dispatchEvent 了。- if (!protyle.toolbar.range) {- protyle.toolbar.range = this.element.ownerDocument.createRange();- protyle.toolbar.range.setStart(getContenteditableElement(this.element) || this.element, 0);- protyle.toolbar.range.collapse(true);- }- } else {- protyle.toolbar.range = getEditorRange(this.element);+ if (getSelection().rangeCount === 0) {+ return;+ }+ const range = getSelection().getRangeAt(0);+ if (this.element.isSameNode(range.startContainer) || this.element.contains(range.startContainer)) {+ protyle.toolbar.range = range;}});