facebookarchive / draft-js

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

cursor positon error and decorator broke in IME mode in v0.11.3 #2282

Open luqihao opened 4 years ago

luqihao commented 4 years ago

i am developing an chat editor using draft-js, but it still have some unexpected bugs that i can not deal with

draft-js: v0.11.3

Chromium: 78.0.3904.113

demo online to show these problems: https://codepen.io/luqihao/pen/MWYKMbq

  1. i am using decorator to replace all twemoji, whatever you are typing, pasted or insert emoji text, but the cursor jump to the incorrect position, why? (πŸ˜€πŸ˜„πŸ˜†πŸ˜…)

problem-1

  1. i insert an immutable entity and use a decorator to display a image, and then i typing chinese(IME mode) after this decorator, this decorator will broke and i get the entityMap of null, is so weird?

problem-2

i hope someone can me the solution about these problems

eretica commented 4 years ago

same problem

mrkev commented 4 years ago

Thought I'd have a look at this and I think I've finally figured it out. Will push a fix soon.

luqihao commented 4 years ago

@mrkev I found that the editor in twitter has no these bugs, do you know how twitter to handle these

luqihao commented 4 years ago

Is there any plan to fix this problem? This problem has occurred since upgrade to version 0.11.0,and it is fine in version 0.10.5 @mrkev

luqihao commented 4 years ago

I found the reason is that it uses the mutationObserver since update to v0.11.x @mrkev @claudiopro

akinorimiz commented 3 years ago

I got the same issue and ended up downgrading my draft-js to v0.10.5.