Skip to content

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

:art: fix https://github.com/siyuan-note/siyuan/issues/7574

Vanessa184949dd6958
diff --git a/app/src/block/util.ts b/app/src/block/util.ts
index 67e750df15..52511dab0d 100644
--- a/app/src/block/util.ts
+++ b/app/src/block/util.ts
@@ -6,6 +6,7 @@ import {transaction, updateTransaction} from "../protyle/wysiwyg/transaction";
import {scrollCenter} from "../util/highlightById";
import {Constants} from "../constants";
import {hideElements} from "../protyle/ui/hideElements";
+import {blockRender} from "../protyle/markdown/blockRender";
export const cancelSB = (protyle: IProtyle, nodeElement: Element) => {
const doOperations: IOperation[] = [];
@@ -48,7 +49,14 @@ export const cancelSB = (protyle: IProtyle, nodeElement: Element) => {
});
previousId = item.getAttribute("data-node-id");
});
-
+ // 超级块内嵌入块无面包屑,需重新渲染 https://github.com/siyuan-note/siyuan/issues/7574
+ doOperations.forEach(item => {
+ const element = protyle.wysiwyg.element.querySelector(`[data-node-id="${item.id}"]`);
+ if (element && element.getAttribute("data-type") === "NodeBlockQueryEmbed") {
+ element.removeAttribute("data-render")
+ blockRender(protyle, element)
+ }
+ })
return {
doOperations, undoOperations, previousId
};
diff --git a/app/src/protyle/util/editorCommonEvent.ts b/app/src/protyle/util/editorCommonEvent.ts
index 1a6f4b0721..b6f6257321 100644
--- a/app/src/protyle/util/editorCommonEvent.ts
+++ b/app/src/protyle/util/editorCommonEvent.ts
@@ -822,6 +822,17 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
dragSame(protyle, sourceElements, targetElement, targetClass.includes("dragover__bottom"), event.ctrlKey);
}
}
+ // 超级块内嵌入块无面包屑,需重新渲染 https://github.com/siyuan-note/siyuan/issues/7574
+ sourceElements.forEach(item => {
+ if (item.getAttribute("data-type") === "NodeBlockQueryEmbed") {
+ item.removeAttribute("data-render")
+ blockRender(protyle, item)
+ }
+ })
+ if (targetElement.getAttribute("data-type") === "NodeBlockQueryEmbed") {
+ targetElement.removeAttribute("data-render")
+ blockRender(protyle, targetElement)
+ }
}
} else if (event.dataTransfer.getData(Constants.SIYUAN_DROP_FILE)?.split("-").length > 1
&& targetElement && !protyle.options.backlinkData) {
diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.ts
index 208fec0c37..63b3738766 100644
--- a/app/src/protyle/wysiwyg/transaction.ts
+++ b/app/src/protyle/wysiwyg/transaction.ts
@@ -728,6 +728,11 @@ export const turnsIntoOneTransaction = (options: {
id,
});
}
+ // 超级块内嵌入块无面包屑,需重新渲染 https://github.com/siyuan-note/siyuan/issues/7574
+ if (item.getAttribute("data-type") === "NodeBlockQueryEmbed") {
+ item.removeAttribute("data-render")
+ blockRender(options.protyle, item)
+ }
});
transaction(options.protyle, doOperations, undoOperations);
focusBlock(options.protyle.wysiwyg.element.querySelector(`[data-node-id="${options.selectsElement[0].getAttribute("data-node-id")}"]`));