tiptap/docs/src/docPages/api/extensions/collaboration-cursor.md

43 lines
2.5 KiB
Markdown
Raw Normal View History

2020-11-06 18:37:30 +08:00
# CollaborationCursor
This extension adds information about all connected users (like their name and a specified color), their current cursor position and their text selection (if theres one).
2020-09-26 17:36:43 +08:00
Open this page in multiple browser windows to test it.
2020-12-04 00:23:54 +08:00
:::pro Pro Extension
2020-12-01 19:03:50 +08:00
We kindly ask you to [sponsor our work](/sponsor) when using this extension in production.
:::
::: warning Use with Collaboration
This extension requires the [`Collaboration`](/api/extensions/collaboration) extension.
:::
## Installation
```bash
2020-10-30 21:24:16 +08:00
# with npm
npm install @tiptap/extension-collaboration-cursor
2020-10-30 21:24:16 +08:00
# with Yarn
yarn add @tiptap/extension-collaboration-cursor
```
## Settings
2020-12-01 19:03:50 +08:00
| Option | Type | Default | Description |
| -------- | ---------- | ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| provider | `Object` | `null` | A Y.js network connection, for example a [y-websocket](https://github.com/yjs/y-websocket) instance. |
| user | `Object` | `{ user: null, color: null }` | Attributes of the current user, assumes to have a name and a color, but can be used with any attribute. |
| render | `Function` | … | A render function for the cursor, look at [the extension source code](https://github.com/ueberdosis/tiptap-next/blob/main/packages/extension-collaboration-cursor/) for an example. |
## Commands
2020-12-04 00:05:22 +08:00
| Command | Parameters | Description |
| ------- | ---------- | ------------------------------------------------------------------------------------------------ |
| user | attributes | An object with the attributes of the current user, by default it expects a `name` and a `color`. |
## Source code
[packages/extension-collaboration-cursor/](https://github.com/ueberdosis/tiptap-next/blob/main/packages/extension-collaboration-cursor/)
## Usage
:::warning Public
The content of this editor is shared with other users.
:::
2020-12-01 19:03:50 +08:00
<demo name="Extensions/CollaborationCursor" highlight="11,38-44" />