diff --git a/apps/web/src/dialogs/settings/privacy-settings.ts b/apps/web/src/dialogs/settings/privacy-settings.ts index 0c3cf8395..18e1f8b91 100644 --- a/apps/web/src/dialogs/settings/privacy-settings.ts +++ b/apps/web/src/dialogs/settings/privacy-settings.ts @@ -20,7 +20,7 @@ along with this program. If not, see . import { SettingsGroup } from "./types"; import { useStore as useSettingStore } from "../../stores/setting-store"; import { useStore as useUserStore } from "../../stores/user-store"; -import { getPlatform, isDesktop } from "../../utils/platform"; +import { getPlatform } from "../../utils/platform"; import { db } from "../../common/db"; import { showPromptDialog } from "../../common/dialog-controller"; import Config from "../../utils/config"; @@ -74,6 +74,20 @@ What data is collected & when?`, } ] }, + { + key: "hide-note-title", + title: "Hide note title", + description: "Prevent note title from appearing in tab/window title.", + onStateChange: (listener) => + useSettingStore.subscribe((s) => s.hideNoteTitle, listener), + components: [ + { + type: "toggle", + isToggled: () => useSettingStore.getState().hideNoteTitle, + toggle: () => useSettingStore.getState().toggleHideTitle() + } + ] + }, { key: "privacy-mode", title: "Privacy mode", diff --git a/apps/web/src/stores/editor-store.js b/apps/web/src/stores/editor-store.js index f028c284e..9eb9a4cd2 100644 --- a/apps/web/src/stores/editor-store.js +++ b/apps/web/src/stores/editor-store.js @@ -22,6 +22,7 @@ import { store as noteStore } from "./note-store"; import { store as attachmentStore } from "./attachment-store"; import { store as appStore } from "./app-store"; import { store as tagStore } from "./tag-store"; +import { store as settingStore } from "./setting-store"; import { db } from "../common/db"; import BaseStore from "."; import { EV, EVENTS } from "@notesnook/core/dist/common"; @@ -151,7 +152,7 @@ class EditorStore extends BaseStore { if (!note) return; noteStore.setSelectedNote(note.id); - setDocumentTitle(note.title); + setDocumentTitle(settingStore.get().hideNoteTitle ? undefined : note.title); if (note.locked) return hashNavigate(`/notes/${noteId}/unlock`, { replace: true }); @@ -247,7 +248,9 @@ class EditorStore extends BaseStore { state.session.dateEdited = note.dateEdited; state.session.attachmentsLength = attachments.length; }); - setDocumentTitle(note.title); + setDocumentTitle( + settingStore.get().hideNoteTitle ? undefined : note.title + ); this.setSaveState(1); } catch (err) { diff --git a/apps/web/src/stores/setting-store.js b/apps/web/src/stores/setting-store.js index b370c14ee..0fef9ea9f 100644 --- a/apps/web/src/stores/setting-store.js +++ b/apps/web/src/stores/setting-store.js @@ -40,6 +40,7 @@ class SettingStore extends BaseStore { zoomFactor = 1.0; privacyMode = false; + hideNoteTitle = Config.get("hideNoteTitle", false); telemetry = isTelemetryEnabled(); /** @type {string} */ dateFormat = null; @@ -163,6 +164,12 @@ class SettingStore extends BaseStore { await desktop?.integration.setPrivacyMode.mutate({ enabled: !privacyMode }); }; + toggleHideTitle = async () => { + const hideTitle = this.get().hideNoteTitle; + this.set({ hideNoteTitle: !hideTitle }); + Config.set("hideNoteTitle", !hideTitle); + }; + toggleAutoUpdates = async () => { const autoUpdates = this.get().autoUpdates; this.set({ autoUpdates: !autoUpdates });