Add comments

pull/633/head
X Code 3 years ago
parent 152c3422cd
commit 3c7fcb3c66
  1. 2
      lib/src/models/documents/document.dart
  2. 1
      lib/src/models/documents/nodes/block.dart
  3. 1
      lib/src/models/documents/nodes/line.dart

@ -225,6 +225,8 @@ class Document {
op.attributes != null ? Style.fromJson(op.attributes) : null;
if (op.isInsert) {
// Must normalize data before inserting into the document, makes sure
// that any embedded objects are converted into EmbeddableObject type.
_root.insert(offset, _normalize(op.data), style);
} else if (op.isDelete) {
_root.delete(offset, op.length);

@ -23,6 +23,7 @@ class Block extends Container<Line?> {
@override
Delta toDelta() {
// Line nodes take care of incorporating block style into their delta.
return children
.map((child) => child.toDelta())
.fold(Delta(), (a, b) => a.concat(b));

@ -268,6 +268,7 @@ class Line extends Container<Leaf?> {
unlink();
block.insertAfter(this);
} else {
/// need to split this block into two as [line] is in the middle.
final before = block.clone() as Block;
block.insertBefore(before);

Loading…
Cancel
Save