UNPKG

substance

Version:

Substance is a JavaScript library for web-based content editing. It provides building blocks for realizing custom text editors and web-based publishing systems.

15 lines (13 loc) 439 B
import error from './error' export default function renderNode($$, component, node) { var componentRegistry = component.context.componentRegistry || component.props.componentRegistry var ComponentClass = componentRegistry.get(node.type) if (!ComponentClass) { error('Could not resolve a component for type: ' + node.type) return $$('div') } return $$(ComponentClass, { node: node, doc: node.getDocument() }) }