From: Adam Dullage Date: Thu, 17 Feb 2022 18:57:54 +0000 (+0000) Subject: Exclude extension when renaming X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=e6225959dc901d9636004ce1ad6371b29c7df184;p=flatnotes.git Exclude extension when renaming --- diff --git a/README.md b/README.md index 7501db3..eb896fe 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ This is what flatnotes aims to achieve. * [x] Routing * [x] e to edit * [x] Ability to Delete a Note -* [ ] Exclude extension when renaming +* [x] Exclude extension when renaming * [ ] Loading & Not Found Indicators * [ ] / to search * [ ] CTRL-S to save diff --git a/flatnotes/src/components/App.js b/flatnotes/src/components/App.js index 2c307a4..cd2d450 100644 --- a/flatnotes/src/components/App.js +++ b/flatnotes/src/components/App.js @@ -32,7 +32,7 @@ export default { searchTimeout: null, searchResults: null, currentNote: null, - newFilename: null, + titleInput: null, editMode: false, }; }, @@ -170,7 +170,7 @@ export default { response.data.lastModified, response.data.content ); - parent.newFilename = parent.currentNote.filename; + parent.titleInput = parent.currentNote.title; parent.updateDocumentTitle(); }); }, @@ -192,7 +192,7 @@ export default { if (this.currentNote.lastModified == null) { api .post(`/api/notes`, { - filename: this.newFilename, + filename: `${this.titleInput}.${constants.markdownExt}`, content: newContent, }) .then(this.saveNoteResponseHandler); @@ -201,11 +201,11 @@ export default { // Modified Note else if ( newContent != this.currentNote.content || - this.newFilename != this.currentNote.filename + this.titleInput != this.currentNote.title ) { api .patch(`/api/notes/${this.currentNote.filename}`, { - newFilename: this.newFilename, + newFilename: `${this.titleInput}.${this.currentNote.ext}`, newContent: newContent, }) .then(this.saveNoteResponseHandler); @@ -223,7 +223,7 @@ export default { response.data.lastModified, response.data.content ); - this.newFilename = this.currentNote.filename; + this.titleInput = this.currentNote.title; this.updateDocumentTitle(); history.replaceState(null, "", this.currentNote.href); this.toggleEditMode(); diff --git a/flatnotes/src/components/App.vue b/flatnotes/src/components/App.vue index 13f12cb..d0bdf5a 100644 --- a/flatnotes/src/components/App.vue +++ b/flatnotes/src/components/App.vue @@ -144,7 +144,7 @@
- +