Paragraph constructor

Paragraph({
  1. required List<Line> lines,
  2. required ParagraphType type,
  3. Map<String, dynamic>? blockAttributes,
})

Implementation

Paragraph({
  required List<Line> lines,
  required this.type,
  this.blockAttributes,
})  : _lines = List<Line>.from(lines),
      id = nanoid(8),
      _sealed = type == ParagraphType.block
          ? true
          : lines.isNotEmpty && lines.length == 1 && lines.first.isNotEmpty
              ? lines.first.length > 1
                  ? false
                  : lines.single.isNewLine || lines.single.isEmbedFragment
              : false;