From cdd88241a6d26b1b18416de43a909fa561488f15 Mon Sep 17 00:00:00 2001 From: li3317 Date: Sun, 18 Jul 2021 21:54:40 +0800 Subject: [PATCH] fix undo insert image on empty asset --- lib/src/widgets/controller.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/src/widgets/controller.dart b/lib/src/widgets/controller.dart index 64c559f2..22763ca0 100644 --- a/lib/src/widgets/controller.dart +++ b/lib/src/widgets/controller.dart @@ -79,13 +79,13 @@ class QuillController extends ChangeNotifier { } void _handleHistoryChange(int? len) { - if (len != 0) { + if (len! > 0) { // if (this.selection.extentOffset >= document.length) { // // cursor exceeds the length of document, position it in the end // updateSelection( // TextSelection.collapsed(offset: document.length), ChangeSource.LOCAL); updateSelection( - TextSelection.collapsed(offset: selection.baseOffset + len!), + TextSelection.collapsed(offset: selection.baseOffset + len), ChangeSource.LOCAL); } else { // no need to move cursor