scttcper / ngx-codemirror

Codemirror Wrapper for Angular
https://ngx-codemirror.vercel.app
MIT License
282 stars 47 forks source link

How to use EditorView from codemirror/view with ngx-codemirror #325

Open Uterr opened 11 months ago

Uterr commented 11 months ago

Codemirror documentation shows a way to create view:

let myView = new EditorView({ doc: '', extensions: [placeholders], parent: document.body })

In this example there is a way to use extensions, but does ngx-codemirror allows to pass extensions? Or is there any way to attach extensions?

scttcper commented 11 months ago

What have you tried?

Uterr commented 11 months ago

I am talking about this reference: https://codemirror.net/docs/ref/ first example.

I tried to attach to existing ngx-codemirro by passing existing native element to EditorView constructor new EditorView({ parent: existingCodemirror }) that I got from template from existing ngx-codemirror element with viewChild, but that did nothing

scttcper commented 11 months ago

make sure you're looking at the right v5 docs https://codemirror.net/5/

nzbin commented 6 months ago

I have created a CodeMirror 6 wrapper for Angular, please have a try. https://github.com/acrodata/code-editor