mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-29 00:20:04 +01:00
web: add setting to allow hiding note title from window title (#3480)
Signed-off-by: Johnny Avila <avila.johnny11@gmail.com> Co-authored-by: Abdullah Atta <abdullahatta@streetwriters.co>
This commit is contained in:
@@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
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",
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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 });
|
||||
|
||||
Reference in New Issue
Block a user