apply method
Implementation
Delta apply(RuleType ruleType, Document document, int index,
{int? len, Object? data, Attribute? attribute}) {
final delta = document.toDelta();
for (final rule in _customRules + _rules) {
if (rule.type != ruleType) {
continue;
}
try {
final result = rule.apply(delta, index,
len: len, data: data, attribute: attribute);
if (result != null) {
return result..trim();
}
} catch (e) {
rethrow;
}
}
throw 'Apply rules failed';
}