Skip to content

Commit c7be3a3

Browse files
authored
added selection change callback (singerdmx#683)
1 parent 5772b51 commit c7be3a3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/src/widgets/controller.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class QuillController extends ChangeNotifier {
2323
this.onReplaceText,
2424
this.onDelete,
2525
this.onSelectionCompleted,
26+
this.onSelectionChanged,
2627
}) : _selection = selection,
2728
_keepStyleOnNewLine = keepStyleOnNewLine;
2829

@@ -52,6 +53,7 @@ class QuillController extends ChangeNotifier {
5253
DeleteCallback? onDelete;
5354

5455
void Function()? onSelectionCompleted;
56+
void Function(TextSelection textSelection)? onSelectionChanged;
5557

5658
/// Store any styles attribute that got toggled by the tap of a button
5759
/// and that has not been applied yet.
@@ -328,6 +330,7 @@ class QuillController extends ChangeNotifier {
328330
baseOffset: math.min(selection.baseOffset, end),
329331
extentOffset: math.min(selection.extentOffset, end));
330332
toggledStyle = Style();
333+
onSelectionChanged?.call(textSelection);
331334
}
332335

333336
/// Given offset, find its leaf node in document

0 commit comments

Comments
 (0)