How to add a custom toolbar button via external JS?

Hi there,

I develop an image hosting script (Chevereto) and I’m building a universal JS plugin that aims to add external image hosting support for a wide range of forum CMS and websites in general. The idea is to achieve this without the need of a custom plugin for each CMS. So far I’ve added it successfully to IPB, Vanilla, XenForo, etc. The plugin is quite straightforward: It detects vendor, editor function and it picks a sibling to append my button element next to it.

For Discourse, I’m having issues since the editor template gets parsed on demand and I’m unable to find a good way to achieve this without the need to add some event handler or hack some object containing that section template.

I will like some guidance here in terms to try to get this to work without breaking something else. Please keep in mind that I’m aware of this workaround but like I said earlier, I’m building it as an external plugin so I will look into that only if the external way is not reliable.

Hope there is way to do this,

1 Like