FluentDocument constructor
FluentDocument({
- Root? content,
Implementation
FluentDocument({Root? content}) {
_content = content ?? Root(nodes: [Paragraph(text: "")]);
// Initialize cursor to point to first paragraph
_cursor.document = this;
if (_content.nodes.isNotEmpty) {
final firstNode = _content.nodes.first;
if (firstNode is Paragraph && firstNode.fragments.isNotEmpty) {
final firstFrag = firstNode.fragments.first;
if (firstFrag is Fragment) {
_cursor.moveTo(firstFrag.id, 0);
}
}
}
}