getBlock method

BaseBlock getBlock(
  1. BaseBlock block,
  2. List<BasePlugin> plugins
)

get block from plugins' rendering map If no match, then use default

Implementation

BaseBlock getBlock(BaseBlock block, List<BasePlugin> plugins) {
  for (var plugin in plugins) {
    for (var style in block.inlineStyles) {
      if (plugin.inlineStyleRenderFn?.containsKey(style) ?? false) {
        return plugin.inlineStyleRenderFn![style]!.copyWith(block: block);
      }
    }
    for (var entity in block.entityTypes) {
      if (plugin.entityRenderFn?.containsKey(entity) ?? false) {
        return plugin.entityRenderFn![entity]!.copyWith(block: block);
      }
    }
  }

  return block;
}