codeblockToOp method

  1. @override
List<Operation> codeblockToOp(
  1. Element element
)
override

Converts a code block HTML element (<pre>) to Delta operations.

Implementation

@override
List<Operation> codeblockToOp(dom.Element element) {
  final Delta delta = Delta();
  Map<String, dynamic> blockAttributes = {'code-block': true};

  for (final node in element.nodes) {
    processNode(node, {}, delta);
  }

  delta.insert('\n', blockAttributes);

  return delta.toList();
}