React-draft-wysiwyg: Image html can not delete.

Created on 7 Oct 2017  路  7Comments  路  Source: jpuri/react-draft-wysiwyg

The way to reproduce:

  1. make sure the editor is empty
  2. add a Image
  3. move curse to the front of Image
  4. press Delete on keyboard
  5. check the output of html

you can see the Img tag still in the html, and it now shown in the editor

Most helpful comment

I had isuues as well . @jpuri

All 7 comments

I think this problem is very important

I had similar issue
using editor No. 1 on demo page, I have had two issues:

1) Backspace Style:

Add text and image so that you get...

<p>asdf</p>
<img src="[SRC]" alt="undefined" style="float:none;height: auto;width: auto"/>
<p>asdf</p>

Then with your cursor at the very end press backspace/delete 4 times until you remove 'asdf', you then have:

<p>asdf</p>
<img src="[SRC]" alt="undefined" style="float:none;height: auto;width: auto"/>
<p></p>

If you want to continue to remove the image it takes pressing backspace/delete 3 more times to actually delete the image, and remove the empty P tag.

2) Delete text to the right style:

Alternatively if you setup the editor in the same way as the first part of part 1,

<p>asdf</p>
<img src="[SRC]" alt="undefined" style="float:none;height: auto;width: auto"/>
<p>asdf</p>

but then put the cursor at the end of the FIRST 'asdf', and press 'Windows Delete'/'Mac FN-Delete', after the first delete, the image will disappear from the editor, but will still be in the html as part of the first p tag...

<p>asdf<img src="[SRC]" alt="undefined" style="float:none;height: auto;width: auto"/></p>
<p>asdf</p>

It then requires a second press of the FN-Delete to actually remove the image tag and give the expected:

<p>asdf</p>
<p>asdf</p>

Hopefully that was clear.

Same here, in 2018.

Some plans to fix it in near future? Any workaround?
Maybe @tgus suggestion? https://github.com/jpuri/react-draft-wysiwyg/issues/600.

Thank you.

I've added a pull request with a optional button to remove the image. Thanks to @tgus idea.
PR: https://github.com/jpuri/react-draft-wysiwyg/pull/629

I had isuues as well . @jpuri

please fix this serious problem

@jpuri process the pull request, please, #629. It will resolve the problem completely.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

trongbang86 picture trongbang86  路  3Comments

Satherial picture Satherial  路  4Comments

Huespal picture Huespal  路  3Comments

DiegoGallegos4 picture DiegoGallegos4  路  4Comments

Leadrive picture Leadrive  路  3Comments