uiwjs / react-codemirror

CodeMirror 6 component for React. @codemirror https://uiwjs.github.io/react-codemirror/
https://uiwjs.github.io/react-codemirror/
MIT License
1.69k stars 134 forks source link

How to add custom keymap? #563

Closed chenraotg closed 1 year ago

chenraotg commented 1 year ago

I tried to import keymap from @codemirror/view

import { keymap } from '@codemirror/view';
const keymapExtension = keymap.of([
    {
      win: 'Ctrl-Enter',
      mac: 'Cmd-Enter',
      run: () => {
        console.log('Ctrl-Enter');
        return true;
      },
    },
  ]);

<ReactCodeMirror extensions={[keymapExtension]}

but it didn't work...

chenraotg commented 1 year ago

Misdescribe the issue, I just closed it.