Setup
- Add the
Velt Comments component to the root of your app.
- This component is required to render comments in your app.
- Set the
text mode prop to false to hide the default text comment tool.
React / Next.js
Other Frameworks
Step 2: Install the Velt Quill extension
React / Next.js
Other Frameworks
Add a button that users can click to add comments after selecting text.
When clicking a button, the browser moves focus to the button which clears the editor selection. You must save the selection on mousedown (before focus changes) and restore it before adding the comment.
React / Next.js
Other Frameworks
Unlike Tiptap, Quill does not have a built-in bubble menu. You will need to create your own comment button or toolbar item.
- Call this method to add a comment to selected text in the Quill editor. You can use this when the user clicks on the comment button or presses a keyboard shortcut.
- Params:
AddCommentRequest. It has the following properties:
editor: Instance of the Quill editor.
editorId: Id of the Quill editor. Use this if you have multiple Quill editors on the same page. (optional)
context: Add any custom metadata to the Comment Annotation. Learn more. (optional)
React / Next.js
Other Frameworks
- Get the comment data from Velt SDK and render it in the Quill editor.
- Params:
RenderCommentsRequest. It has the following properties:
editor: Instance of the Quill editor.
editorId: Id of the Quill editor. Use this if you have multiple Quill editors on the same page. (optional)
commentAnnotations: Array of Comment Annotation objects.
React / Next.js
Other Frameworks
- By default, Velt comment marks (
<velt-comment-text>) are persisted by the Velt SDK. When the editor loads and the Velt SDK initializes, the marks will be automatically added to the editor.
- If you plan to store the contents of the Quill editor on your end with the comment marks already included, you can disable this feature.
- Default:
true
- You can style the commented text by adding CSS for the
velt-comment-text element.
APIs
The Velt Comments module for Quill. Register it with Quill before creating the editor.
- Params:
options?: QuillVeltCommentsConfig
editorId?: string - Unique identifier for this editor instance (for multi-editor scenarios)
persistVeltMarks?: boolean - Whether to persist Velt marks. Default: true
- Returns:
Quill Module
React / Next.js
Other Frameworks
Creates a comment annotation for the currently selected text in the editor.
- Params:
- Returns:
Promise<void>
React / Next.js
Other Frameworks
Renders and highlights comment annotations in the editor.
React / Next.js
Other Frameworks