react-contenteditable icon indicating copy to clipboard operation
react-contenteditable copied to clipboard

Passing a new className prop will move the caret position to the end of the element

Open nicolasmendonca opened this issue 4 years ago • 2 comments

Current behavior

When the html prop is not updated, but the className prop is, then the caret position will move to the end of the element.

Desired behavior

Changing a className should leave the caret position as it is.

nicolasmendonca avatar Mar 30 '20 19:03 nicolasmendonca

I was able to fix this by removing the following line (not too sure of the consequences of this but its working fine for me) https://github.com/lovasoa/react-contenteditable/blob/f4d81dd974c26f23b432f16d2521362c8e6cfb2e/src/react-contenteditable.tsx#L93

ajhenry avatar Apr 19 '20 21:04 ajhenry

I forked the repo and did the same thing! But I wasn't sure of the consequences either...

Thanks for helping out!

nicolasmendonca avatar Apr 20 '20 11:04 nicolasmendonca