prepareFromExtension method
StyledElement
prepareFromExtension(
- ExtensionContext extensionContext,
- List<
StyledElement> children, { - Set<
HtmlExtension> extensionsToIgnore = const {},
Prepares the html node using one of the built-ins or HtmlExtensions available. If none of the extensions matches, returns an EmptyContentElement
Implementation
StyledElement prepareFromExtension(
ExtensionContext extensionContext,
List<StyledElement> children, {
Set<HtmlExtension> extensionsToIgnore = const {},
}) {
// Loop through every extension and see if it can handle this node
for (final extension in extensions) {
if (!extensionsToIgnore.contains(extension) &&
extension.matches(extensionContext)) {
return extension.prepare(extensionContext, children);
}
}
// Loop through built in elements and see if they can handle this node.
for (final builtIn in builtIns) {
if (!extensionsToIgnore.contains(builtIn) &&
builtIn.matches(extensionContext)) {
return builtIn.prepare(extensionContext, children);
}
}
// If no extension or built-in matches, then return an empty content element.
return EmptyContentElement(node: extensionContext.node);
}