Closed dzeno closed 8 years ago
Is the richButtonsPlugin prop that you are passing an array?
I'd guess plugins={richButtonsPlugin}
needs to be plugins={[richButtonsPlugin]}
.
@hasSean is correct about the prop needing to be an array in your example, although getting that wrong should trigger a different error.
On a hunch, I was able to obtain the error you listed by using the Editor component from the base draft-js library instead of the draft-js-plugins library. Use the latter (follow the examples in this repo) and I think that will solve it for you.
I have this error with draft-js-plugins-editor beta when typing return. When I only pass blockBreakout :
const plugins = [blockBreakoutPlugin];
there is no error when I type enter. But, when I add
const plugins = [blockBreakoutPlugin, richButtonsPlugin];
I have an error:
TypeError: getEditorState is not a function
at Object.handleKeyCommand
Please elaborate about this error
Thanks - this was a consequence of a key handling change made in the latest draft-js
, which also was just recently moved into draft-js-plugins
as of version rc1. I've updated (published as v.2.1.0) to fix this, let me know if you still have any problems.
I'm still facing this issue. "draft-js-richbuttons-plugin": "^2.2.0"
and "@draft-js-plugins/editor": "^4.1.0"
I get this error when trying to apply formatting (clicking the icon):
this.getEditorState is not a function
Here is how initialize editor:
<Editor editorState={this.props.editorState} onChange={this.onChange} handleKeyCommand={this.handleKeyCommand} handleReturn={this.handleReturn} keyBindingFn={myKeyBindingFn} spellCheck={'true'} ref="editor" plugins={richButtonsPlugin} />