React-draft-wysiwyg: Getting error "Cannot read property 'focus' of undefined" in console

Created on 4 Jul 2017  路  7Comments  路  Source: jpuri/react-draft-wysiwyg

image
Whenever I click on the editor, this error appears in console. Because of this error, the page becomes unscrollable and other buttons stop responding to clicks. Please help fix this bug.
My Editor component:
<Editor hashtag={{}} editorState={this.state.questionEditorState} toolbarClassName="demo-toolbar" wrapperClassName="demo-wrapper" editorClassName="demo-editor" onEditorStateChange={this.handleQuestionChange} />

All 7 comments

Ah I am sorry,

Though it works well in the docs: https://jpuri.github.io/react-draft-wysiwyg/#/
which version of editor are you using ?

Is this still an issue ?

It started working fine when I re installed the package. Thank you.

This is still an issue

Still an issue

The same problem for me. Has anyone found a solution?

I've noticed that the error appears in the console when the editor calls the HOC:

export class EditableWYSIWYG extends Component {
    // some code here...
    render() {
        const { buildEditor } = this.props;
        return <div>{buildEditor(this.state.value, this.onChange)}</div>
    }
}

And that is how I use it:

 <EditableWYSIWYG
     value={someString}
     onDone={onDoneFunction}
     buildComponent={(value, onChange) => {
         return (
             <Editor
                onEditorStateChange={onChange}
                editorState={getInitialEditorState(value)}
              />
        )
    }}
/>

I use the following packages:
on node 9.11.1 (npm 6.13.0)

"react": "^15.5.4",
"react-dom": "15.5.4",
"react-draft-wysiwyg": "^1.14.0",
"draft-js": "^0.10.5",
"draftjs-to-html": "^0.8.4",
"html-to-draftjs": "^1.4.0",

@jpuri Could you provide me with the solution to this problem please?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

trongbang86 picture trongbang86  路  3Comments

Fireprufe15 picture Fireprufe15  路  4Comments

volkandkaya picture volkandkaya  路  3Comments

MaDejing picture MaDejing  路  3Comments

sontek picture sontek  路  4Comments