linkToOp method

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

Converts a link HTML element (<a>) to Delta operations.

Implementation

@override
List<Operation> linkToOp(dom.Element element) {
  final Delta delta = Delta();
  Map<String, dynamic> attributes = {};

  if (element.attributes.containsKey('href')) {
    attributes['link'] = element.attributes['href'];
  }

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

  return delta.toList();
}