Fix Undo throw Offset cannot be negative

pull/13/head
singerdmx 4 years ago
parent 1f333f4d96
commit 27ed93970f
  1. 10
      lib/widgets/controller.dart

@ -44,15 +44,25 @@ class QuillController extends ChangeNotifier {
void undo() { void undo() {
if (document.undo()) { if (document.undo()) {
if (this.selection.extentOffset >= document.length) {
updateSelection(TextSelection.collapsed(offset: document.length),
ChangeSource.LOCAL);
} else {
notifyListeners(); notifyListeners();
} }
} }
}
void redo() { void redo() {
if (document.redo()) { if (document.redo()) {
if (this.selection.extentOffset >= document.length) {
updateSelection(TextSelection.collapsed(offset: document.length),
ChangeSource.LOCAL);
} else {
notifyListeners(); notifyListeners();
} }
} }
}
get hasUndo => document.hasUndo; get hasUndo => document.hasUndo;

Loading…
Cancel
Save