This commit is contained in:
Vanessa 2023-12-16 09:50:05 +08:00
parent 969a8d24fc
commit f4e2c3423a
2 changed files with 20 additions and 6 deletions

View file

@ -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;

View file

@ -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);