videoToOp method
Converts a video HTML element (<video>
) to Delta operations.
Implementation
@override
List<Operation> videoToOp(dom.Element element) {
final String? src = element.getAttribute('src');
final String? sourceSrc = element.nodes
.where((node) => node.nodeType == dom.Node.ELEMENT_NODE)
.firstOrNull
?.attributes['src'];
if (src != null && src.isNotEmpty ||
sourceSrc != null && sourceSrc.isNotEmpty) {
return [
Operation.insert({'video': src ?? sourceSrc})
];
}
return [];
}