@@ -21,6 +21,66 @@ Comments can be inserted to the selected text.
21
21
documentEditor .editor .insertComment (" Test comment" );
22
22
```
23
23
24
+ ## Add a New Comment with Date, Author, and Status
25
+
26
+ Comments can be inserted into the selected text with a specified date, author, and status ` insertComment ` .
27
+
28
+ ``` typescript
29
+ // In this example, a comment with the text "Hello world"
30
+ // is added by the author Nancy Davolio on July 23, 2024, at 2:30 PM.
31
+ // The isResolved status is set to false.
32
+
33
+ // Create a specific date: July 23, 2024, at 2:30:00 PM.
34
+ // Note: July is represented by 6 (0-based index).
35
+ var specificDate = new Date (2024 , 6 , 23 , 14 , 30 , 0 );
36
+
37
+
38
+ // Define the properties of the comment including author, date, and resolution status.
39
+ var commentProperties = {
40
+ author: ' Nancy Davolio' , // The author of the comment.
41
+ dateTime: specificDate , // The date and time when the comment is created.
42
+ isResolved: false // The status of the comment; false indicates it is unresolved.
43
+ };
44
+
45
+ // Insert the comment with the specified properties into the document editor.
46
+ documentEditor .editor .insertComment (' Hello world' , commentProperties );
47
+ ```
48
+
49
+ ## Add a Reply Comment with Date, Author, and Status
50
+
51
+ Reply comments can be inserted into the parent comment with a specified date, author using ` insertReplyComment ` .
52
+
53
+ ``` typescript
54
+ // In this example, a comment with the text "Hello world"
55
+ // is added by the author Nancy Davolio on July 23, 2024, at 2:30 PM.
56
+ // The isResolved status is set to false.
57
+
58
+ // Create a specific date: July 23, 2024, at 2:30:00 PM.
59
+ // Note: July is represented by 6 (0-based index).
60
+ var specificDate = new Date (2024 , 6 , 23 , 14 , 30 , 0 );
61
+
62
+ // Define the properties of the comment including author, date, and resolution status.
63
+ var commentProperties = {
64
+ author: ' Nancy Davolio' , // The author of the comment.
65
+ dateTime: specificDate , // The date and time when the comment is created.
66
+ isResolved: false // The status of the comment; false indicates it is unresolved.
67
+ };
68
+
69
+ // Insert the comment with the specified properties into the Document Editor.
70
+ var comment = documentEditor .editor .insertComment (' Hello world' , commentProperties );
71
+ // Insert a reply comment with specified properties into the Document Editor
72
+ documentEditor .editor .insertReplyComment (comment .id , ' Hello world' , commentProperties );
73
+ ```
74
+
75
+ ## Get Comments
76
+
77
+ Document Editor allows to get the comments along with its reply and comment properties using ` getComments ` .
78
+
79
+ ``` typescript
80
+ // Get Comments in the document along with the properties author, date, status.
81
+ var commentinfo = container .documentEditor .getComments ();
82
+ ```
83
+
24
84
## Comment navigation
25
85
26
86
Next and previous comments can be navigated using the below code snippet.
@@ -35,10 +95,20 @@ documentEditor.selection.navigatePreviousComment();
35
95
36
96
## Delete comment
37
97
38
- Current comment can be deleted using the below code snippet .
98
+ Current comment can be deleted using ` deleteComment ` .
39
99
40
100
``` typescript
41
- documentEditor .editor .deleteComment ();
101
+ // Delete the current selected comment.
102
+ container .documentEditor .editor .deleteComment ();
103
+
104
+ // Get Comments in the document along with the properties author, date, status.
105
+ let commentinfo = container .documentEditor .getComments ();
106
+
107
+ // Delete the particular parent comments and all of its reply comments
108
+ container .documentEditor .editor .deleteComment (commentinfo [0 ].id );
109
+
110
+ // Delete the particular reply comment.
111
+ container .documentEditor .editor .deleteComment (commentinfo [0 ].replies [0 ].id );
42
112
```
43
113
44
114
## Delete all comment
@@ -104,4 +174,4 @@ The following example illustrates how to enable mention support in Document Edit
104
174
{% endhighlight %}
105
175
{% highlight c# tabtitle="comments-mention.cs" %}
106
176
{% endhighlight %}{% endtabs %}
107
- {% endif %}
177
+ {% endif %}
0 commit comments