Editor throws an "Cannot read property 'size' of undefined" error when using custom decorators
See original GitHub issueI’m having a bit of trouble making the editor of draft-js-plugins-editor
work with custom decorators when I use EditorState.createWithContent passing them as a parameter.
When I do that, the editor crashes, throwing a Cannot read property 'size' of undefined
error. You can reproduce the error here: Reproducible example
If you remove the decorators
parameter on line 82 (editorState: EditorState.createWithContent(convertFromRaw(initState)),
), the error does not happen, but the decorators are not applied to the editor.
Am I doing something wrong?
Edit: Looks like the error happens on this line
Issue Analytics
- State:
- Created 6 years ago
- Reactions:11
- Comments:13 (2 by maintainers)
Top Results From Across the Web
Cannot read properties of undefined (reading 'length') - TrackJS
This message indicates that our code expects to have an object with a length property, but that object was not present.
Read more >Cannot read property 'map' of undefined with @Input decorator
I have a child component that receives data via @Input() decorator. My goal is to create a new Object ...
Read more >cannot read properties of undefined (reading 'map') typescript
This error occurs because react-scripts has a direct dependency on the 2.xx range of @typescript-eslint/parser and @typescript-eslint/eslint-plugin . You can ...
Read more >Vue cannot read property of undefined
Originally Answered: how can I resolve a 'cannot read property connect of undefined' error on node js? For better results, provide the relevant...
Read more >48 answers on StackOverflow to the most popular Angular ...
What is the Angular equivalent to an AngularJS $watch? Importing lodash into angular2 + typescript application; How to detect a route change in ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For anyone looking for a workaround, wrap your
CompositeDecorator
with the Draft JS Plugins’MultiDecorator
:@winghouchan @pcsms @juliankrispel reproduced with latest version of draft-js-plugin-editor, will recheck it in the next few days