-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}) | ||
``` | ||
|