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
@@ -194,5 +200,36 @@ The following example illustrates how to enable mention support in Document Edit
194
200
{% include code-snippet/document-editor-container/comments-mention/razor %}
195
201
{% endhighlight %}
196
202
{% highlight c# tabtitle="comments-mention.cs" %}
197
-
{% endhighlight %}{% endtabs %}
203
+
{% include code-snippet/document-editor-container/comments-mention/document-editor.cs %}
204
+
{% endhighlight %}
205
+
{% endtabs %}
206
+
{% endif %}
207
+
208
+
## Events
209
+
210
+
DocumentEditor provides `beforeCommentAction` event, which is triggered on comment actions like Post, edit, reply, resolve and reopen. This event provides an opportunity to perform custom logic on comment actions like Post, edit, reply, resolve and reopen. The event handler receives the `CommentActionEventArgs` object as an argument, which allows access to information about the comment.
211
+
212
+
To demonstrate a specific use case, let’s consider an example where we want to restrict the delete functionality based on the author’s name. The following code snippet illustrates how to allow only the author of a comment to delete:
213
+
214
+
{% if page.publishingplatform == "aspnet-core" %}
215
+
216
+
{% tabs %}
217
+
{% highlight cshtml tabtitle="CSHTML" %}
218
+
{% include code-snippet/document-editor-container/comments-event/tagHelper %}
219
+
{% endhighlight %}
220
+
{% highlight c# tabtitle="comments-event.cs" %}
221
+
{% include code-snippet/document-editor-container/comments-event/document-editor.cs %}
0 commit comments