File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -140,14 +140,7 @@ export class CommentForm extends LitElement {
140140 ) ;
141141 }
142142
143- window . dispatchEvent (
144- new CustomEvent ( 'comment:reload' , {
145- detail : {
146- page : 1 ,
147- scrollIntoView : true ,
148- } ,
149- } )
150- ) ;
143+ window . dispatchEvent ( new CustomEvent ( 'halo:comment:created' ) ) ;
151144
152145 this . baseFormRef . value ?. resetForm ( ) ;
153146 } catch ( error ) {
Original file line number Diff line number Diff line change @@ -85,15 +85,12 @@ export class CommentList extends LitElement {
8585 super . connectedCallback ( ) ;
8686 this . fetchComments ( ) ;
8787
88- // Handle comment:reload event
89- window . addEventListener ( 'comment:reload' , ( e : Event ) => {
90- if ( e instanceof CustomEvent ) {
91- const data = e . detail ;
92- this . fetchComments ( {
93- page : data . page ,
94- scrollIntoView : data . scrollIntoView ,
95- } ) ;
96- }
88+ // Handle halo:comment:created event, then reload the comment list
89+ window . addEventListener ( 'halo:comment:created' , ( ) => {
90+ this . fetchComments ( {
91+ page : 1 ,
92+ scrollIntoView : true ,
93+ } ) ;
9794 } ) ;
9895 }
9996
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ export class CommentReplies extends LitElement {
5757 this . replies ,
5858 ( item ) => item . metadata . name ,
5959 ( item ) =>
60- html ` <reply- item
60+ html `<reply- item
6161 .comment = ${ this . comment }
6262 .reply = "${ item } "
6363 .replies = ${ this . replies }
Original file line number Diff line number Diff line change @@ -144,6 +144,8 @@ export class ReplyForm extends LitElement {
144144 }
145145
146146 this . dispatchEvent ( new CustomEvent ( 'reload' ) ) ;
147+ window . dispatchEvent ( new CustomEvent ( 'halo:comment-reply:created' ) ) ;
148+
147149 this . baseFormRef . value ?. resetForm ( ) ;
148150 } catch ( error ) {
149151 if ( error instanceof FetchError ) {
Original file line number Diff line number Diff line change 3737 document . documentElement . classList . add ( theme ) ;
3838 }
3939 } ) ;
40+
41+ window . addEventListener ( "halo:comment:created" , ( ) => {
42+ console . log ( "halo:comment:created" ) ;
43+ } ) ;
44+
45+ window . addEventListener ( "halo:comment-reply:created" , ( ) => {
46+ console . log ( "halo:comment-reply:created" ) ;
47+ } ) ;
4048 </ script >
4149 </ head >
4250 < body >
You can’t perform that action at this time.
0 commit comments