Started trying to work on a plugin for this.
I’m looking to modify the “toggleReplyAbove” action. It looks to be in the post widget, but if I use the following code to try and replace the action I don’t see any effect - nothing is printed to console and it behaves as normal:
api.attachWidgetAction('post', 'toggleReplyAbove', () => {
console.log('toggle triggered');
});
In the post widget code, it looks like the toggleReplyAbove function is defined inside the created widget post-article
, but that doesn’t seem to be modifiable with attachWidgetAction since the following code trying to modify that widget results in the error Uncaught TypeError: Cannot read property 'class' of undefined
:
api.attachWidgetAction('post-article', 'toggleReplyAbove', () => {
console.log('toggle triggered');
});
I’m able to overwrite the “like” action on post-menu fine as described here Updating Discourse Plugins, taking the first step. Where should I be attaching the widget action to overwrite the toggleReplyAbove action?