react, jsx:
componentDidMount () {
this.initEditor()
}
initEditor = () => {
this.editor = new Simditor({
textarea: this.textArea,
markdown: true,
toolbar: ['title', 'bold', 'italic', 'underline', 'code', 'blockquote', '|', 'ol', 'ul', '|', 'markdown']
})
this.editor.setValue(marked(this.props.content))
this.editor.on('valuechanged', (e, src) => {
this.props.onTextChange(toMarkdown(this.editor.getValue()))
})
}
Tag:
<textarea ref={textarea => (this.textArea = textarea)} />
慕尼黑8549860
相关分类