mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-27 09:06:43 +08:00
Note Rename: Do not let it be renamed to a non markdown file
Otherwise it disappears from the listing as we only show files which end with a '.md'.
This commit is contained in:
@ -151,6 +151,11 @@ class StateContainerState extends State<StateContainer> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void renameNote(Note note, String newFileName) async {
|
void renameNote(Note note, String newFileName) async {
|
||||||
|
// Do not let the user rename it to a non-markdown file
|
||||||
|
if (!newFileName.toLowerCase().endsWith('.md')) {
|
||||||
|
newFileName += '.md';
|
||||||
|
}
|
||||||
|
|
||||||
var oldNotePath = note.filePath;
|
var oldNotePath = note.filePath;
|
||||||
note.rename(newFileName);
|
note.rename(newFileName);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user