File tree Expand file tree Collapse file tree 1 file changed +36
-1
lines changed Expand file tree Collapse file tree 1 file changed +36
-1
lines changed Original file line number Diff line number Diff line change 1
- # loro-prosemirror
1
+ # Prosemirror Binding for Loro
2
+
3
+ - Sync document state with Loro
4
+ - Sync cursors with Loro's Awareness and [ Cursor] ( https://loro.dev/docs/tutorial/cursor )
5
+ - Undo/Redo in collaborative editing
6
+
7
+ ``` ts
8
+ import {
9
+ CursorAwareness ,
10
+ LoroCursorPlugin ,
11
+ LoroSyncPlugin ,
12
+ LoroUndoPlugin ,
13
+ undo ,
14
+ redo ,
15
+ } from " loro-prosemirror" ;
16
+ import { Loro } from " loro-crdt" ;
17
+
18
+ const doc = new Loro ();
19
+ const awareness = new CursorAwareness (doc .peerIdStr );
20
+ const plugins = [
21
+ ... pmPlugins ,
22
+ LoroSyncPlugin ({ doc }),
23
+ LoroUndoPlugin ({ doc }),
24
+ keymap ({
25
+ " Mod-z" : state => undo (state , () => {}),
26
+ " Mod-y" : state => redo (state , () => {}),
27
+ " Mod-Shift-z" : state => redo (state , () => {}),
28
+ }),
29
+ LoroCursorPlugin (awareness , {}),
30
+ ];
31
+ const editor = new EditorView (editorDom , {
32
+ state: EditorState .create ({ doc , plugins }),
33
+ });
34
+ ```
35
+
36
+
You can’t perform that action at this time.
0 commit comments