An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: 删除已打开页签报错
Vanessa5acdc1f3c7ba
diff --git a/app/src/dialog/processSystem.ts b/app/src/dialog/processSystem.tsindex 5edf4c7000..35b8bce603 100644--- a/app/src/dialog/processSystem.ts+++ b/app/src/dialog/processSystem.ts@@ -34,7 +34,7 @@ export const lockFile = (id: string) => {/// #if !MOBILEgetAllModels().editor.find((item) => {if (item.editor.protyle.block.rootID === id) {- item.parent.parent.removeTab(item.parent.id);+ item.parent.parent.removeTab(item.parent.id, false, false);return true;}});diff --git a/app/src/layout/Wnd.ts b/app/src/layout/Wnd.tsindex e9a1b7bf66..6524d2454f 100644--- a/app/src/layout/Wnd.ts+++ b/app/src/layout/Wnd.ts@@ -482,10 +482,10 @@ export class Wnd {model.send("closews", {});}- private removeTabAction = (id: string, closeAll = false) => {+ private removeTabAction = (id: string, closeAll = false, hasSaveScroll = true) => {this.children.find((item, index) => {if (item.id === id) {- if (item.model instanceof Editor) {+ if (item.model instanceof Editor && hasSaveScroll) {saveScroll(item.model.editor.protyle);}if (this.children.length === 1) {@@ -545,7 +545,7 @@ export class Wnd {/// #endif};- public removeTab(id: string, closeAll = false) {+ public removeTab(id: string, closeAll = false, needSaveScroll = true) {for (let index = 0; index < this.children.length; index++) {const item = this.children[index];if (item.id === id) {@@ -554,9 +554,9 @@ export class Wnd {showMessage(window.siyuan.languages.uploading);return;}- this.removeTabAction(id, closeAll);+ this.removeTabAction(id, closeAll, needSaveScroll);} else {- this.removeTabAction(id, closeAll);+ this.removeTabAction(id, closeAll, needSaveScroll);}return;}diff --git a/app/src/protyle/index.ts b/app/src/protyle/index.tsindex 3df7113d68..6ca93f4299 100644--- a/app/src/protyle/index.ts+++ b/app/src/protyle/index.ts@@ -140,13 +140,13 @@ class Protyle {break;case "unmount":if (this.protyle.model && this.protyle.notebookId === data.data.box) {- this.protyle.model.parent.parent.removeTab(this.protyle.model.parent.id);+ this.protyle.model.parent.parent.removeTab(this.protyle.model.parent.id, false, false);}break;case "remove":if (this.protyle.model && (this.protyle.notebookId === data.data.box &&(!data.data.path || this.protyle.path.indexOf(getDisplayName(data.data.path, false, true)) === 0))) {- this.protyle.model.parent.parent.removeTab(this.protyle.model.parent.id);+ this.protyle.model.parent.parent.removeTab(this.protyle.model.parent.id, false, false);}break;}diff --git a/app/src/protyle/util/onGet.ts b/app/src/protyle/util/onGet.tsindex 23c00d5923..b1846d9854 100644--- a/app/src/protyle/util/onGet.ts+++ b/app/src/protyle/util/onGet.ts@@ -21,7 +21,7 @@ export const onGet = (data: IWebSocketData, protyle: IProtyle, action: string[]if (data.code === 1) {// 其他报错if (protyle.model) {- protyle.model.parent.parent.removeTab(protyle.model.parent.id);+ protyle.model.parent.parent.removeTab(protyle.model.parent.id, false, false);} else {protyle.element.innerHTML = `<div class="ft__smaller ft__secondary b3-form__space--small" contenteditable="false">${window.siyuan.languages.refExpired}</div>`;}