Fix for undoing a modification ending with an indented line

pull/656/head
Nicolas Dion Bouchard 3 years ago
parent 1e0b1259a1
commit c203753822
  1. 6
      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<String, dynamic>((_, attribute) =>
MapEntry<String, dynamic>(attribute.key, attribute.value));
delta.insert('\n', blockAttributes);
}
}

Loading…
Cancel
Save