Skip to content

Commit 495a461

Browse files
committed
Add a usage section to readme
1 parent 4e47f5c commit 495a461

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,22 @@ We aim to be an inclusive, welcoming community. To make that explicit,
1616
we have a [code of
1717
conduct](http://contributor-covenant.org/version/1/1/0/) that applies
1818
to communication around the project.
19+
20+
## Usage
21+
22+
```javascript
23+
import {EditorView} from "@codemirror/view"
24+
import {basicSetup} from "codemirror"
25+
26+
const view = new EditorView({
27+
parent: document.querySelector("#some-node"),
28+
doc: "Content text",
29+
extensions: [basicSetup /* ... */]
30+
})
31+
```
32+
33+
Add additional extensions, such as a [language
34+
mode](https://codemirror.net/#languages), to configure the editor.
35+
Call
36+
[`view.dispatch`](https://codemirror.net/docs/ref/#view.EditorView.dispatch)
37+
to update the editor's state.

0 commit comments

Comments
 (0)