Skip to content

Commit fc2cfd3

Browse files
committed
Add SpreadJS comments docs
1 parent 81d73d7 commit fc2cfd3

4 files changed

Lines changed: 441 additions & 0 deletions

File tree

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

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,38 @@ Renders and updates Velt comment highlights in the Nutrient viewer.
699699
- [Full Documentation →](/async-collaboration/comments/setup/nutrient#rendercomments)
700700

701701

702+
### SpreadJS
703+
704+
<a id="spreadjs-spreadjsveltcomments" />
705+
706+
#### SpreadJSVeltComments
707+
Creates the Velt Comments extension for a SpreadJS workbook. Configure it, then call `.attach(instance)` to wire it to a workbook instance.
708+
- Config: [SpreadJSVeltCommentsConfig](/api-reference/sdk/models/data-models#spreadjs-spreadjsveltcommentsconfig)
709+
- Returns: `SpreadJSVeltComments`
710+
- React Hook: `n/a`
711+
- [Full Documentation →](/async-collaboration/comments/setup/spreadjs#spreadjsveltcomments)
712+
713+
<a id="spreadjs-addcomment" />
714+
715+
#### addComment()
716+
Creates a comment annotation for the currently selected SpreadJS cell or range.
717+
- Signature: `async (args: AddCommentArgs) => Promise<AddCommentResult | null>`
718+
- Params: `args:` [AddCommentArgs](/api-reference/sdk/models/data-models#spreadjs-addcommentargs)
719+
- Returns: `Promise<AddCommentResult | null>`
720+
- React Hook: `n/a`
721+
- [Full Documentation →](/async-collaboration/comments/setup/spreadjs#addcomment)
722+
723+
<a id="spreadjs-rendercomments" />
724+
725+
#### renderComments()
726+
Renders and updates Velt comment highlights in the SpreadJS workbook.
727+
- Signature: `(args:` [RenderCommentsArgs](/api-reference/sdk/models/data-models#spreadjs-rendercommentsargs)`) => void`
728+
- Params: `args:` [RenderCommentsArgs](/api-reference/sdk/models/data-models#spreadjs-rendercommentsargs)
729+
- Returns: `void`
730+
- React Hook: `n/a`
731+
- [Full Documentation →](/async-collaboration/comments/setup/spreadjs#rendercomments)
732+
733+
702734
### Messages
703735

704736
#### addComment()

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

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,6 +1442,92 @@ Logical anchor stored in `annotation.context.textEditorConfig`. Physical rectang
14421442
| `pageNumber` | `number` | Yes | 1-based page number where the comment lives. |
14431443
| `occurrence` | `number` | Yes | 1-based count of this exact text on the page. |
14441444

1445+
### SpreadJS
1446+
1447+
<a id="spreadjs-addcommentargs" />
1448+
1449+
#### AddCommentArgs
1450+
1451+
---
1452+
1453+
Request interface for the SpreadJS `addComment()` function.
1454+
1455+
| Property | Type | Required | Description |
1456+
| ---------- | ---------------- | -------- | ----------------------------------- |
1457+
| `instance` | `SpreadInstance` | Yes | The SpreadJS workbook instance. |
1458+
1459+
<a id="spreadjs-addcommentresult" />
1460+
1461+
#### AddCommentResult
1462+
1463+
---
1464+
1465+
Return shape from SpreadJS `addComment()` when the call succeeds. The function returns `null` when no cell/range is selected or Velt is not loaded.
1466+
1467+
| Property | Type | Required | Description |
1468+
| ------------------ | ----------------------------------------- | -------- | --------------------------------------------------- |
1469+
| `veltAnnotationId` | `string` | Yes | The Velt annotation id assigned by the SDK. |
1470+
| `textEditorConfig` | [`TextEditorConfig`](#spreadjs-texteditorconfig) | Yes | The durable logical anchor stored on the annotation. |
1471+
1472+
<a id="spreadjs-rendercommentsargs" />
1473+
1474+
#### RenderCommentsArgs
1475+
1476+
---
1477+
1478+
Request interface for the SpreadJS `renderComments()` function.
1479+
1480+
| Property | Type | Required | Description |
1481+
| -------------------- | ------------------------------------------ | -------- | --------------------------------- |
1482+
| `instance` | `SpreadInstance` | Yes | The SpreadJS workbook instance. |
1483+
| `commentAnnotations` | `CommentAnnotation[] \| null \| undefined` | Yes | Annotations to render/highlight. |
1484+
1485+
For the CommentAnnotation model referenced above, see [CommentAnnotation](#commentannotation).
1486+
1487+
<a id="spreadjs-spreadjsveltcommentsconfig" />
1488+
1489+
#### SpreadJSVeltCommentsConfig
1490+
1491+
---
1492+
1493+
Configuration options for `SpreadJSVeltComments.configure()`.
1494+
1495+
| Property | Type | Required | Description |
1496+
| ------------------------- | --------- | -------- | ---------------------------------------------------------------------------- |
1497+
| `editorId` | `string` | No | Unique identifier for this workbook instance. Default: `'spreadjs'`. |
1498+
| `scrollToSelectedComment` | `boolean` | No | Activate a selected thread's sheet and scroll its cell into view. Default: `true`. |
1499+
1500+
<a id="spreadjs-attachedextension" />
1501+
1502+
#### AttachedExtension
1503+
1504+
---
1505+
1506+
Handle returned by `SpreadJSVeltComments.configure(...).attach(instance)`.
1507+
1508+
| Property | Type | Required | Description |
1509+
| -------- | ------------ | -------- | ------------------------------------------------------------------ |
1510+
| `detach` | `() => void` | Yes | Removes every SpreadJS listener and clears per-instance state. |
1511+
1512+
<a id="spreadjs-texteditorconfig" />
1513+
1514+
#### TextEditorConfig
1515+
1516+
---
1517+
1518+
Logical anchor stored in `annotation.context.textEditorConfig`. Physical rectangles are re-derived at render time with `Worksheet.getCellRect`, so pixel coordinates are not persisted.
1519+
1520+
| Property | Type | Required | Description |
1521+
| ------------ | -------- | -------- | ----------------------------------------------------- |
1522+
| `editorId` | `string` | Yes | The editor id associated with this comment. |
1523+
| `documentId` | `string` | No | Optional host workbook/document id. Velt already scopes per document. |
1524+
| `sheetName` | `string` | Yes | Authoritative sheet identity; survives sheet reordering. |
1525+
| `sheetIndex` | `number` | No | Sheet index hint only; `sheetName` wins on mismatch. |
1526+
| `row` | `number` | Yes | 0-based top-left row of the anchored cell/range. |
1527+
| `col` | `number` | Yes | 0-based top-left column of the anchored cell/range. |
1528+
| `rowCount` | `number` | Yes | Row span; `1` means a single cell. |
1529+
| `colCount` | `number` | Yes | Column span; `1` means a single cell. |
1530+
14451531
### Messages
14461532

14471533
#### ENUMs

0 commit comments

Comments
 (0)