react-simplemde-editor
react-simplemde-editor copied to clipboard
extraKeys can not add 'Enter' key
import SimpleMdeReact from 'react-simplemde-editor'
...
<SimpleMdeReact
value={value}
onChange={onChange}
options={options}
getCodemirrorInstance={getCmInstanceCallback}
getLineAndCursor={getLineAndCursorCallback}
events={eventsHandlers}
extraKeys={{
Enter: ()=>{} // it is useless
}}
/>
...
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');
}
},
}}
/>
I guess 'codemmirror.getoption ("extraKeys")' overrides the 'Enter' key in the extraKeys. I'm not sure that's a problem.
Almost a year passed lol.
Fixed this one in 5.1.1
already.
Thanks!