From ea20e90934eccd76a9746572439c09d2e41acee9 Mon Sep 17 00:00:00 2001 From: Gedulis12 <80179975+Gedulis12@users.noreply.github.com> Date: Mon, 7 Aug 2023 21:38:06 +0300 Subject: [PATCH] Revert "Ensure root knows when note title changes. Fixes #82." This reverts commit 851c640fcad766029a5199bcc6ef04deaf2a7e1c. --- flatnotes/src/components/App.js | 9 ++------- flatnotes/src/components/NoteViewerEditor.vue | 8 +++----- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/flatnotes/src/components/App.js b/flatnotes/src/components/App.js index a6b766d..55d5647 100644 --- a/flatnotes/src/components/App.js +++ b/flatnotes/src/components/App.js @@ -100,8 +100,8 @@ export default { // Note else if (basePath == constants.basePaths.note) { + this.updateDocumentTitle(); this.noteTitle = decodeURIComponent(path[2]); - this.updateDocumentTitle(this.noteTitle); this.currentView = this.views.note; } @@ -172,11 +172,6 @@ export default { this.darkTheme = !this.darkTheme; localStorage.setItem("darkTheme", this.darkTheme); }, - - updateNoteTitle: function (title) { - this.noteTitle = title; - this.updateDocumentTitle(title); - }, }, created: function () { @@ -186,7 +181,7 @@ export default { EventBus.$on("navigate", this.navigate); EventBus.$on("unhandledServerError", this.unhandledServerErrorToast); - EventBus.$on("updateNoteTitle", this.updateNoteTitle); + EventBus.$on("updateDocumentTitle", this.updateDocumentTitle); Mousetrap.bind("/", function () { parent.openSearch(); diff --git a/flatnotes/src/components/NoteViewerEditor.vue b/flatnotes/src/components/NoteViewerEditor.vue index b1a42e4..344f03f 100644 --- a/flatnotes/src/components/NoteViewerEditor.vue +++ b/flatnotes/src/components/NoteViewerEditor.vue @@ -209,9 +209,7 @@ export default { watch: { titleToLoad: function () { - if (this.titleToLoad !== this.currentNote?.title) { - this.init(); - } + this.init(); }, }, @@ -227,7 +225,7 @@ export default { response.data.lastModified, response.data.content ); - // EventBus.$emit("updateDocumentTitle", parent.currentNote.title); + EventBus.$emit("updateDocumentTitle", parent.currentNote.title); }) .catch(function (error) { if (error.handled) { @@ -448,7 +446,7 @@ export default { response.data.lastModified, response.data.content ); - EventBus.$emit("updateNoteTitle", this.currentNote.title); + EventBus.$emit("updateDocumentTitle", this.currentNote.title); history.replaceState(null, "", this.currentNote.href); this.setEditMode(false); this.noteSavedToast();