Currently working on a plugin that provides a custom theme, along with some custom macros that are styled using that theme.
Generally, it all works fine. I can edit a page and add one of our custom macros. The problem is with the macro preview dialog (which Confluence implements as an iframe).
If our custom theme is applied as the Confluence global theme, the macro preview in the dialog is styled using our custom theme, as you would hope.
If our custom theme is applied only to the current space, which is how it will be deployed in production, none of our custom theme resources are used to style the macro preview. Only the site default theme resources are loaded and used. This is a big issue, as the custom theme includes an icon font, and it’s important to be able to see the icons in the preview.
How can I make the macro preview dialog use the theme that’s applied to the current space, rather than the global theme? It seems it should be possible using some $webResourceManager or #requireResourcesForContext() magic. But I don’t know exactly what to do, or where to put it. I’ve poked around in atlassian-plugin.xml
, page.vmd
, macros.vm
and preview-macro-template.vm
, and tried a few things that I thought might work. But my velocity template knowledge is slim, and the developer documentation hasn’t helped at all.