We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2a97d99 commit a40fd24Copy full SHA for a40fd24
lib/src/editor_controller.dart
@@ -42,6 +42,13 @@ extension BBCodeExt on BBCodeEditorController {
42
void setDocumentFromDelta(Delta delta) {
43
if (delta.isEmpty) {
44
delta.insert('\n');
45
+ } else {
46
+ // Make sure delta ended with new line.
47
+ final lastOp = delta.operations.lastOrNull;
48
+ final lastOpData = lastOp?.data;
49
+ if (lastOp == null || lastOp.data == null || lastOpData is! String || !lastOpData.endsWith('\n')) {
50
+ delta.operations.add(Operation.insert('\n'));
51
+ }
52
}
53
54
document = Document.fromDelta(delta);
0 commit comments