Angular: v.13
Codemirror: v.6
I wrote my initialize editor code in ngAfterViewInit() method:
ngAfterViewInit(): void {
let myEditorElement = this.editor.nativeElement;
const basicExtensions = [basicSetup, javascript(), keymap.of([...defaultKeymap, ...standardKeymap])];
let state!: EditorState;
try {
state = EditorState.create({
doc: 'console.log("hello from codemirror");\n// type if.',
extensions: basicExtensions,
});
} catch (e) {
console.error(e);
}
let view = new EditorView({
state,
parent: myEditorElement,
});
}
But Backspace and some other combinations don’t work as expected.
My package.json:
"@codemirror/commands": "6.2.1",
"@codemirror/lang-javascript": "6.1.4",
"@codemirror/language": "6.6.0",
"@codemirror/state": "6.2.0",
"@codemirror/theme-one-dark": "6.1.0",
"@codemirror/view": "6.9.0",
"codemirror": "6.0.1",