Skip to content

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

:bug: Avoid inserting blocks into embedded copies https://github.com/siyuan-note/siyuan/issues/18131

Danielb117305c76fc
diff --git a/app/src/protyle/gutter/index.ts b/app/src/protyle/gutter/index.ts
index c08c3d046a..deb092103f 100644
--- a/app/src/protyle/gutter/index.ts
+++ b/app/src/protyle/gutter/index.ts
@@ -381,12 +381,16 @@ export class Gutter {
const gutterRect = buttonElement.getBoundingClientRect();
if (buttonElement.dataset.type === "gutterPlusBefore" || buttonElement.dataset.type === "gutterPlusAfter") {
// 块标边缘+号:在对应块上方/下方插入新块,复用 insertEmptyBlock(列表项自动生成新列表项)
- if (protyle.disabled || !id) {
+ if (protyle.disabled || !id || !activeBlockButton) {
+ return;
+ }
+ const nodeElement = this.getNodeElement(protyle, activeBlockButton);
+ if (!nodeElement) {
return;
}
hideElements(["gutter"], protyle);
countBlockWord([], protyle.block.rootID);
- insertEmptyBlock(protyle, buttonElement.dataset.type === "gutterPlusBefore" ? "beforebegin" : "afterend", id);
+ insertEmptyBlock(protyle, buttonElement.dataset.type === "gutterPlusBefore" ? "beforebegin" : "afterend", nodeElement);
return;
}
if (buttonElement.dataset.type === "NodeAttributeViewRowMenu" || buttonElement.dataset.type === "NodeAttributeViewRow") {