Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

web: set tab/window title to note title (#2127)

Abdulrehman-Jafer1c25baccea9f
diff --git a/apps/web/src/stores/editor-store.js b/apps/web/src/stores/editor-store.js
index ef4340a78..50018125e 100644
--- a/apps/web/src/stores/editor-store.js
+++ b/apps/web/src/stores/editor-store.js
@@ -28,6 +28,7 @@ import { EV, EVENTS } from "@notesnook/core/common";
import { hashNavigate } from "../navigation";
import { logger } from "../utils/logger";
import Config from "../utils/config";
+import { setDocumentTitle } from "../utils/dom";
const SESSION_STATES = {
stale: "stale",
@@ -131,6 +132,8 @@ class EditorStore extends BaseStore {
noteStore.setSelectedNote(note.id);
+ setDocumentTitle(note.title);
+
if (note.locked)
return hashNavigate(`/notes/${noteId}/unlock`, { replace: true });
if (note.conflicted)
@@ -224,6 +227,8 @@ class EditorStore extends BaseStore {
});
this.setSaveState(1);
+ setDocumentTitle(note.title);
+
} catch (err) {
this.setSaveState(-1);
logger.error(err);
diff --git a/apps/web/src/utils/dom.ts b/apps/web/src/utils/dom.ts
new file mode 100644
index 000000000..ed4fec294
--- /dev/null
+++ b/apps/web/src/utils/dom.ts
@@ -0,0 +1,22 @@
+/*
+This file is part of the Notesnook project (https://notesnook.com/)
+
+Copyright (C) 2023 Streetwriters (Private) Limited
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+export const setDocumentTitle = (title:string) => {
+ document.title = `${title} - Notesnook`;
+};
\ No newline at end of file