hrefEdgeCaseAttributes method
Implementation
dom.Element? hrefEdgeCaseAttributes(
String text,
Attributes attributes,
) {
final href = attributes[AppFlowyRichTextKeys.href];
if (href == null) {
return null;
}
final element = dom.Element.tag(HTMLTags.anchor)..attributes['href'] = href;
dom.Element? newElement;
dom.Element? nestedElement;
for (final entry in attributes.entries) {
final key = entry.key;
final value = entry.value;
if (key == AppFlowyRichTextKeys.href) {
continue;
}
final appendElement = convertSingleAttributeTextInsertToDomNode(
newElement == null ? text : '',
{key: value},
);
if (newElement == null) {
newElement = appendElement;
} else {
nestedElement = appendElement..append(newElement);
newElement = nestedElement;
}
}
if (newElement != null) {
element.append(newElement);
}
return element;
}