From 234a17c6081258015c17660e1484f932324ae526 Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Tue, 23 Jul 2024 16:49:27 +0200 Subject: [PATCH] Fixes #955 --- type/web.ts | 16 +++++++++++----- web/client.ts | 2 +- website/SETTINGS.md | 3 +++ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/type/web.ts b/type/web.ts index 86d3d37d..38b94b4b 100644 --- a/type/web.ts +++ b/type/web.ts @@ -13,19 +13,25 @@ import { export type BuiltinSettings = { indexPage: string; - customStyles?: string | string[]; - plugOverrides?: Record>; shortcuts?: Shortcut[]; - hideSyncButton?: boolean; - hideEditButton?: boolean; useSmartQuotes?: boolean; maximumAttachmentSize?: number; - defaultLinkStyle?: string; + // Open the last page that was open when the app was closed + pwaOpenLastPage?: boolean; + // UI visuals + hideEditButton?: boolean; + hideSyncButton?: boolean; actionButtons: ActionButton[]; pageDecorations?: PageDecoration[]; // Format: compatible with docker ignore spaceIgnore?: string; emoji?: EmojiConfig; + // DEPRECATED: Use space styles instead + customStyles?: string | string[]; + // DEPRECATED: Use shortcuts instead + plugOverrides?: Record>; + // NOTE: Bit niche, maybe delete at some point? + defaultLinkStyle?: string; }; export type PanelConfig = { diff --git a/web/client.ts b/web/client.ts index 2e7f3498..83a39de7 100644 --- a/web/client.ts +++ b/web/client.ts @@ -451,7 +451,7 @@ export class Client { ); }); - if (location.hash === "#boot") { + if (location.hash === "#boot" && this.settings.pwaOpenLastPage !== false) { (async () => { // Cold start PWA load const lastPage = await this.stateDataStore.get([ diff --git a/website/SETTINGS.md b/website/SETTINGS.md index 664ac49b..40c38f23 100644 --- a/website/SETTINGS.md +++ b/website/SETTINGS.md @@ -19,6 +19,9 @@ hideSyncButton: false # Hide the edit button (available on mobile only) hideEditButton: true # defaults to 'false' +# In PWA mode, SilverBullet automatically reopens the last opened page on boot, this can be disabled +pwaOpenLastPage: true + # Configure the shown action buttons (top right bar) actionButtons: - icon: home # Use any icon from https://feathericons.com