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/14819
Vanessa03b5067b9e36
diff --git a/app/src/protyle/util/paste.ts b/app/src/protyle/util/paste.tsindex b22a11a8a6..916440d3fb 100644--- a/app/src/protyle/util/paste.ts+++ b/app/src/protyle/util/paste.ts@@ -284,7 +284,7 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven}}/// #endif-+ const originalTextHTML = textHTML;// 浏览器地址栏拷贝处理if (textHTML.replace(/&/g, "&").replace(/<(|\/)(html|body|meta)[^>]*?>/ig, "").trim() ===`<a href="${textPlain}">${textPlain}</a>` ||@@ -359,7 +359,7 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEvenprotyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--hl").forEach(item => {item.classList.remove("protyle-wysiwyg--hl");});- const code = processPasteCode(textHTML, textPlain, protyle);+ const code = processPasteCode(textHTML, textPlain, originalTextHTML, protyle);const range = getEditorRange(protyle.wysiwyg.element);if (nodeElement.getAttribute("data-type") === "NodeCodeBlock" ||protyle.toolbar.getCurrentType(range).includes("code")) {diff --git a/app/src/protyle/util/processCode.ts b/app/src/protyle/util/processCode.tsindex 1bff7e122b..e413ba1f7f 100644--- a/app/src/protyle/util/processCode.ts+++ b/app/src/protyle/util/processCode.ts@@ -9,7 +9,7 @@ import {plantumlRender} from "../render/plantumlRender";import {Constants} from "../../constants";import {htmlRender} from "../render/htmlRender";-export const processPasteCode = (html: string, text: string, protyle: IProtyle) => {+export const processPasteCode = (html: string, text: string, originalTextHTML: string, protyle: IProtyle) => {const tempElement = document.createElement("div");tempElement.innerHTML = html;let isCode = false;@@ -20,13 +20,16 @@ export const processPasteCode = (html: string, text: string, protyle: IProtyle)} else if (tempElement.childElementCount === 1 && tempElement.querySelectorAll("pre").length === 1) {// IDEisCode = true;- } else if (html.indexOf('\n<p class="p1">') === 0) {- // Xcode- isCode = true;} else if (tempElement.childElementCount === 1 && tempElement.firstElementChild.tagName === "TABLE" &&tempElement.querySelector(".line-number") && tempElement.querySelector(".line-content")) {// 网页源码isCode = true;+ } else if (originalTextHTML.indexOf('<meta name="Generator" content="Cocoa HTML Writer">') > -1 &&+ html.indexOf('\n<p class="p1">') === 0 &&+ // ChatGPT app 目前没有此标识+ originalTextHTML.indexOf('<style type="text/css">\np.p1') > -1) {+ // Xcode+ isCode = true;}if (isCode) {