color_button calls afterButtonPressed

insert at start of line uses style for line
pull/1801/head
Douglas Ward 1 year ago
parent 3217059ac6
commit ea7ba7e712
  1. 12
      lib/src/models/rules/insert.dart
  2. 1
      lib/src/widgets/toolbar/buttons/color/color_button.dart

@ -559,10 +559,16 @@ class PreserveInlineStylesRule extends InsertRule {
}
final itr = DeltaIterator(document);
final prev = itr.skip(len == 0 ? index : index + 1);
var prev = itr.skip(len == 0 ? index : index + 1);
//
// Inserting at start of line should use style for first character on the line
//
if (prev == null ||
prev.data is! String ||
(prev.data as String).contains('\n')) {
(prev.data is String && (prev.data as String).endsWith('\n'))) {
prev = itr.next();
}
if (prev.data is! String) {
return null;
}

@ -191,6 +191,7 @@ class QuillToolbarColorButtonState extends State<QuillToolbarColorButton> {
size: iconSize * iconButtonFactor,
),
onPressed: _showColorPicker,
afterPressed: afterButtonPressed,
);
}

Loading…
Cancel
Save