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

onChange event handler is not called after Ctrl+V or Ctrl+Z pressed

Open artyom-88 opened this issue 3 years ago • 0 comments

"react-simplemde-editor": "5.0.2",

<SimpleMDEReact onChange={onChange} options={options} value={value || ''} />

Case 1:

  1. Enter some value.
  2. onChange handler is called.
  3. Press Ctrl + Z.
  4. onChange handler is not called.

Case 2:

  1. Copy some text value from anywhere.
  2. Press Ctrl + V in the editor.
  3. onChange handler is not called.

If I pass events object to the editor. Both cases work fine:

  const events = useMemo<SimpleMdeToCodemirrorEvents>(
    () => ({
      change: (editor: Editor) => {
        onChange(editor.getValue());
      },
    }),
    [onChange]
  );

<SimpleMDEReact events={events} options={options} value={value || ''} />

artyom-88 avatar Feb 22 '22 10:02 artyom-88