Hello! I see different examples in the documentation where you can import with either of the following:
This in majority of the documentation:
import {EditorView} from "@codemirror/view"
and this from the Rollup example:
import {EditorView, basicSetup} from "codemirror"
Which way would be the recommended or proper way to import?
Thank you!
Hmm… I may have answered my own question after looking at it again. Just wanted to confirm, EditorView
can be available through @codemirror
… However, EditorState
will be required to be imported from @codemirror/state
. Is this right?
Right. "codemirror"
only has 3 exports. It re-exports EditorView
so you can set up a trivial editor without touching any other packages, but for almost everything beyond that, you’ll need to use additional stuff that isn’t exported from "codemirror"
. So for EditorView
you can pick two packages, and it doesn’t matter much which you use. For everything else, there’s a specific package to import from.
1 Like