[wp-trac] [WordPress Trac] #47306: comment reply event listener: need ability to run custom js function

WordPress Trac noreply at wordpress.org
Thu May 23 18:28:39 UTC 2019


#47306: comment reply event listener:  need ability to run custom js function
-------------------------+------------------------------
 Reporter:  jnorell      |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Comments     |     Version:  5.1
 Severity:  normal       |  Resolution:
 Keywords:               |     Focuses:
-------------------------+------------------------------

Comment (by jnorell):

 Replying to [comment:1 peterwilsoncc]:
 > Am I correct to understand you had a custom implementation of
 `addComment.moveForm()` to replace WP Core's version?

 No, that would have been a better design :), I simply created a new click
 handler, overwriting the one which previously called moveForm():
 https://github.com/jnorell/comment-tweaks/blob/master/public/js/comment-
 tweaks-public.js#L102



 > If so, you still replace it by settings your plugin's JavaScript to rely
 on Core's `comment-reply` when enqueueing it override it by creating a
 function `addComment.moveForm()`.

 That's a better approach, I'll rework things along those lines, thanks!


 > Jetpack takes a
 [https://github.com/Automattic/jetpack/blob/2e9efb22810cbd0e60ad2d2a9158e47a4432577c/modules/comments/comments.php#L375-L378
 similar approach for Jetpack comments].
 >
 > See
 https://gist.github.com/peterwilsoncc/e463ba477e81e8c946478d3b3c2154b4

 Thanks for the pointers.


 > If I am misunderstanding your needs, please let me know and I will keep
 this ticket open until I hear back from you.

 I'll give that a go and reply here with the outcome.

 Thanks again!

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/47306#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list