Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

React Draft Wysiwyg typescript

import Draft, { htmlToDraft, draftToHtml, EmptyState, rawToDraft, draftToRaw , draftStateToHTML} from 'react-wysiwyg-typescript' state = {    editorState: htmlToDraft('Your html contents') // or use an EmptyState} <Draft    editorState={this.state.editorState}    onEditorStateChange={(editorState) => { 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) 
Source by www.npmjs.com #
 
PREVIOUS NEXT
Tagged: #React #Draft #Wysiwyg #typescript
ADD COMMENT
Topic
Name
5+9 =