Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:recycle: https://github.com/siyuan-note/siyuan/issues/16132

Vanessaa85655eae0c3
diff --git a/app/src/protyle/util/compatibility.ts b/app/src/protyle/util/compatibility.ts
index 4967647aa9..5a26a4154f 100644
--- a/app/src/protyle/util/compatibility.ts
+++ b/app/src/protyle/util/compatibility.ts
@@ -31,20 +31,13 @@ export const encodeBase64 = (text: string): string => {
};
export const getTextSiyuanFromTextHTML = (html: string) => {
- const trimmedHtml = html.trimStart();
- if (trimmedHtml.startsWith("<html")) {
- const htmlTagEnd = trimmedHtml.indexOf(">");
- if (htmlTagEnd > 0) {
- const htmlTag = trimmedHtml.substring(0, htmlTagEnd);
- // 兼容 Microsoft Excel 应用,HTML 以包含 Excel 命名空间声明的 html 元素开头(备注:从 WPS 复制也有这个命名空间)
- if (htmlTag.includes('xmlns:x="urn:schemas-microsoft-com:office:excel"')) {
- // 粘贴表格不需要解析 textSiyuan https://ld246.com/article/1763027417781/comment/1763032527460#comments
- return {
- textSiyuan: "",
- textHtml: html.replace(/<!--data-siyuan='[^']+'-->/g, "")
- };
- }
- }
+ if (html.trimStart().startsWith("<html") &&
+ html.substring(0, html.indexOf(">")).includes('xmlns:x="urn:schemas-microsoft-com:office:excel"')) {
+ // 移除 Microsoft Excel 中的 data-siyuan https://github.com/siyuan-note/siyuan/pull/16338
+ return {
+ textSiyuan: "",
+ textHtml: html.replace(/<!--data-siyuan='[^']+'-->/g, "")
+ };
}
const siyuanMatch = html.match(/<!--data-siyuan='([^']+)'-->/);
let textSiyuan = "";