Fix for undoing a modification ending with an indented line (#656)

Co-authored-by: Nicolas Dion Bouchard <nicolas.dionbouchard@sviesolutions.com>
pull/660/head
Nicolas Dion-Bouchard 3 years ago committed by GitHub
parent 1e0b1259a1
commit 350d7bcfb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  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