File tree Expand file tree Collapse file tree 5 files changed +18
-18
lines changed Expand file tree Collapse file tree 5 files changed +18
-18
lines changed Original file line number Diff line number Diff line change @@ -140,14 +140,7 @@ export class CommentForm extends LitElement {
140
140
) ;
141
141
}
142
142
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' ) ) ;
151
144
152
145
this . baseFormRef . value ?. resetForm ( ) ;
153
146
} catch ( error ) {
Original file line number Diff line number Diff line change @@ -85,15 +85,12 @@ export class CommentList extends LitElement {
85
85
super . connectedCallback ( ) ;
86
86
this . fetchComments ( ) ;
87
87
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
+ } ) ;
97
94
} ) ;
98
95
}
99
96
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ export class CommentReplies extends LitElement {
57
57
this . replies ,
58
58
( item ) => item . metadata . name ,
59
59
( item ) =>
60
- html ` <reply- item
60
+ html `<reply- item
61
61
.comment = ${ this . comment }
62
62
.reply = "${ item } "
63
63
.replies = ${ this . replies }
Original file line number Diff line number Diff line change @@ -144,6 +144,8 @@ export class ReplyForm extends LitElement {
144
144
}
145
145
146
146
this . dispatchEvent ( new CustomEvent ( 'reload' ) ) ;
147
+ window . dispatchEvent ( new CustomEvent ( 'halo:comment-reply:created' ) ) ;
148
+
147
149
this . baseFormRef . value ?. resetForm ( ) ;
148
150
} catch ( error ) {
149
151
if ( error instanceof FetchError ) {
Original file line number Diff line number Diff line change 37
37
document . documentElement . classList . add ( theme ) ;
38
38
}
39
39
} ) ;
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
+ } ) ;
40
48
</ script >
41
49
</ head >
42
50
< body >
You can’t perform that action at this time.
0 commit comments