Skip to content

Commit

Permalink
V0.0.11
Browse files Browse the repository at this point in the history
  • Loading branch information
alexjg committed Apr 24, 2024
1 parent 4084e2b commit 04cc635
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
## 0.0.11

* Setting up the plugin now just requires that you create an
`automergeSyncPlugin` and pass it the `handle` and `path`. I.e. you go from
this:

```typescript
const doc = handle.docSync()
const source = doc.text // this should use path
const plugin = amgPlugin(doc, path)
const semaphore = new PatchSemaphore(plugin)
const view = (editorRoot.current = new EditorView({
doc: source,
extensions: [basicSetup, plugin],
dispatch(transaction) {
view.update([transaction])
semaphore.reconcile(handle, view)
},
parent: containerRef.current,
}))

const handleChange = ({ doc, patchInfo }) => {
semaphore.reconcile(handle, view)
}
```

To this

```typescript
const view = new EditorView({
doc: handle.docSync()!.text,
extensions: [
basicSetup,
automergeSyncPlugin({
handle,
path: ["text"],
}),
],
parent: container,
})
```

0 comments on commit 04cc635

Please sign in to comment.