Skip to content

Commit

Permalink
docs: add ready event to README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
SomaticIT committed Feb 27, 2024
1 parent ac3ac6c commit 19aa488
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@ To use `svelte-codemirror-editor`, you need to import the package and use it as

## Events

| Event | Type | Description |
| -------- | -------- | ----------------------------- |
| `change` | `string` | Trigger when the code changes |
| Event | Type | Description |
| -------- | ------------ | ------------------------------------------------------------------------------- |
| `change` | `string` | Trigger when the code changes. |
| `ready` | `EditorView` | Trigger when the editor is ready. Allows to retrieve the `EditorView` instance. |

## Usage with vite / svelte-kit

Expand Down Expand Up @@ -118,6 +119,17 @@ const config = {
/>
```

### Get EditorView instance

```svelte
<script lang="ts">
import CodeMirror from "svelte-codemirror-editor";
let view: EditorView;
</script>
<CodeMirror on:ready={(e) => view = e.detail} />
```

## License

[MIT](LICENSE)

0 comments on commit 19aa488

Please sign in to comment.