RichTextEditor image upload (Cannot read properties of null (reading 'index'))
See original GitHub issueWhat package has an issue
Describe the bug
- Wrap react app in a Strict Mode component.
- Add a RichTextEditor component.
- Add an image via the embed image icon in the toolbar:
- You should see the error
Cannot read properties of null (reading 'index')
Drag/drop works, pasting works, just the toolbar is causing this error (when wrapped in <StrictMode>
).
In which browser did the problem occur
Chrome
If possible, please include a link to a codesandbox with the reproduced problem
https://codesandbox.io/s/bold-field-ilkjez?file=/src/App.js
Do you know how to fix the issue
No
Are you willing to participate in fixing this issue and create a pull request with the fix
No response
Possible fix
Looks like this.range is reset in the ImageUploader in strict mode.
I could be wrong (and I haven’t tested this) but I think we might want to set the range here via this.range = this.quill.getSelection();
.
Issue Analytics
- State:
- Created a year ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Ask Question
TypeError : Cannot read properties of null (reading 'index'). I'm using the code given in official documentation here.
Read more >Rich text editor is throwing error in AEM 6.4 when...
Error message - Uncaught (in promise) TypeError: Cannot read properties of null (reading 'data') - http://localhost:4502/libs/cq/gui/components/ ...
Read more >Cannot read property 'querySelector' of null for rich text ...
Forum Thread - Cannot read property 'querySelector' of null for rich text editor when i resizing the screen. - Angular - EJ 2....
Read more >Rich text editor
Quill based rich text editor. ... experience the following error if strict mode is enabled: TypeError: Cannot read properties of null (reading 'index')...
Read more >Building A Rich Text Editor (WYSIWYG)
Let's build a rich text, WYSIWYG-editor that supports rich text, images, links and some nuanced features from word processing apps.
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
The issue happens only in with react strict mode, disable strict mode to fix it. The issue cannot currently be resolved on library side.
I’m seeing it on lists too. But it is fixed with images, just make sure you’re using at least version 4.2.7
But everything else is fine. What do you mean when you say “almost all of the toolbar button”? I’m also seeing the “index is null” error, and not “addRange()”. Could we be talking about different issues?