facebookarchive / draft-js

A React framework for building text editors.
https://draftjs.org/
MIT License
22.57k stars 2.64k forks source link

Editing decorated components causes random characters to be added #691

Open nishp1 opened 8 years ago

nishp1 commented 8 years ago

Do you want to request a feature or report a bug? Bug

What is the current behavior? Editing decorated components causes random characters to show. I have pin pointed the issue to occur after https://github.com/facebook/draft-js/blob/master/src/component/handlers/edit/editOnInput.js#L73 where domText === modelText condition is not met. When going from 21 characters to 22, it appears that the component isn't getting updating properly causing the condition to fail and the attempt to fix the DOM state is what causes seemly random characters to show.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. You can use this jsfiddle to get started: http://react.jsbin.com/fikadeliva/1/edit?js,output

What is the expected behavior? Users should be able to edit decorated components as expected.

Which versions of Draft.js, and which browser / OS are affected by this issue? Did this work in previous versions of Draft.js? Current version is 0.9.1. Affect all OS.

jurrchen commented 5 years ago

I'm seeing this behavior as well. Any update on fix/workaround for this?

nishp1 commented 5 years ago

I've a PR up https://github.com/facebook/draft-js/pull/843.