0

I use draft-js-export-html and draft-js-import-html to export and import my HTML content to editor.

But when I try to export HTML by stateToHTML function, it also remove all my HTML div content.

Anyone know solution to keep div tag content when export from contentState and import HTML with div tag content to contentState?

onChange(newState) {
    this.setState({editorState: newState});

    if (typeof this.props.onChange != "undefined") {
        let contentState = newState.getCurrentContent();
        let plainText = contentState.getPlainText();
        let htmlContent = stateToHTML(contentState, options); 

        console.log("after", htmlContent);
    }
}
Tuan Nguyen
  • 151
  • 1
  • 5
  • Including code snippets might get you more attention. – daft300punk Mar 29 '17 at 03:42
  • `onChange(newState) { this.setState({editorState: newState}); if (typeof this.props.onChange != "undefined") { let contentState = newState.getCurrentContent(); let plainText = contentState.getPlainText(); let htmlContent = stateToHTML(contentState, options); console.log("after", htmlContent); } } ` My code is simple, I just want **htmlContent** has enough content with div tag inside. – Tuan Nguyen Mar 29 '17 at 03:53

0 Answers0