Hi!
I am trying to use the new CodeMirror/next 0.8.0 as a code editor inside Prosemirror. You must already be knowing Prosemirror as it is from the same author. (Great work on both btw!)
I got it to work but the ‘Enter’ and ‘Cmd’ keys are not being recognized. Here is now my extensions look like:
Summary
const key = 'Enter';
return [
lineNumbers(),
highlightSpecialChars(),
history(),
foldGutter(),
multipleSelections(),
defaultHighlighter,
bracketMatching(),
closeBrackets(),
autocomplete(),
rectangularSelection(),
//highlightActiveLine(),
highlightSelectionMatches(),
keymap([
...standardKeymap,
...defaultKeymap,
...searchKeymap,
...historyKeymap,
...foldKeymap,
...commentKeymap,
...gotoLineKeymap,
...autocompleteKeymap,
...lintKeymap,
{
key: key,
mac: key,
linux: key,
//scope: 'editor',
run: vars => {
console.log(' Enter was hit', vars);
return insertNewlineAndIndent(vars);
},
shift: vars => {
console.log(' Enter was hit', vars);
return insertNewlineAndIndent(vars);
},
preventDefault: true,
},
]),
];
I tried a mix and match of all the options in the keymap
but I never hits the key recognizing code in the extension. I am suspecting the kepmap in the extensions is not working in my case. Everything else works.
This is the code I am using from prosemirror, I just changed it from the older Codemirror to the newer one:
Thanks!