|
|
|
@ -1,5 +1,3 @@ |
|
|
|
|
import 'package:meta/meta.dart' show immutable; |
|
|
|
|
|
|
|
|
|
import '../quill_delta.dart'; |
|
|
|
|
import '../structs/doc_change.dart'; |
|
|
|
|
import '../structs/history_changed.dart'; |
|
|
|
@ -14,7 +12,7 @@ class History { |
|
|
|
|
this.lastRecorded = 0, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
final HistoryStack stack = const HistoryStack.empty(); |
|
|
|
|
HistoryStack stack = HistoryStack.empty(); |
|
|
|
|
|
|
|
|
|
bool get hasUndo => stack.undo.isNotEmpty; |
|
|
|
|
|
|
|
|
@ -121,14 +119,13 @@ class History { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@immutable |
|
|
|
|
class HistoryStack { |
|
|
|
|
const HistoryStack.empty() |
|
|
|
|
: undo = const [], |
|
|
|
|
redo = const []; |
|
|
|
|
HistoryStack.empty() |
|
|
|
|
: undo = [], |
|
|
|
|
redo = []; |
|
|
|
|
|
|
|
|
|
final List<Delta> undo; |
|
|
|
|
final List<Delta> redo; |
|
|
|
|
List<Delta> undo; |
|
|
|
|
List<Delta> redo; |
|
|
|
|
|
|
|
|
|
void clear() { |
|
|
|
|
undo.clear(); |
|
|
|
|