Skip to content

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

:art: Improve editor state synchronization when deleting blocks https://github.com/siyuan-note/siyuan/issues/17742

Daniel51318a538b91
diff --git a/app/src/protyle/index.ts b/app/src/protyle/index.ts
index 6bbc91795a..78290b3ed5 100644
--- a/app/src/protyle/index.ts
+++ b/app/src/protyle/index.ts
@@ -306,6 +306,7 @@ export class Protyle {
return;
}
let needCreateAction = "";
+ let hasDeleteOp = false;
data.data[0].doOperations.find((item: IOperation) => {
if (this.protyle.options.backlinkData && ["delete", "move"].includes(item.action)) {
// 只对特定情况刷新,否则展开、编辑等操作刷新会频繁
@@ -325,6 +326,9 @@ export class Protyle {
/// #endif
return true;
} else {
+ if (item.action === "delete") {
+ hasDeleteOp = true;
+ }
onTransaction(this.protyle, [item], false);
// 反链面板移除元素后,文档为空
if (!(item.action === "delete" && typeof item.data?.createEmptyParagraph === "boolean" && !item.data.createEmptyParagraph)) {
@@ -334,7 +338,7 @@ export class Protyle {
});
// 聚焦块被分屏另一侧的删除操作连带删除时(容器块删除会级联删除其所有子孙块,如列表/超级块/引述等),当前页签的聚焦块已成为孤儿但仍显示,需退出聚焦
// Improve editor state synchronization when deleting blocks https://github.com/siyuan-note/siyuan/issues/17742
- if (this.protyle.block.showAll && needCreateAction === "delete") {
+ if (this.protyle.block.showAll && hasDeleteOp) {
fetchPost("/api/block/checkBlockExist", {id: this.protyle.block.id}, response => {
if (!response.data) {
zoomOut({