You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/library/api/collaboration.md
+19-2Lines changed: 19 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,9 +30,26 @@ Any Yjs-compatible transport works. The standalone server uses a custom WebSocke
30
30
-[`y-indexeddb`](https://github.com/yjs/y-indexeddb) for offline persistence (layered alongside any other transport)
31
31
- Any HTTP/3 stream or BroadcastChannel if your room is browser-local
32
32
33
-
## Awareness (cursors, selections)
33
+
## Awareness (cursors, selections, follow)
34
34
35
-
Awareness state — who's online, where their cursor is, what they have selected — rides on the same channel as document updates. The editor manages awareness internally; you don't need to wire anything beyond `sendBroadcastMessage` / `receiveBroadcastedMessage`.
35
+
Awareness state — who's online, where their cursor is, what they have selected, and where their viewport sits — rides on the same channel as document updates. The editor manages awareness internally; you don't need to wire anything beyond `sendBroadcastMessage` / `receiveBroadcastedMessage`.
36
+
37
+
The presence bar, cursors, selection highlights, and viewport-following are toggled per-feature on the `collaboration` option:
38
+
39
+
```ts
40
+
const editor =newApollonEditor(container, {
41
+
collaboration: {
42
+
enabled: true,
43
+
user: { name: "Ada", color: "#1c7ed6" },
44
+
showPresence: true, // avatar bar (top-right)
45
+
showCursors: true, // live remote cursors
46
+
showSelectionHighlights: true, // highlight peers' selected elements
47
+
showFollow: true, // click a peer's avatar to mirror their viewport
48
+
},
49
+
})
50
+
```
51
+
52
+
When `showFollow` is on, clicking a collaborator's avatar follows their viewport. The follower sees the editor framed in that person's color and a banner naming them with a **Stop** button; the followed user sees a "followed by N" badge. Any local pan/zoom hands control back and stops following.
0 commit comments