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

extraKeys can not add 'Enter' key

Open kongchenglc opened this issue 3 years ago • 1 comments

import SimpleMdeReact from 'react-simplemde-editor'

...

    <SimpleMdeReact
      value={value}
      onChange={onChange}
      options={options}
      getCodemirrorInstance={getCmInstanceCallback}
      getLineAndCursor={getLineAndCursorCallback}
      events={eventsHandlers}
      extraKeys={{
            Enter: ()=>{} // it is useless
      }}
    />
...

kongchenglc avatar Dec 17 '21 07:12 kongchenglc

I experienced the same issue. I was able to work around it via events.

 <SimpleMDE
     events={{
         keyHandled: (editor, event) => {
             if (event == 'Enter') {
                 console.log('Enter pressed');
             }
         },
     }}
 />

coltenkrauter avatar Dec 28 '21 06:12 coltenkrauter

I guess 'codemmirror.getoption ("extraKeys")' overrides the 'Enter' key in the extraKeys. I'm not sure that's a problem.

image

ChesterZengJian avatar Sep 09 '22 05:09 ChesterZengJian

Almost a year passed lol. Fixed this one in 5.1.1 already.

RIP21 avatar Oct 01 '22 23:10 RIP21

Thanks!

coltenkrauter avatar Oct 11 '22 02:10 coltenkrauter