diff --git a/lib/src/models/rules/insert.dart b/lib/src/models/rules/insert.dart index 7f8686c4..e79879d8 100644 --- a/lib/src/models/rules/insert.dart +++ b/lib/src/models/rules/insert.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; } diff --git a/lib/src/widgets/toolbar/buttons/color/color_button.dart b/lib/src/widgets/toolbar/buttons/color/color_button.dart index eec85be1..77fa424c 100644 --- a/lib/src/widgets/toolbar/buttons/color/color_button.dart +++ b/lib/src/widgets/toolbar/buttons/color/color_button.dart @@ -191,6 +191,7 @@ class QuillToolbarColorButtonState extends State { size: iconSize * iconButtonFactor, ), onPressed: _showColorPicker, + afterPressed: afterButtonPressed, ); }