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: fix https://github.com/siyuan-note/siyuan/issues/5661
Vanessafa6f57dc976a
diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.tsindex 961768d5b3..3992bf8167 100644--- a/app/src/menus/protyle.ts+++ b/app/src/menus/protyle.ts@@ -251,6 +251,30 @@ export const contentMenu = (protyle: IProtyle, nodeElement: Element) => {document.execCommand("copy");}}).element);+ window.siyuan.menus.menu.append(new MenuItem({+ label: window.siyuan.languages.copyPlainText,+ click() {+ focusByRange(getEditorRange(nodeElement));+ writeText(range.toString())+ }+ }).element);+ window.siyuan.menus.menu.append(new MenuItem({+ label: window.siyuan.languages.copy +" HTML",+ click() {+ focusByRange(getEditorRange(nodeElement));+ let html = ''+ range.cloneContents().childNodes.forEach(item => {+ if (item.nodeType === 3) {+ html += item.textContent+ } else {+ html += (item as Element).outerHTML+ }+ })+ const tempElement = document.createElement('template')+ tempElement.innerHTML = protyle.lute.BlockDOM2HTML(html)+ writeText(tempElement.content.firstElementChild.innerHTML);+ }+ }).element);window.siyuan.menus.menu.append(new MenuItem({icon: "iconCut",accelerator: "⌘X",diff --git a/app/src/protyle/gutter/index.ts b/app/src/protyle/gutter/index.tsindex bac321287f..a700ada4ac 100644--- a/app/src/protyle/gutter/index.ts+++ b/app/src/protyle/gutter/index.ts@@ -485,6 +485,29 @@ export class Gutter {}}}).element);+ window.siyuan.menus.menu.append(new MenuItem({+ label: window.siyuan.languages.copyPlainText,+ click() {+ let html = "";+ selectsElement.forEach(item => {+ const editElement = getContenteditableElement(item);+ if (editElement) {+ html += editElement.textContent + "\n";+ }+ });+ writeText(html.trimEnd());+ }+ }).element);+ window.siyuan.menus.menu.append(new MenuItem({+ label: window.siyuan.languages.copy + " HTML",+ click() {+ let html = "";+ selectsElement.forEach(item => {+ html += item.outerHTML+ });+ writeText(protyle.lute.BlockDOM2HTML(html));+ }+ }).element);if (window.siyuan.config.readonly) {return;}@@ -826,6 +849,19 @@ export class Gutter {document.execCommand("copy");}}+ }, {+ label: window.siyuan.languages.copyPlainText,+ click() {+ const editElement = getContenteditableElement(nodeElement);+ if (editElement) {+ writeText(editElement.textContent);+ }+ }+ }, {+ label: window.siyuan.languages.copy + " HTML",+ click() {+ writeText(protyle.lute.BlockDOM2HTML(nodeElement.outerHTML));+ }}, {label: window.siyuan.languages.duplicate,disabled: window.siyuan.config.readonly,diff --git a/app/src/types/protyle.d.ts b/app/src/types/protyle.d.tsindex f98ea6a306..15b0a102d8 100644--- a/app/src/types/protyle.d.ts+++ b/app/src/types/protyle.d.ts@@ -206,6 +206,8 @@ declare class Lute {public IsValidLinkDest(text: string): boolean;public BlockDOM2InlineBlockDOM(html: string): string;++ public BlockDOM2HTML(html: string): string;}declare const webkitAudioContext: {