An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: https://github.com/siyuan-note/siyuan/issues/5735 copy
Vanessa955bc042e63b
diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.tsindex ac3b5a337b..a91882cafb 100644--- a/app/src/protyle/wysiwyg/index.ts+++ b/app/src/protyle/wysiwyg/index.ts@@ -78,6 +78,7 @@ export class WYSIWYG {if (window.siyuan.config.editor.displayBookmarkIcon) {this.element.classList.add("protyle-wysiwyg--attr");}+ this.bindCopyEvent(protyle);if (protyle.options.action.includes(Constants.CB_GET_HISTORY)) {return;}@@ -180,20 +181,7 @@ export class WYSIWYG {/// #endif}- 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);- }- });-+ private bindCopyEvent (protyle: IProtyle) {this.element.addEventListener("copy", (event: ClipboardEvent & { target: HTMLElement }) => {// https://github.com/siyuan-note/siyuan/issues/4600if (event.target.tagName === "PROTYLE-HTML") {@@ -267,6 +255,21 @@ export class WYSIWYG {event.clipboardData.setData("text/plain", textPlain || protyle.lute.BlockDOM2StdMd(html).trimEnd());event.clipboardData.setData("text/html", html + Constants.ZWSP);});+ }++ 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);+ }+ });this.element.addEventListener("cut", (event: ClipboardEvent & { target: HTMLElement }) => {if (event.target.tagName === "PROTYLE-HTML") {