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/14144
Vanessa8218184ece77
diff --git a/app/src/protyle/util/paste.ts b/app/src/protyle/util/paste.tsindex 19c825a103..532248ab0e 100644--- a/app/src/protyle/util/paste.ts+++ b/app/src/protyle/util/paste.ts@@ -82,7 +82,15 @@ export const getPlainText = (blockElement: HTMLElement, isNested = false) => {} else if (blockElement.classList.contains("render-node")) {// 需在嵌入块后,代码块前text += Lute.UnEscapeHTMLStr(blockElement.getAttribute("data-content"));- } else if (["NodeHeading", "NodeParagraph", "NodeCodeBlock", "NodeTable"].includes(dataType)) {+ } else if (["NodeHeading", "NodeParagraph", "NodeCodeBlock"].includes(dataType)) {+ text += blockElement.querySelector("[spellcheck]").textContent;+ } else if (dataType ==="NodeTable") {+ blockElement.querySelectorAll("th, td").forEach((item) => {+ text += item.textContent.trim() + "\t";+ if (!item.nextElementSibling) {+ text = text.slice(0, -1) + "\n";+ }+ });text += blockElement.querySelector("[spellcheck]").textContent;} else if (!isNested && ["NodeBlockquote", "NodeList", "NodeSuperBlock", "NodeListItem"].includes(dataType)) {blockElement.querySelectorAll("[data-node-id]").forEach((item: HTMLElement) => {diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.tsindex 3208e276e8..b7b7d02a05 100644--- a/app/src/protyle/wysiwyg/index.ts+++ b/app/src/protyle/wysiwyg/index.ts@@ -63,7 +63,7 @@ import {openGlobalSearch} from "../../search/util";import {popSearch} from "../../mobile/menu/search";/// #endifimport {BlockPanel} from "../../block/Panel";-import {isInIOS, isMac, isOnlyMeta, readClipboard} from "../util/compatibility";+import {copyPlainText, isInIOS, isMac, isOnlyMeta, readClipboard} from "../util/compatibility";import {MenuItem} from "../../menus/Menu";import {fetchPost} from "../../util/fetch";import {onGet} from "../util/onGet";@@ -1295,6 +1295,34 @@ export class WYSIWYG {}).element);window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);}+ window.siyuan.menus.menu.append(new MenuItem({+ id: "copyPlainText",+ label: window.siyuan.languages.copyPlainText,+ click() {+ if (tableBlockElement) {+ const selectCellElements: HTMLTableCellElement[] = [];+ const scrollLeft = tableBlockElement.firstElementChild.scrollLeft;+ const tableSelectElement = tableBlockElement.querySelector(".table__select") as HTMLElement;+ tableBlockElement.querySelectorAll("th, td").forEach((item: HTMLTableCellElement) => {+ if (!item.classList.contains("fn__none") &&+ item.offsetLeft + 6 > tableSelectElement.offsetLeft + scrollLeft && item.offsetLeft + item.clientWidth - 6 < tableSelectElement.offsetLeft + scrollLeft + tableSelectElement.clientWidth &&+ item.offsetTop + 6 > tableSelectElement.offsetTop && item.offsetTop + item.clientHeight - 6 < tableSelectElement.offsetTop + tableSelectElement.clientHeight) {+ selectCellElements.push(item);+ }+ });+ let textPlain = "";+ selectCellElements.forEach((item, index) => {+ textPlain += item.textContent.trim() + "\t";+ if (!item.nextElementSibling || !selectCellElements[index + 1] ||+ !item.nextElementSibling.isSameNode(selectCellElements[index + 1])) {+ textPlain = textPlain.slice(0, -1) + "\n";+ }+ });+ copyPlainText(textPlain);+ focusBlock(tableBlockElement);+ }+ }+ }).element);window.siyuan.menus.menu.append(new MenuItem({icon: "iconCopy",accelerator: "⌘C",