diff --git a/app/src/layout/Wnd.ts b/app/src/layout/Wnd.ts index c5f0885f0..5260996df 100644 --- a/app/src/layout/Wnd.ts +++ b/app/src/layout/Wnd.ts @@ -787,10 +787,12 @@ export class Wnd { if (window.siyuan.storage[Constants.LOCAL_CLOSED_TABS].length > Constants.SIZE_UNDO) { window.siyuan.storage[Constants.LOCAL_CLOSED_TABS].pop(); } - const tabJSON = {}; - layoutToJSON(item, tabJSON); - window.siyuan.storage[Constants.LOCAL_CLOSED_TABS].push(tabJSON); - setStorageVal(Constants.LOCAL_CLOSED_TABS, window.siyuan.storage[Constants.LOCAL_CLOSED_TABS]); + if (item.headElement) { + const tabJSON = {}; + layoutToJSON(item, tabJSON); + window.siyuan.storage[Constants.LOCAL_CLOSED_TABS].push(tabJSON); + setStorageVal(Constants.LOCAL_CLOSED_TABS, window.siyuan.storage[Constants.LOCAL_CLOSED_TABS]); + } if (item.model instanceof Custom && item.model.beforeDestroy) { item.model.beforeDestroy(); }