applyRule method
Applies heuristic rule to an operation on a document
and returns
resulting Delta.
Implementation
@override
Delta? applyRule(
Document document,
int index, {
int? len,
Object? data,
Attribute? attribute,
}) {
if (attribute == null || attribute.key != Attribute.style.key) {
return null;
}
assert(len == 1 && data == null);
final delta = Delta()
..retain(index)
..retain(1, attribute.toJson());
return delta;
}