mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-24 07:29:30 +01:00
web: set tab/window title to note title (#2127)
Signed-off-by: Abdulrehman-Jafer <abdulrehmanjaferwork01233@gmail.com>
This commit is contained in:
committed by
GitHub
parent
b1d4ccc27e
commit
1c25baccea
@@ -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);
|
||||
|
||||
22
apps/web/src/utils/dom.ts
Normal file
22
apps/web/src/utils/dom.ts
Normal file
@@ -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`;
|
||||
};
|
||||
Reference in New Issue
Block a user