react-medium-editor icon indicating copy to clipboard operation
react-medium-editor copied to clipboard

Cursor jumping issues with medium-editor 5.21.1

Open mpseidel opened this issue 8 years ago • 6 comments

I had issues where typing at the end of a line would lead to a jump of the cursor position to the beginning of the next paragraph using the latest version 5.21.1 of medium-editor.

I tried downgrading react to match the version used in the example with no luck.

Once I downgraded medium-deitor to 5.10.0 as in the example the issue went away.

Could this be the same issue as discussed here? https://github.com/facebook/react/issues/2047

mpseidel avatar Aug 13 '16 12:08 mpseidel

Might https://github.com/wangzuo/react-medium-editor/pull/19 be related?

MartijnHols avatar Aug 23 '16 07:08 MartijnHols

Maybe. I stopped using react-medium-editor because of this and issues with undo. Now using the editor outside of my react root.

mpseidel avatar Aug 23 '16 07:08 mpseidel

As this is almost a year old: are there any news on this?

mmintel avatar May 02 '17 07:05 mmintel

As this is almost 2 years old its there an update on this?

Katyadelarosa avatar Aug 24 '18 22:08 Katyadelarosa

You can prevent this, but you need to use shouldComponentUpdate to prevent re-rendering when content isn't changed. Most basic / stupid approach would be :

  shouldComponentUpdate(nextProps, nextState) {
    if (JSON.stringify(this.props) === JSON.stringify(nextProps) && this.state === nextState)
      return false
    return true
  }

avionbg avatar Dec 09 '18 23:12 avionbg

My fix here.

vadimuz avatar Jul 02 '22 18:07 vadimuz