Skip to content

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

:art: fix https://github.com/siyuan-note/siyuan/issues/9855

Vanessaf4e2c3423a2b
diff --git a/app/src/constants.ts b/app/src/constants.ts
index 917304a18a..20fdcfb8c6 100644
--- a/app/src/constants.ts
+++ b/app/src/constants.ts
@@ -101,6 +101,7 @@ export abstract class Constants {
public static readonly LOCAL_PLUGINTOPUNPIN = "local-plugintopunpin";
public static readonly LOCAL_FLASHCARD = "local-flashcard";
public static readonly LOCAL_FILEPOSITION = "local-fileposition";
+ public static readonly LOCAL_SESSION_FIRSTLOAD = "local-session-firstload";
// timeout
public static readonly TIMEOUT_DBLCLICK = 190;
diff --git a/app/src/layout/util.ts b/app/src/layout/util.ts
index 39c620cc7f..419ca7a451 100644
--- a/app/src/layout/util.ts
+++ b/app/src/layout/util.ts
@@ -375,12 +375,25 @@ export const JSONToLayout = (app: App, isStart: boolean) => {
JSONToCenter(app, window.siyuan.config.uiLayout.layout, undefined);
JSONToDock(window.siyuan.config.uiLayout, app);
// 启动时不打开页签,需要移除没有钉住的页签
- if (window.siyuan.config.fileTree.closeTabsOnStart && isStart) {
- getAllTabs().forEach(item => {
- if (item.headElement && !item.headElement.classList.contains("item--pin")) {
- item.parent.removeTab(item.id, false, false);
- }
- });
+ if (window.siyuan.config.fileTree.closeTabsOnStart) {
+ /// #if BROWSER
+ if (!sessionStorage.getItem(Constants.LOCAL_SESSION_FIRSTLOAD)) {
+ getAllTabs().forEach(item => {
+ if (item.headElement && !item.headElement.classList.contains("item--pin")) {
+ item.parent.removeTab(item.id, false, false);
+ }
+ });
+ sessionStorage.setItem(Constants.LOCAL_SESSION_FIRSTLOAD, "true");
+ }
+ /// #else
+ if (isStart) {
+ getAllTabs().forEach(item => {
+ if (item.headElement && !item.headElement.classList.contains("item--pin")) {
+ item.parent.removeTab(item.id, false, false);
+ }
+ });
+ }
+ /// #endif
}
app.plugins.forEach(item => {
afterLoadPlugin(item);