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).
23 lines (18 loc) • 523 B
JavaScript
import { TextNodeComponent } from 'substance'
export default class HeadingComponent extends TextNodeComponent {
didMount () {
this.context.editorSession.getEditorState().addObserver(['document'], this.rerender, this, {
stage: 'render',
document: { path: [this.props.node.id] }
})
}
dispose () {
this.context.editorSession.getEditorState().removeObserver(this)
}
getClassNames () {
return 'sc-heading sc-text-node'
}
getTagName () {
return 'h' + this.props.node.level
}
}