Skip to content

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

:art: https://github.com/siyuan-note/siyuan/issues/15797

Vanessa690dcb5899aa
diff --git a/app/src/protyle/gutter/index.ts b/app/src/protyle/gutter/index.ts
index 91d10ab3d0..30f55fd2a4 100644
--- a/app/src/protyle/gutter/index.ts
+++ b/app/src/protyle/gutter/index.ts
@@ -1682,7 +1682,10 @@ export class Gutter {
icon: "iconCopy",
label: `${window.siyuan.languages.copy} ${window.siyuan.languages.headings1}`,
click() {
- fetchPost("/api/block/getHeadingChildrenDOM", {id, removeFoldAttr: false}, (response) => {
+ fetchPost("/api/block/getHeadingChildrenDOM", {
+ id,
+ removeFoldAttr: nodeElement.getAttribute("fold") !== "1"
+ }, (response) => {
if (isInAndroid()) {
window.JSAndroid.writeHTMLClipboard(protyle.lute.BlockDOM2StdMd(response.data).trimEnd(), response.data + Constants.ZWSP);
} else if (isInHarmony()) {
@@ -1698,7 +1701,10 @@ export class Gutter {
icon: "iconCut",
label: `${window.siyuan.languages.cut} ${window.siyuan.languages.headings1}`,
click() {
- fetchPost("/api/block/getHeadingChildrenDOM", {id, removeFoldAttr: false}, (response) => {
+ fetchPost("/api/block/getHeadingChildrenDOM", {
+ id,
+ removeFoldAttr: nodeElement.getAttribute("fold") !== "1"
+ }, (response) => {
if (isInAndroid()) {
window.JSAndroid.writeHTMLClipboard(protyle.lute.BlockDOM2StdMd(response.data).trimEnd(), response.data + Constants.ZWSP);
} else if (isInHarmony()) {
diff --git a/app/src/protyle/util/insertHTML.ts b/app/src/protyle/util/insertHTML.ts
index f907a1fbfb..2b92d73601 100644
--- a/app/src/protyle/util/insertHTML.ts
+++ b/app/src/protyle/util/insertHTML.ts
@@ -450,26 +450,6 @@ export const insertHTML = (html: string, protyle: IProtyle, isBlock = false,
if (tempElement.content.firstChild.nodeType === 3 || (tempElement.content.firstChild.nodeType === 1 && tempElement.content.firstElementChild.tagName !== "DIV")) {
tempElement.innerHTML = protyle.lute.SpinBlockDOM(tempElement.innerHTML);
}
- // let foldHeadingId = "";
- // let foldHTML = "";
- // 粘贴内容中包含折叠的子节点需后端插入到原节点中
- // Array.from(tempElement.content.children).forEach((item) => {
- // if (!item.getAttribute("parent-heading") && foldHeadingId && foldHTML) {
- // fetchPost("/api/block/appendHeadingChildren", {id: foldHeadingId, dom: foldHTML});
- // foldHeadingId = "";
- // foldHTML = "";
- // }
- // if (item.getAttribute("data-type") === "NodeHeading" && item.getAttribute("fold") === "1") {
- // foldHeadingId = item.getAttribute("data-node-id");
- // return true;
- // }
- // if (foldHeadingId && item.getAttribute("parent-heading")) {
- // foldHTML += item.outerHTML;
- // }
- // });
- // if (foldHeadingId && foldHTML) {
- // fetchPost("/api/block/appendHeadingChildren", {id: foldHeadingId, dom: foldHTML});
- // }
(insertBefore ? Array.from(tempElement.content.children) : Array.from(tempElement.content.children).reverse()).find((item) => {
let addId = item.getAttribute("data-node-id");
const hasParentHeading = item.getAttribute("parent-heading");