mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-29 18:38:36 +08:00
More thorough checking for if a Note has been modified
This commit is contained in:
@ -34,6 +34,6 @@ class MdYamlDoc {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'NoteData{body: $body, props: $props}';
|
return 'MdYamlDoc{body: "$body", props: $props}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -262,10 +262,20 @@ class NoteEditorState extends State<NoteEditor> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (note.data != originalNoteData) {
|
if (note.data != originalNoteData) {
|
||||||
var newWithoutModified = MdYamlDoc.from(note.data);
|
var newSimplified = MdYamlDoc.from(note.data);
|
||||||
newWithoutModified.props.remove(note.noteSerializer.settings.modifiedKey);
|
newSimplified.props.remove(note.noteSerializer.settings.modifiedKey);
|
||||||
|
newSimplified.body = newSimplified.body.trim();
|
||||||
|
|
||||||
return newWithoutModified != originalNoteData;
|
var originalSimplified = MdYamlDoc.from(originalNoteData);
|
||||||
|
originalSimplified.props.remove(note.noteSerializer.settings.modifiedKey);
|
||||||
|
originalSimplified.body = originalSimplified.body.trim();
|
||||||
|
|
||||||
|
bool hasBeenModified = newSimplified != originalSimplified;
|
||||||
|
if (hasBeenModified) {
|
||||||
|
print("Note modified");
|
||||||
|
print("Original: $originalNoteData");
|
||||||
|
print("New: $newSimplified");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user