https://github.com/chee/automerge-monaco
https://github.com/chee/automerge-monaco
Last synced: 7 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/chee/automerge-monaco
- Owner: chee
- Created: 2024-08-15T13:01:47.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-10T01:03:08.000Z (almost 2 years ago)
- Last Synced: 2025-04-11T02:58:59.800Z (about 1 year ago)
- Language: TypeScript
- Size: 22.5 KB
- Stars: 7
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Automerge + Monaco
This plugin adds collaborative editing to
[monaco-editor](https://github.com/microsoft/monaco-editor) using
[`automerge`](https://automerge.org/).
> [!note]
> this is alpha software
## Example
```ts
import {Repo} from "@automerge/automerge-repo"
import automonaco from "automerge-monaco"
// set up a repo and create a doc handle.
// see https://automerge.org/docs/quickstart/
let repo = new Repo(..)
let doc = repo.create({code: ""})
// set up monaco
let monaco = await loader.init()
let container = document.getElementById("editor")!
// from "monaco-editor" or "@monaco-editor/loader" etc
let editor = monaco.editor.create(container, {
value: handle.doc()?.code,
language: "javascript",
automaticLayout: true,
})
automonaco(editor, handle, ["code"])
```