mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-27 01:02:14 +08:00
MarkdownEditor: Handle title change marking note as modified
This commit is contained in:
@ -104,7 +104,7 @@ class MarkdownEditorState extends State<MarkdownEditor>
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
NoteTitleEditor(
|
NoteTitleEditor(
|
||||||
_titleTextController,
|
_titleTextController,
|
||||||
_noteTextChanged,
|
_noteTitleTextChanged,
|
||||||
),
|
),
|
||||||
NoteBodyEditor(
|
NoteBodyEditor(
|
||||||
textController: _textController,
|
textController: _textController,
|
||||||
@ -176,6 +176,20 @@ class MarkdownEditorState extends State<MarkdownEditor>
|
|||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _noteTitleTextChanged() {
|
||||||
|
if (_noteModified && !widget.editMode) return;
|
||||||
|
|
||||||
|
var newState =
|
||||||
|
!(widget.editMode && _titleTextController.text.trim().isEmpty);
|
||||||
|
if (newState != _noteModified) {
|
||||||
|
setState(() {
|
||||||
|
_noteModified = newState;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
void _applyHeuristics() {
|
void _applyHeuristics() {
|
||||||
var selection = _textController.selection;
|
var selection = _textController.selection;
|
||||||
if (selection.baseOffset != selection.extentOffset) {
|
if (selection.baseOffset != selection.extentOffset) {
|
||||||
|
Reference in New Issue
Block a user