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/8568

Vanessaecfa676bc775
diff --git a/app/src/protyle/render/flowchartRender.ts b/app/src/protyle/render/flowchartRender.ts
index 6d836f6a8d..9901727b9d 100644
--- a/app/src/protyle/render/flowchartRender.ts
+++ b/app/src/protyle/render/flowchartRender.ts
@@ -39,13 +39,16 @@ const initFlowchart = (flowchartElements: Element[]) => {
if (item.getAttribute("data-render") === "true") {
return;
}
- if (!item.firstElementChild.classList.contains("protyle-icons")) {
- item.insertAdjacentHTML("afterbegin", '<div class="protyle-icons"><span class="protyle-icon protyle-icon--first protyle-action__edit"><svg><use xlink:href="#iconEdit"></use></svg></span><span class="protyle-icon protyle-action__menu protyle-icon--last"><svg><use xlink:href="#iconMore"></use></svg></span></div>');
- }
- if (item.childElementCount < 4) {
- item.lastElementChild.insertAdjacentHTML("beforebegin", `<span style="position: absolute">${Constants.ZWSP}</span>`);
+ // preview 不需要进行设置
+ if (item.getAttribute("data-node-id")) {
+ if (!item.firstElementChild.classList.contains("protyle-icons")) {
+ item.insertAdjacentHTML("afterbegin", '<div class="protyle-icons"><span class="protyle-icon protyle-icon--first protyle-action__edit"><svg><use xlink:href="#iconEdit"></use></svg></span><span class="protyle-icon protyle-action__menu protyle-icon--last"><svg><use xlink:href="#iconMore"></use></svg></span></div>');
+ }
+ if (item.childElementCount < 4) {
+ item.lastElementChild.insertAdjacentHTML("beforebegin", `<span style="position: absolute">${Constants.ZWSP}</span>`);
+ }
}
- const renderElement = item.firstElementChild.nextElementSibling as HTMLElement;
+ const renderElement = (item.firstElementChild.nextElementSibling || item.firstElementChild) as HTMLElement;
const flowchartObj = flowchart.parse(Lute.UnEscapeHTMLStr(item.getAttribute("data-content")));
renderElement.innerHTML = "";
try {