Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

editorState.getCurrentContent is not a function #202

Open
invious opened this issue Nov 16, 2019 · 3 comments
Open

editorState.getCurrentContent is not a function #202

invious opened this issue Nov 16, 2019 · 3 comments

Comments

@invious
Copy link

invious commented Nov 16, 2019

import {stateFromHTML} from 'draft-js-import-html';


class RichEditor extends React.Component {
    constructor({article}) {
        console.log(article)
        super(article);
        this.state = {editorState: EditorState.createEmpty()};
        console.log(article)
        if (article){
            this.setState(stateFromHTML(article.body));
        }

image

@matiishyn
Copy link

same issue here

@raymond-ong
Copy link

raymond-ong commented Feb 23, 2020

Initially, i ran to this prob too.
I realized i should call stateFromHTML from inside EditorState.createWithContent()

EditorState.createWithContent(stateFromHTML("<div><h1>I'm an H1 Tag</h1></div>"))

@paperkotter
Copy link

@raymond-ong thanks it works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants