@@ -42,6 +42,66 @@ let commentProperties = {
42
42
documentEditor .editor .insertComment (' Hello world' , commentProperties );
43
43
```
44
44
45
+ ## Add a New Comment with Date, Author, and Status
46
+
47
+ Comments can be inserted into the selected text with a specified date, author, and status ` insertComment ` .
48
+
49
+ ``` typescript
50
+ // In this example, a comment with the text "Hello world"
51
+ // is added by the author Nancy Davolio on July 23, 2024, at 2:30 PM.
52
+ // The isResolved status is set to false.
53
+
54
+ // Create a specific date: July 23, 2024, at 2:30:00 PM.
55
+ // Note: July is represented by 6 (0-based index).
56
+ var specificDate = new Date (2024 , 6 , 23 , 14 , 30 , 0 );
57
+
58
+
59
+ // Define the properties of the comment including author, date, and resolution status.
60
+ var commentProperties = {
61
+ author: ' Nancy Davolio' , // The author of the comment.
62
+ dateTime: specificDate , // The date and time when the comment is created.
63
+ isResolved: false // The status of the comment; false indicates it is unresolved.
64
+ };
65
+
66
+ // Insert the comment with the specified properties into the document editor.
67
+ documentEditor .editor .insertComment (' Hello world' , commentProperties );
68
+ ```
69
+
70
+ ## Add a Reply Comment with Date, Author, and Status
71
+
72
+ Reply comments can be inserted into the parent comment with a specified date, author using ` insertReplyComment ` .
73
+
74
+ ``` typescript
75
+ // In this example, a comment with the text "Hello world"
76
+ // is added by the author Nancy Davolio on July 23, 2024, at 2:30 PM.
77
+ // The isResolved status is set to false.
78
+
79
+ // Create a specific date: July 23, 2024, at 2:30:00 PM.
80
+ // Note: July is represented by 6 (0-based index).
81
+ var specificDate = new Date (2024 , 6 , 23 , 14 , 30 , 0 );
82
+
83
+ // Define the properties of the comment including author, date, and resolution status.
84
+ var commentProperties = {
85
+ author: ' Nancy Davolio' , // The author of the comment.
86
+ dateTime: specificDate , // The date and time when the comment is created.
87
+ isResolved: false // The status of the comment; false indicates it is unresolved.
88
+ };
89
+
90
+ // Insert the comment with the specified properties into the Document Editor.
91
+ var comment = documentEditor .editor .insertComment (' Hello world' , commentProperties );
92
+ // Insert a reply comment with specified properties into the Document Editor
93
+ documentEditor .editor .insertReplyComment (comment .id , ' Hello world' , commentProperties );
94
+ ```
95
+
96
+ ## Get Comments
97
+
98
+ Document Editor allows to get the comments along with its reply and comment properties using ` getComments ` .
99
+
100
+ ``` typescript
101
+ // Get Comments in the document along with the properties author, date, status.
102
+ var commentinfo = container .documentEditor .getComments ();
103
+ ```
104
+
45
105
## Comment navigation
46
106
47
107
Next and previous comments can be navigated using the below code snippet.
@@ -56,10 +116,20 @@ documentEditor.selection.navigatePreviousComment();
56
116
57
117
## Delete comment
58
118
59
- Current comment can be deleted using the below code snippet .
119
+ Current comment can be deleted using ` deleteComment ` .
60
120
61
121
``` typescript
62
- documentEditor .editor .deleteComment ();
122
+ // Delete the current selected comment.
123
+ container .documentEditor .editor .deleteComment ();
124
+
125
+ // Get Comments in the document along with the properties author, date, status.
126
+ let commentinfo = container .documentEditor .getComments ();
127
+
128
+ // Delete the particular parent comments and all of its reply comments
129
+ container .documentEditor .editor .deleteComment (commentinfo [0 ].id );
130
+
131
+ // Delete the particular reply comment.
132
+ container .documentEditor .editor .deleteComment (commentinfo [0 ].replies [0 ].id );
63
133
```
64
134
65
135
## Delete all comment
@@ -125,4 +195,4 @@ The following example illustrates how to enable mention support in Document Edit
125
195
{% endhighlight %}
126
196
{% highlight c# tabtitle="comments-mention.cs" %}
127
197
{% endhighlight %}{% endtabs %}
128
- {% endif %}
198
+ {% endif %}
0 commit comments