Skip to content

Commit cc03749

Browse files
committed
Add TinyMCE comments docs
1 parent 40d75bd commit cc03749

4 files changed

Lines changed: 703 additions & 1 deletion

File tree

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

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,39 @@ The ProseMirror `PluginKey` used by the package. Exported for advanced plugin st
559559
- [Full Documentation →](/async-collaboration/comments/setup/prosemirror#veltcommentspluginkey)
560560

561561

562+
### TinyMCE
563+
564+
#### VeltCommentsPlugin
565+
The registered TinyMCE plugin name (`'veltcomments'`) that powers Velt comments. Import the package and add it to the editor's `plugins` list.
566+
- Params: none
567+
- Returns: TinyMCE plugin name
568+
- React Hook: `n/a`
569+
- [Full Documentation →](/async-collaboration/comments/setup/tinymce#veltcommentsplugin)
570+
571+
#### registerVeltCommentsPlugin()
572+
Explicitly registers the TinyMCE `veltcomments` plugin against a TinyMCE instance. Use this when TinyMCE is loaded or provided after package import.
573+
- Params: `instance?: TinyMCE`
574+
- Returns: `void`
575+
- React Hook: `n/a`
576+
- [Full Documentation →](/async-collaboration/comments/setup/tinymce#registerveltcommentsplugin)
577+
578+
#### addComment()
579+
Creates a Velt comment annotation for the currently selected TinyMCE text.
580+
- Signature: `async (request:` [AddCommentRequest](/api-reference/sdk/models/data-models#addcommentrequest-9)`) => Promise<void>`
581+
- Params: `request:` [AddCommentRequest](/api-reference/sdk/models/data-models#addcommentrequest-9)
582+
- Returns: `Promise<void>`
583+
- React Hook: `n/a`
584+
- [Full Documentation →](/async-collaboration/comments/setup/tinymce#addcomment)
585+
586+
#### renderComments()
587+
Resolves Velt comment annotations back to TinyMCE DOM ranges and renders stable `<velt-comment-text>` overlay elements for the visible comments.
588+
- Signature: `(request:` [RenderCommentsRequest](/api-reference/sdk/models/data-models#rendercommentsrequest-9)`) => void`
589+
- Params: `request:` [RenderCommentsRequest](/api-reference/sdk/models/data-models#rendercommentsrequest-9)
590+
- Returns: `void`
591+
- React Hook: `n/a`
592+
- [Full Documentation →](/async-collaboration/comments/setup/tinymce#rendercomments)
593+
594+
562595
### Messages
563596

564597
#### addComment()

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

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,6 +1075,68 @@ Context extracted from the current ProseMirror editor selection.
10751075
| `occurrence` | `number` | Yes | 1-based index of `text` among all matches in the document. |
10761076
| `locationId` | `string` | No | Optional Velt location id derived from a `data-velt-location-id` ancestor. |
10771077

1078+
### TinyMCE
1079+
1080+
#### AddCommentRequest
1081+
1082+
---
1083+
1084+
Request interface for the TinyMCE `addComment()` function. The library automatically writes `context.textEditorConfig` with the selected text, its 1-based occurrence index in the document, and the editor ID when one is provided.
1085+
1086+
| Property | Type | Required | Description |
1087+
| ---------- | --------------------------------------------------------- | -------- | ---------------------------------------------------- |
1088+
| `editor` | `Editor` | Yes | TinyMCE editor instance. |
1089+
| `editorId` | `string` | No | Optional editor ID used to scope operations. |
1090+
| `context` | [`CommentAnnotationContext`](#commentannotationcontext-2) | No | Optional custom context to attach to the annotation. |
1091+
1092+
#### RenderCommentsRequest
1093+
1094+
---
1095+
1096+
Request interface for the TinyMCE `renderComments()` function. Comments are resolved back to TinyMCE DOM ranges and rendered as view-only overlay elements.
1097+
1098+
| Property | Type | Required | Description |
1099+
| -------------------- | --------------------- | -------- | -------------------------------------------- |
1100+
| `editor` | `Editor` | Yes | TinyMCE editor instance. |
1101+
| `editorId` | `string` | No | Optional editor ID used to scope operations. |
1102+
| `commentAnnotations` | `CommentAnnotation[]` | No | Annotations to render/highlight. |
1103+
1104+
For the CommentAnnotation model referenced above, see [CommentAnnotation](#commentannotation).
1105+
1106+
#### TinymceVeltCommentsConfig
1107+
1108+
---
1109+
1110+
Configuration options for the TinyMCE Velt comments plugin. In TinyMCE init options, `editorId` maps to `velt_comments_editor_id` and `persistVeltMarks` maps to `velt_comments_persist_marks`.
1111+
1112+
| Property | Type | Required | Description |
1113+
| ------------------ | --------- | -------- | ------------------------------------------------------------------------------ |
1114+
| `editorId` | `string` | No | Unique identifier for this editor instance. Use it for multi-editor scenarios. |
1115+
| `persistVeltMarks` | `boolean` | No | Reserved for API parity. TinyMCE highlights are always view-only overlays. |
1116+
1117+
#### CommentAnnotationContext
1118+
1119+
---
1120+
1121+
Context object for comment annotations. Contains text editor configuration and any additional custom metadata.
1122+
1123+
| Property | Type | Required | Description |
1124+
| ------------------ | ----------------------------------------- | -------- | ---------------------------------------------------------- |
1125+
| `textEditorConfig` | [`TextEditorConfig`](#texteditorconfig-3) | No | Text editor configuration auto-generated by the library. |
1126+
| `[key: string]` | `unknown` | No | Any additional custom properties you want to attach. |
1127+
1128+
#### TextEditorConfig
1129+
1130+
---
1131+
1132+
Nested in `CommentAnnotationContext`.
1133+
1134+
| Property | Type | Required | Description |
1135+
| ------------ | -------- | -------- | ------------------------------------------------- |
1136+
| `text` | `string` | Yes | The selected text content. |
1137+
| `occurrence` | `number` | Yes | The 1-based occurrence index of the selected text in the document. |
1138+
| `editorId` | `string` | No | The editor ID associated with this comment. |
1139+
10781140
### Messages
10791141

10801142
#### ENUMs

0 commit comments

Comments
 (0)