import elements from '~/elements' ; import { IElement } from '~/elements/BaseElement' ; import { getContext } from '~/context' ; export default function createElement ( elementType , props ) { const { parserOptions } = getContext ( ) ; const Element = elements [ elementType ] ; if ( ! Element ) throw new Error ( `unknown element of type '${ elementType }'` ) ; return new Element ( props , parserOptions ) ; }