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);
    }
}
4

0 回答 0