react-draft-wysiwyg icon indicating copy to clipboard operation
react-draft-wysiwyg copied to clipboard

Getting error "Cannot read property 'focus' of undefined" in console

Open hkedia321 opened this issue 9 years ago • 7 comments

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} />

hkedia321 avatar Jul 04 '17 18:07 hkedia321

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 ?

jpuri avatar Jul 07 '17 17:07 jpuri

Is this still an issue ?

jpuri avatar Jul 14 '17 15:07 jpuri

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

hkedia321 avatar Jul 14 '17 16:07 hkedia321

This is still an issue

sahiljaidka224 avatar Oct 17 '19 05:10 sahiljaidka224

Still an issue

sahiljaidka224 avatar Oct 17 '19 21:10 sahiljaidka224

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

ArtemMaximum avatar Nov 20 '19 10:11 ArtemMaximum

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?

ArtemMaximum avatar Dec 26 '19 18:12 ArtemMaximum