diff --git a/lib/src/widgets/controller.dart b/lib/src/widgets/controller.dart index 16506c10..f9447c0e 100644 --- a/lib/src/widgets/controller.dart +++ b/lib/src/widgets/controller.dart @@ -23,6 +23,7 @@ class QuillController extends ChangeNotifier { this.onReplaceText, this.onDelete, this.onSelectionCompleted, + this.onSelectionChanged, }) : _selection = selection, _keepStyleOnNewLine = keepStyleOnNewLine; @@ -52,6 +53,7 @@ class QuillController extends ChangeNotifier { DeleteCallback? onDelete; void Function()? onSelectionCompleted; + void Function(TextSelection textSelection)? onSelectionChanged; /// Store any styles attribute that got toggled by the tap of a button /// and that has not been applied yet. @@ -328,6 +330,7 @@ class QuillController extends ChangeNotifier { baseOffset: math.min(selection.baseOffset, end), extentOffset: math.min(selection.extentOffset, end)); toggledStyle = Style(); + onSelectionChanged?.call(textSelection); } /// Given offset, find its leaf node in document