Skip to content

Commit 99e6e61

Browse files
committed
Add SuperDoc comments docs
1 parent 53a747e commit 99e6e61

4 files changed

Lines changed: 408 additions & 0 deletions

File tree

api-reference/sdk/api/api-methods.mdx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,32 @@ Checks whether the Velt SDK is loaded on `window.Velt`.
628628
- [Full Documentation →](/async-collaboration/comments/setup/monaco#isveltavailable)
629629

630630

631+
### SuperDoc
632+
633+
#### SuperDocVeltComments
634+
Creates the Velt Comments extension for a SuperDoc editor. Configure it, then call `.attach(instance)` to wire it to an editor.
635+
- Config: [SuperDocVeltCommentsConfig](/api-reference/sdk/models/data-models#superdocveltcommentsconfig)
636+
- Returns: `SuperDocVeltComments`
637+
- React Hook: `n/a`
638+
- [Full Documentation →](/async-collaboration/comments/setup/superdoc#superdocveltcomments)
639+
640+
#### addComment()
641+
Creates a comment annotation for the currently selected text in the SuperDoc editor.
642+
- Signature: `async (args: AddCommentArgs) => Promise<AddCommentResult | null>`
643+
- Params: `args:` [AddCommentArgs](/api-reference/sdk/models/data-models#addcommentargs-1)
644+
- Returns: `Promise<AddCommentResult | null>`
645+
- React Hook: `n/a`
646+
- [Full Documentation →](/async-collaboration/comments/setup/superdoc#addcomment)
647+
648+
#### renderComments()
649+
Renders and updates Velt comment highlights in the SuperDoc editor.
650+
- Signature: `(args:` [RenderCommentsArgs](/api-reference/sdk/models/data-models#rendercommentsargs-1)`) => void`
651+
- Params: `args:` [RenderCommentsArgs](/api-reference/sdk/models/data-models#rendercommentsargs-1)
652+
- Returns: `void`
653+
- React Hook: `n/a`
654+
- [Full Documentation →](/async-collaboration/comments/setup/superdoc#rendercomments)
655+
656+
631657
### Messages
632658

633659
#### addComment()

api-reference/sdk/models/data-models.mdx

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,6 +1251,76 @@ Resolved Monaco anchor data used while synchronizing Velt comment annotations to
12511251
| `multiThreadAnnotationId` | `string` | No | Velt annotation ID associated with the anchor. |
12521252
| `isSelected` | `boolean` | Yes | Whether the anchor is currently selected in Velt. |
12531253

1254+
### SuperDoc
1255+
1256+
#### AddCommentArgs
1257+
1258+
---
1259+
1260+
Request interface for the SuperDoc `addComment()` function.
1261+
1262+
| Property | Type | Required | Description |
1263+
| ---------- | ------------------ | -------- | ----------------------------------- |
1264+
| `instance` | `SuperDocInstance` | Yes | The SuperDoc editor instance. |
1265+
1266+
#### AddCommentResult
1267+
1268+
---
1269+
1270+
Return shape from SuperDoc `addComment()` when the call succeeds. The function returns `null` when no text is selected or Velt is not loaded.
1271+
1272+
| Property | Type | Required | Description |
1273+
| ------------------ | ----------------------------------------- | -------- | --------------------------------------------------- |
1274+
| `veltAnnotationId` | `string` | Yes | The Velt annotation id assigned by the SDK. |
1275+
| `textEditorConfig` | [`TextEditorConfig`](#texteditorconfig-5) | Yes | The durable logical anchor stored on the annotation. |
1276+
1277+
#### RenderCommentsArgs
1278+
1279+
---
1280+
1281+
Request interface for the SuperDoc `renderComments()` function.
1282+
1283+
| Property | Type | Required | Description |
1284+
| -------------------- | ------------------------------------------ | -------- | --------------------------------- |
1285+
| `instance` | `SuperDocInstance` | Yes | The SuperDoc editor instance. |
1286+
| `commentAnnotations` | `CommentAnnotation[] \| null \| undefined` | Yes | Annotations to render/highlight. |
1287+
1288+
For the CommentAnnotation model referenced above, see [CommentAnnotation](#commentannotation).
1289+
1290+
#### SuperDocVeltCommentsConfig
1291+
1292+
---
1293+
1294+
Configuration options for `SuperDocVeltComments.configure()`.
1295+
1296+
| Property | Type | Required | Description |
1297+
| ------------------------- | --------- | -------- | -------------------------------------------------------------------------- |
1298+
| `editorId` | `string` | No | Unique identifier for this editor instance. Default: `'superdoc'`. |
1299+
| `scrollToSelectedComment` | `boolean` | No | Scroll a selected thread's text into view. Default: `true`. |
1300+
1301+
#### AttachedExtension
1302+
1303+
---
1304+
1305+
Handle returned by `SuperDocVeltComments.configure(...).attach(instance)`.
1306+
1307+
| Property | Type | Required | Description |
1308+
| -------- | ------------ | -------- | ------------------------------------------------------------------ |
1309+
| `detach` | `() => void` | Yes | Removes every SuperDoc listener and clears per-instance state. |
1310+
1311+
#### TextEditorConfig
1312+
1313+
---
1314+
1315+
Logical anchor stored in `annotation.context.textEditorConfig`. Physical rectangles are re-derived at render time from the live document, so pixel coordinates and raw editor positions are not persisted.
1316+
1317+
| Property | Type | Required | Description |
1318+
| ------------ | -------- | -------- | -------------------------------------------------------- |
1319+
| `editorId` | `string` | Yes | The editor id associated with this comment. |
1320+
| `documentId` | `string` | No | Optional host document id. Velt already scopes per doc. |
1321+
| `text` | `string` | Yes | The canonicalized selected text. |
1322+
| `occurrence` | `number` | Yes | 1-based count of this exact text in the document. |
1323+
12541324
### Messages
12551325

12561326
#### ENUMs

0 commit comments

Comments
 (0)