react-draft-wysiwyg
react-draft-wysiwyg copied to clipboard
Content does not change after setting the focus on the image
Hello!
Very inspired by your library. Thanks for your work!
I found a bug in the getSelectedBlocksType method in draftjs-utils. The atomic value in the getSelectedBlocksType method is not reset when the focus is lost.
I do the following:
- Upload an image (getSelectedBlocksType == 'unstyled')
- I click on the line with the text (getSelectedBlocksType == 'unstyled')
- I click on the image (getSelectedBlocksType == 'atomic')
- I click on the line with the text (getSelectedBlocksType == 'atomic'). Must be unstyled!
- I click on the area outside the editor
- I click on the line with the text (getSelectedBlocksType == 'unstyled')
After focusing on the image in react-draft-wysiwyg, you cannot edit the text. It helps to lose focus from the editor.
To fix this, you need to remove the check in the condition in the file: react-draft-wysiwyg/src/Editor/index.js: 238-241
if (
!readOnly /* &&
!(
getSelectedBlocksType(editorState) === "atomic" &&
editorState.getSelection().isCollapsed
) */
) {
...
}
But this does not solve the problem fundamentally. The bug is in getSelectedBlocksType in the draftjs-utils library Please make changes to the library
I could reproduce it in my project, too
I'm having the same issue. Finally got around to a working img delete/backspace. This is a problem still.
Any update on this?