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

Vanessac06422abf666
diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.ts
index 1a5cc3ceba..38666d924c 100644
--- a/app/src/protyle/wysiwyg/transaction.ts
+++ b/app/src/protyle/wysiwyg/transaction.ts
@@ -236,7 +236,9 @@ const promiseTransaction = () => {
});
// 删除仅有的折叠标题后展开内容为空
- if (protyle.wysiwyg.element.childElementCount === 0) {
+ if (protyle.wysiwyg.element.childElementCount === 0 &&
+ // 聚焦时不需要新增块,否则会导致 https://github.com/siyuan-note/siyuan/issues/12326 第一点
+ !protyle.block.showAll) {
const newID = Lute.NewNodeID();
const emptyElement = genEmptyElement(false, true, newID);
protyle.wysiwyg.element.insertAdjacentElement("afterbegin", emptyElement);
@@ -279,7 +281,11 @@ const deleteBlock = (updateElements: Element[], id: string, protyle: IProtyle, i
focusSideBlock(updateElements[0]);
}
updateElements.forEach(item => {
- item.remove();
+ // 需移除顶层,否则删除唯一的列表项后列表无法清除干净 https://github.com/siyuan-note/siyuan/issues/12326 第一点
+ const topElement = getTopAloneElement(item);
+ if (topElement) {
+ topElement.remove();
+ }
});
// 更新 ws 嵌入块
protyle.wysiwyg.element.querySelectorAll('[data-type="NodeBlockQueryEmbed"]').forEach((item) => {