@@ -50,8 +50,18 @@ class CommentManager {
5050 dateStyle : "long" ,
5151 } ) ;
5252 this . dialogElement = commentDialog . dialog ;
53- this . #dialog = new CommentDialog ( commentDialog , overlayManager , ltr ) ;
54- this . #popup = new CommentPopup ( dateFormat , ltr , this . dialogElement ) ;
53+ this . #dialog = new CommentDialog (
54+ commentDialog ,
55+ overlayManager ,
56+ eventBus ,
57+ ltr
58+ ) ;
59+ this . #popup = new CommentPopup (
60+ eventBus ,
61+ dateFormat ,
62+ ltr ,
63+ this . dialogElement
64+ ) ;
5565 this . #sidebar = new CommentSidebar (
5666 sidebar ,
5767 eventBus ,
@@ -134,6 +144,8 @@ class CommentManager {
134144class CommentSidebar {
135145 #annotations = null ;
136146
147+ #eventBus;
148+
137149 #boundCommentClick = this . #commentClick. bind ( this ) ;
138150
139151 #boundCommentKeydown = this . #commentKeydown. bind ( this ) ;
@@ -199,6 +211,7 @@ class CommentSidebar {
199211 this . #popup = popup ;
200212 this . #dateFormat = dateFormat ;
201213 this . #ltr = ltr ;
214+ this . #eventBus = eventBus ;
202215
203216 const style = window . getComputedStyle ( sidebar ) ;
204217 this . #minWidth = parseFloat ( style . getPropertyValue ( "--sidebar-min-width" ) ) ;
@@ -306,6 +319,13 @@ class CommentSidebar {
306319 this . #setCommentsCount( ) ;
307320 }
308321 this . #sidebar. hidden = false ;
322+ this . #eventBus. dispatch ( "reporttelemetry" , {
323+ source : this ,
324+ details : {
325+ type : "commentSidebar" ,
326+ data : { numberOfAnnotations : annotations . length } ,
327+ } ,
328+ } ) ;
309329 }
310330
311331 hide ( ) {
@@ -672,14 +692,18 @@ class CommentDialog {
672692
673693 #isLTR;
674694
695+ #eventBus;
696+
675697 constructor (
676698 { dialog, toolbar, title, textInput, cancelButton, saveButton } ,
677699 overlayManager ,
700+ eventBus ,
678701 ltr
679702 ) {
680703 this . #dialog = dialog ;
681704 this . #textInput = textInput ;
682705 this . #overlayManager = overlayManager ;
706+ this . #eventBus = eventBus ;
683707 this . #saveButton = saveButton ;
684708 this . #title = title ;
685709 this . #isLTR = ltr ;
@@ -863,6 +887,20 @@ class CommentDialog {
863887 }
864888
865889 #finish( ) {
890+ if ( ! this . #editor) {
891+ return ;
892+ }
893+ const edited = this . #textInput. value !== this . #commentText;
894+ this . #eventBus. dispatch ( "reporttelemetry" , {
895+ source : this ,
896+ details : {
897+ type : "comment" ,
898+ data : {
899+ edited,
900+ } ,
901+ } ,
902+ } ) ;
903+
866904 this . #editor?. focusCommentButton ( ) ;
867905 this . #editor = null ;
868906 this . #textInput. value = this . #previousText = this . #commentText = "" ;
@@ -882,6 +920,8 @@ class CommentDialog {
882920class CommentPopup {
883921 #buttonsContainer = null ;
884922
923+ #eventBus;
924+
885925 #commentDialog;
886926
887927 #dateFormat;
@@ -910,7 +950,8 @@ class CommentPopup {
910950
911951 #visible = false ;
912952
913- constructor ( dateFormat , ltr , commentDialog ) {
953+ constructor ( eventBus , dateFormat , ltr , commentDialog ) {
954+ this . #eventBus = eventBus ;
914955 this . #dateFormat = dateFormat ;
915956 this . #isLTR = ltr ;
916957 this . #commentDialog = commentDialog ;
@@ -994,6 +1035,15 @@ class CommentPopup {
9941035 ) ;
9951036 del . append ( delLabel ) ;
9961037 del . addEventListener ( "click" , ( ) => {
1038+ this . #eventBus. dispatch ( "reporttelemetry" , {
1039+ source : this ,
1040+ details : {
1041+ type : "comment" ,
1042+ data : {
1043+ deleted : true ,
1044+ } ,
1045+ } ,
1046+ } ) ;
9971047 this . #editor. comment = null ;
9981048 this . destroy ( ) ;
9991049 } ) ;
0 commit comments