Skip to content

Commit c29d40a

Browse files
committed
Add DraftJS comments docs
1 parent 1d9c6d1 commit c29d40a

4 files changed

Lines changed: 410 additions & 2 deletions

File tree

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

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,38 @@ Renders and highlights comment annotations in the WebViewer.
494494
- React Hook: `n/a`
495495
- [Full Documentation →](/async-collaboration/comments/setup/apryse#rendercomments)
496496

497+
### DraftJS
498+
499+
#### DraftJSVeltEditor
500+
React wrapper around the DraftJS `Editor` component that handles Velt comment decorator setup and annotation context tracking.
501+
- Params: `props:` [DraftJSVeltEditorProps](/api-reference/sdk/models/data-models#draftjsvelteditorprops)
502+
- Returns: React element
503+
- React Hook: `n/a`
504+
- [Full Documentation →](/async-collaboration/comments/setup/draftjs#draftjsvelteditor)
505+
506+
#### addComment()
507+
Creates a comment annotation for the currently selected text in the editor.
508+
- Signature: `async (request:` [AddCommentRequest](/api-reference/sdk/models/data-models#addcommentrequest-7)`) => Promise<void>`
509+
- Params: `request:` [AddCommentRequest](/api-reference/sdk/models/data-models#addcommentrequest-7)
510+
- Returns: `Promise<void>`
511+
- React Hook: `n/a`
512+
- [Full Documentation →](/async-collaboration/comments/setup/draftjs#addcomment)
513+
514+
#### renderComments()
515+
Renders and highlights comment annotations in the DraftJS editor.
516+
- Signature: `(request:` [RenderCommentsRequest](/api-reference/sdk/models/data-models#rendercommentsrequest-7)`) => void`
517+
- Params: `request:` [RenderCommentsRequest](/api-reference/sdk/models/data-models#rendercommentsrequest-7)
518+
- Returns: `void`
519+
- React Hook: `n/a`
520+
- [Full Documentation →](/async-collaboration/comments/setup/draftjs#rendercomments)
521+
522+
#### exportContentStateWithoutComments()
523+
Returns a DraftJS `ContentState` with Velt comment entities removed.
524+
- Params: `contentState: ContentState`
525+
- Returns: `ContentState`
526+
- React Hook: `n/a`
527+
- [Full Documentation →](/async-collaboration/comments/setup/draftjs#exportcontentstatewithoutcomments)
528+
497529

498530
### Messages
499531

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

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -955,6 +955,54 @@ Logical anchor stored in `annotation.context.textEditorConfig`. Designed to surv
955955
| `pageNumber` | `number` | Yes | 1-based page number where the comment lives. |
956956
| `occurrence` | `number` | Yes | 1-based count of this exact text on the page. Re-validated on each edit. |
957957

958+
### DraftJS
959+
960+
#### DraftJSEditor
961+
962+
---
963+
964+
Editor wrapper object passed to the DraftJS Velt comment helpers.
965+
966+
| Property | Type | Required | Description |
967+
| ---------------- | ---------------------------------- | -------- | ----------------------------------- |
968+
| `editorState` | `EditorState` | Yes | Current DraftJS editor state. |
969+
| `setEditorState` | `(state: EditorState) => void` | Yes | Function used to update the editor. |
970+
971+
#### DraftJSVeltEditorProps
972+
973+
---
974+
975+
Props for the `DraftJSVeltEditor` React wrapper.
976+
977+
| Property | Type | Required | Description |
978+
| ------------- | -------------------------- | -------- | ------------------------------------------------------------------------------ |
979+
| `editorState` | `EditorState` | Yes | Current DraftJS editor state. |
980+
| `onChange` | `(state: EditorState) => void` | Yes | Callback invoked when the editor state changes. |
981+
| `editorId` | `string` | No | Optional editor ID used to scope operations for multi-editor pages. |
982+
| `...props` | `EditorProps` | No | Other standard DraftJS `Editor` props, such as `placeholder` or `spellCheck`. |
983+
984+
#### AddCommentRequest
985+
986+
---
987+
988+
| Property | Type | Required | Description |
989+
| ---------- | ----------------------- | -------- | ---------------------------------------------------- |
990+
| `editor` | [`DraftJSEditor`](#draftjseditor) | Yes | DraftJS editor wrapper object. |
991+
| `editorId` | `string` | No | Optional editor ID used to scope operations. |
992+
| `context` | `unknown` | No | Optional custom context to attach to the annotation. |
993+
994+
#### RenderCommentsRequest
995+
996+
---
997+
998+
| Property | Type | Required | Description |
999+
| -------------------- | --------------------- | -------- | -------------------------------------------- |
1000+
| `editor` | [`DraftJSEditor`](#draftjseditor) | Yes | DraftJS editor wrapper object. |
1001+
| `editorId` | `string` | No | Optional editor ID used to scope operations. |
1002+
| `commentAnnotations` | `CommentAnnotation[]` | No | Annotations to render/highlight. |
1003+
1004+
For the CommentAnnotation model referenced above, see [CommentAnnotation](#commentannotation).
1005+
9581006
### Messages
9591007

9601008
#### ENUMs

0 commit comments

Comments
 (0)