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 system. It is developed to power our online editing platform [Substance](http://substance.io).

33 lines (28 loc) 817 B
import { Component, ContainerEditor, createEditorContext } from 'substance' export default class TestEditor extends Component { constructor (...args) { super(...args) let editorSession = this.props.editorSession let config = this.props.config const context = Object.assign(this.context, createEditorContext(config, editorSession, this), { editable: true }) this.context = context } didMount () { this.props.editorSession.setRootComponent(this) this.props.editorSession.initialize() } render ($$) { let doc = this.props.editorSession.getDocument() let body = doc.get('body') let el = $$('div') el.append( $$(ContainerEditor, { containerPath: body.getContentPath(), name: 'body' }).ref('surface') ) return el } }