📅  最后修改于: 2022-03-11 14:48:18.779000             🧑  作者: Mango
import Draft, { htmlToDraft, draftToHtml, EmptyState, rawToDraft, draftToRaw , draftStateToHTML} from 'react-wysiwyg-typescript' state = { editorState: htmlToDraft('Your html contents') // or use an EmptyState} { this.setState({ editorState }) }}/> // save html to server const html = draftToHtml(content) // convert raw to draft const toDraft = rawToDraft(content) // convert draft to raw const toRaw = draftToRaw(content) // convert rawToDraft file to HTML const toHTML = draftStateToHTML(content)