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/8019
Vanessac3269893918f
diff --git a/app/src/protyle/util/insertHTML.ts b/app/src/protyle/util/insertHTML.tsindex f004ac63b8..f907a1fbfb 100644--- a/app/src/protyle/util/insertHTML.ts+++ b/app/src/protyle/util/insertHTML.ts@@ -450,31 +450,29 @@ 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 = "";+ // 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});- }+ // 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) => {- if (item.getAttribute("parent-heading")) {- return;- }let addId = item.getAttribute("data-node-id");+ const hasParentHeading = item.getAttribute("parent-heading");if (addId === id) {doOperation.push({action: "update",@@ -499,10 +497,12 @@ export const insertHTML = (html: string, protyle: IProtyle, isBlock = false,liElement.append(item);item = liElement;}+ item.removeAttribute("parent-heading");doOperation.push({action: "insert",data: item.outerHTML,id: addId,+ context: {ignoreProcess: hasParentHeading ? "true" : "false"},nextID: insertBefore ? id : undefined,previousID: insertBefore ? undefined : id});@@ -511,10 +511,12 @@ export const insertHTML = (html: string, protyle: IProtyle, isBlock = false,id: addId,});}- if (insertBefore) {- blockElement.before(item);- } else {- blockElement.after(item);+ if (!hasParentHeading) {+ if (insertBefore) {+ blockElement.before(item);+ } else {+ blockElement.after(item);+ }}if (!lastElement) {lastElement = item;diff --git a/app/src/protyle/wysiwyg/remove.ts b/app/src/protyle/wysiwyg/remove.tsindex c4a91db520..7725a99e8e 100644--- a/app/src/protyle/wysiwyg/remove.ts+++ b/app/src/protyle/wysiwyg/remove.ts@@ -108,7 +108,7 @@ export const removeBlock = async (protyle: IProtyle, blockElement: Element, rang} else {foldPreviousId = "";}- // // https://github.com/siyuan-note/siyuan/issues/4422+ // https://github.com/siyuan-note/siyuan/issues/4422topElement.firstElementChild.removeAttribute("contenteditable");topElement.remove();} else {