jpuri / react-draft-wysiwyg

A Wysiwyg editor build on top of ReactJS and DraftJS. https://jpuri.github.io/react-draft-wysiwyg
MIT License
6.42k stars 1.16k forks source link

Editor unusable after deleting paragraph under an image #987

Open LukasBlu1 opened 4 years ago

LukasBlu1 commented 4 years ago

Hello @jpuri,

I really like your work, it's very helpful, thanks for that. I found a bug that appears after inserting and deleting a text right under an image.

Steps to reproduce:

  1. Insert an image
  2. Insert text right under
  3. Delete the text one backspace per character
  4. Type in one more backspace than the last character
  5. Typing isnt possible anymore

This is a video shows the process including pressed characters. https://streamable.com/t5zyi3

I am sure you will have a fast solution, for me it was not that easy.

Thanks in advance

Best regards Lukas

mrjones2014 commented 4 years ago

@jpuri I'm able to reproduce. This should be a high priority issue.

mrjones2014 commented 4 years ago

@LukasBlu1 were you able to work around this on your end? I'm experiencing the same issue and I need to fix it.

LukasBlu1 commented 4 years ago

@mrjones2014 I'm sorry. I haven't fixed it yet.

mrjones2014 commented 4 years ago

I had to drop the package and use something else.

weita0 commented 3 years ago

I've met the same issue

kasterlod commented 3 years ago

This is an issue related with draft-js, please add this handler to Editor component:

import { RichUtils } from "draft-js"
(...)
<Editor
...
 handleKeyCommand={(command) => {
        const newState = RichUtils.handleKeyCommand(editorState, command)

        if (newState) {
          onEditorStateChange(newState)
          return "handled"
        }

        return "not-handled"
      }}
/>