diff --git a/lib/src/models/rules/insert.dart b/lib/src/models/rules/insert.dart index f1db6318..70c1e63e 100644 --- a/lib/src/models/rules/insert.dart +++ b/lib/src/models/rules/insert.dart @@ -115,7 +115,11 @@ class PreserveBlockStyleOnInsertRule extends InsertRule { delta.insert('\n', lineStyle.toJson()); } else if (i < lines.length - 1) { // we don't want to insert a newline after the last chunk of text, so -1 - delta.insert('\n', blockStyle); + final blockAttributes = blockStyle.isEmpty + ? null + : blockStyle.map((_, attribute) => + MapEntry(attribute.key, attribute.value)); + delta.insert('\n', blockAttributes); } }