Code cleanup

pull/635/head
X Code 3 years ago
parent f278ea1dc9
commit 3253a3c0f8
  1. 2
      lib/src/widgets/controller.dart
  2. 3
      lib/src/widgets/raw_editor.dart

@ -327,6 +327,6 @@ class QuillController extends ChangeNotifier {
extentOffset: math.min(selection.extentOffset, end));
}
// To notify toolbar buttons directly with attributes
// Notify toolbar buttons directly with attributes
Map<String, Attribute> toolbarButtonToggler = {};
}

@ -406,7 +406,6 @@ class RawEditorState extends EditorState
if (!widget.readOnly) {
_disableScrollControllerAnimateOnce = true;
final attribute = value ? Attribute.checked : Attribute.unchecked;
widget.controller.formatText(offset, 0, attribute);
// Checkbox tapping causes controller.selection to go to offset 0
// Stop toggling those two toolbar buttons
@ -415,6 +414,8 @@ class RawEditorState extends EditorState
Attribute.header.key: Attribute.header
};
widget.controller.formatText(offset, 0, attribute);
// Go back from offset 0 to current selection
SchedulerBinding.instance!.addPostFrameCallback((_) {
widget.controller.updateSelection(

Loading…
Cancel
Save