Skip to content

Commit a5ae8d2

Browse files
committed
Tiptap Demo v2 (cursors)
1 parent cf9e0ec commit a5ae8d2

File tree

1 file changed

+9
-0
lines changed
  • apps/javascript/crdt/text-editors/tiptap/tiptap-crdt-demo/src/components/document

1 file changed

+9
-0
lines changed

apps/javascript/crdt/text-editors/tiptap/tiptap-crdt-demo/src/components/document/tiptap.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import StarterKit from '@tiptap/starter-kit';
99
import TextAlign from '@tiptap/extension-text-align';
1010
import Underline from '@tiptap/extension-underline';
1111
import BubbleMenu from '@tiptap/extension-bubble-menu';
12+
import CollaborationCaret from '@tiptap/extension-collaboration-caret';
1213
import { Mark, mergeAttributes } from '@tiptap/core';
1314
import { createVeltTipTapStore } from '@veltdev/tiptap-crdt';
1415

@@ -356,6 +357,14 @@ export async function createTipTapEditor(container, veltClient, editorId, user)
356357
}),
357358
// [Velt] Get the collaboration extension from the store
358359
store.getCollabExtension(),
360+
// [Velt] Add collaboration caret to show other users' cursors
361+
CollaborationCaret.configure({
362+
provider: store.getStore().getProvider(),
363+
user: {
364+
name: user?.name || 'Anonymous',
365+
color: user?.color || '#' + Math.floor(Math.random() * 16777215).toString(16).padStart(6, '0'),
366+
},
367+
}),
359368
];
360369

361370
// Debug: Check what's in the Yjs document

0 commit comments

Comments
 (0)