raphasilvac / react-simple-contenteditable

A simple contenteditable component
27 stars 3 forks source link

Passing blank string as the inner HTML causes contentEditable not to update #9

Open Nantris opened 5 years ago

Nantris commented 5 years ago

The code goes through all the motions and dangerously sets innerHTML to be the blank string, "", but the old content remains what is rendered.

Nantris commented 5 years ago

There's two cases:

  1. Set the contents programmatically to have some text, and then to be an empty string. The end result will properly be blank
  2. Modify the contents by typing, and then programmatically set the contents to be an empty string. The end result will remain whatever value was entered, and the programmatic change will not be reflected in the contentEditable