Skip to content

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

web: reset tab/window title on new note

Abdullah Atta80f49e22e510
diff --git a/apps/web/src/stores/editor-store.js b/apps/web/src/stores/editor-store.js
index 50018125e..2d36cfd7e 100644
--- a/apps/web/src/stores/editor-store.js
+++ b/apps/web/src/stores/editor-store.js
@@ -131,7 +131,6 @@ class EditorStore extends BaseStore {
if (!note) return;
noteStore.setSelectedNote(note.id);
-
setDocumentTitle(note.title);
if (note.locked)
@@ -225,10 +224,9 @@ class EditorStore extends BaseStore {
state.session.dateEdited = note.dateEdited;
state.session.attachmentsLength = attachments.length;
});
-
- this.setSaveState(1);
setDocumentTitle(note.title);
+ this.setSaveState(1);
} catch (err) {
this.setSaveState(-1);
logger.error(err);
@@ -253,6 +251,7 @@ class EditorStore extends BaseStore {
});
noteStore.setSelectedNote(0);
appStore.setIsEditorOpen(true);
+ setDocumentTitle();
};
clearSession = async (shouldNavigate = true) => {
@@ -270,6 +269,7 @@ class EditorStore extends BaseStore {
if (shouldNavigate)
hashNavigate(`/notes/create`, { replace: true, addNonce: true });
appStore.setIsEditorOpen(false);
+ setDocumentTitle();
};
setTitle = (noteId, title) => {
diff --git a/apps/web/src/utils/dom.ts b/apps/web/src/utils/dom.ts
index ed4fec294..06cd83747 100644
--- a/apps/web/src/utils/dom.ts
+++ b/apps/web/src/utils/dom.ts
@@ -17,6 +17,7 @@ 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
+export const setDocumentTitle = (title?: string) => {
+ if (!title) document.title = "Notesnook";
+ else document.title = `${title} - Notesnook`;
+};