comments icon indicating copy to clipboard operation
comments copied to clipboard

Expose 'reply-open' and other similar events

Open vonscriptor opened this issue 7 months ago • 1 comments

What are you trying to do?

I need a way to tap into the events when a user clicks Reply etc and its resulting comment form is added/removed etc. I'm doing this so I can initialize my custom character count indicator UI for each field.

I believe this is an example of where Comments internally emits these types of events, but I can't seem to get access.

this.instance.emit('reply-open', { comment: this }); code reference

What's your proposed solution?

Emit the event in a global scope.

Additional context

Comments are render via AJAX on my posts and use: craft.comments.getJsVariables craft.comments.render

Users can access comments in multiple posts and add new comments and replies as usual. The trouble I'm having is specifically with the replies since that mark-up is injected dynamically. So while my character count indicator UI will show up, I don't have a good way to execute my JS for it to function.

vonscriptor avatar Jun 29 '25 21:06 vonscriptor

We're actually just starting a major revamp of the front-end architecture for Comments, so we'll roll this, and many more extensibility changes in!

In the meantime, I'll see what I can do about emitting that.

engram-design avatar Jun 30 '25 10:06 engram-design