You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
93
+
To add a comment on a specific element through an API method, use the `addCommentOnElement()` method and pass in an object with the schema shown in the examples:
94
+
95
+
**Example 1: Add comment with targetElementId only:**
95
96
96
97
<Tabs>
97
98
<Tabtitle="React / Next.js">
98
99
99
-
100
100
```jsx
101
-
102
101
constelement= {
103
102
"targetElement": {
104
-
"elementId":"element_id",// optional (pass elementId if you want to add comment on a specific element)
103
+
"elementId":"element_id",
105
104
"targetText":"target_text", // optional (pass targetText if you want to add comment on a specific text)
106
105
"occurrence":1, // optional (default: 1) This is relevant for text comment. By default, we will attach comment to the first occurence of the target text in your document. You can change this to attach your comment on a more specific text.
107
106
"selectAllContent":true, // Set to `true` if you want to select all the text content of the target element.
108
107
},
109
108
"commentData": [
110
109
{
111
-
"commentText":"This is awesome! Well done.",// To set plain text content
112
-
"commentHtml":"This <span style=\"color: green; background-color: aliceblue; display: inline-block; padding: 4px; border-radius: 4px;\">is test</span> comment.",// To set HTML formatted content
113
-
"replaceContentText":"This is new comment",// provide this replaceContentText to replace current text with
114
-
"replaceContentHtml":"<span>This is <b>new</b> comment.</span>",// If replacement text contains html formatted text, then provide it here
"elementId":"element_id",// optional (pass elementId if you want to add comment on a specific element)
129
+
"elementId":"element_id",
131
130
"targetText":"target_text", // optional (pass targetText if you want to add comment on a specific text)
132
131
"occurrence":1, // optional (default: 1) This is relevant for text comment. By default, we will attach comment to the first occurence of the target text in your document. You can change this to attach your comment on a more specific text.
133
132
"selectAllContent":true, // Set to `true` if you want to select all the text content of the target element.
134
133
},
135
134
"commentData": [
136
135
{
137
-
"commentText":"This is awesome! Well done.",// To set plain text content
138
-
"commentHtml":"This <span style=\"color: green; background-color: aliceblue; display: inline-block; padding: 4px; border-radius: 4px;\">is test</span> comment.",// To set HTML formatted content
139
-
"replaceContentText":"This is new comment",// provide this replaceContentText to replace current text with
140
-
"replaceContentHtml":"<span>This is <b>new</b> comment.</span>",// If replacement text contains html formatted text, then provide it here
0 commit comments