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

Vanessaa77e0820ad38
diff --git a/app/src/protyle/wysiwyg/remove.ts b/app/src/protyle/wysiwyg/remove.ts
index d2933a2f76..fe7a4bfe19 100644
--- a/app/src/protyle/wysiwyg/remove.ts
+++ b/app/src/protyle/wysiwyg/remove.ts
@@ -363,7 +363,7 @@ export const removeBlock = async (protyle: IProtyle, blockElement: Element, rang
action: "insert",
data: previousElement.outerHTML,
id: previousElement.getAttribute("data-node-id"),
- parentID: previousElement.parentElement.getAttribute("data-node-id") || protyle.block.parentID,
+ parentID: getParentBlock(previousElement).getAttribute("data-node-id") || protyle.block.parentID,
previousID: (ppElement && (!previousElement.previousElementSibling || !previousElement.previousElementSibling.classList.contains("protyle-action"))) ? ppElement.getAttribute("data-node-id") : undefined
}]);
previousElement.remove();
@@ -414,7 +414,7 @@ export const removeBlock = async (protyle: IProtyle, blockElement: Element, rang
return;
}
- const parentElement = hasClosestBlock(blockElement.parentElement);
+ const parentElement = hasClosestBlock(getParentBlock(blockElement));
const editableElement = getContenteditableElement(blockElement);
const previousLastElement = getLastBlock(previousElement) as HTMLElement;
if (range.toString() === "" && isMobile() && previousLastElement && previousLastElement.classList.contains("hr") && getSelectionOffset(editableElement).start === 0) {
@@ -426,7 +426,7 @@ export const removeBlock = async (protyle: IProtyle, blockElement: Element, rang
data: previousLastElement.outerHTML,
id: previousLastElement.getAttribute("data-node-id"),
previousID: previousLastElement.previousElementSibling?.getAttribute("data-node-id"),
- parentID: previousLastElement.parentElement.getAttribute("data-node-id")
+ parentID: getParentBlock(previousLastElement).getAttribute("data-node-id")
}]);
previousLastElement.remove();
return;
@@ -452,7 +452,7 @@ export const removeBlock = async (protyle: IProtyle, blockElement: Element, rang
data: blockElement.outerHTML,
id: id,
previousID: blockElement.previousElementSibling?.getAttribute("data-node-id"),
- parentID: blockElement.parentElement.getAttribute("data-node-id")
+ parentID: getParentBlock(blockElement).getAttribute("data-node-id")
}];
blockElement.remove();
// 取消超级块
@@ -679,7 +679,7 @@ const removeLi = (protyle: IProtyle, blockElement: Element, range: Range, isDele
id: item.getAttribute("data-node-id"),
data: item.outerHTML,
previousID: index === 0 ? listElement.previousElementSibling?.getAttribute("data-node-id") : doOperations[index - 1].id,
- parentID: listElement.parentElement.getAttribute("data-node-id") || protyle.block.parentID
+ parentID: getParentBlock(listElement).getAttribute("data-node-id") || protyle.block.parentID
});
undoOperations.push({
action: "delete",