Action Methods
1. Add comment on selected text
By default, when you highlight over any text in textMode
a Comment Tool button will appear. Clicking the button will add a comment on the highlighted text.
If you want to trigger the comment using an API method call instead of clicking the button, you can do the following:
2. Add Comments on specific elements
Adds a Comment on a specific element by ID.
To add a comment on a specific element through an API method, use the addCommentOnElement()
method and pass in an object with the schema shows in the example:
3. Add Manual Comment
- This feature is particularly useful for complex UIs where you need precise control over the placement of Comment Pins.
- Using this you can manually set the position of Comment Annotations.
- Handle click events on your canvas/document and use the this method to create a comment with custom metadata.
4. Turning on and off Comment Mode
Turns Comment mode on or off.
When you click on the comment tool, it turns on comment mode and user can attach comment to any element on the DOM. Using this method you can programatically turn on the commenting mode.
5. Select CommentAnnotation by Annotation ID
- Use this to programatically select a comment annotation by its id.
- Example: If the user opens a comment url from an email notification, you can use this open the comment dialog after your page has finished rendering.
6. Scroll the page directly to the comment element
This will scroll the page to the element directly. This will work if the element is present on the DOM.
7. Delete selected comment
To delete a comment using an API method, use the deleteSelectedComment()
method.
8. Get the Xpath of the DOM element on which the comment was added
This will return the Xpath of the DOM element on which the comment was added.
9. Update Comment Dialog Position
- Sometimes when you manually set the position of the Comment Pin, the Comment Dialog might not position itself near the pin in certain scenarios like scrolling, zooming the page when the comment dialog is open.
- Use this to manually trigger an update. The dialog will reposition itself near the pin.
Was this page helpful?