Hey there.
I am currently working on a Macro-Plugin for Confluence and I am, once again, stuck.
I can’t seem to make an Icon appear in the macro browser. I thought it should be pretty easy… but no… all I get is a white field with “icon” written in the top left corner.
here is what I have right now:
<web-resource key="copymacro-resources" name="copymacro Web Resources">
<dependency>com.atlassian.auiplugin:ajs</dependency>
<resource type="download" name="copymacro.css" location="/css/copymacro.css" />
<resource type="download" name="copymacro.js" location="/js/copymacro.js" />
<resource type="download" key="images" name="images/" location="images">
<param name="content-type" value="image/png"/>
</resource>
<context>macro-browser</context>
</web-resource>
<xhtml-macro name="copymacromodule" class="de.demicon.MacroParam"
key="copymacro-key" icon="/images/pluginIcon.png">
I have tried so many different approaches that I can’t even remember.Any help would be greatly appreciatet.
Thanks in advance
david
May 22, 2017, 10:14am
2
This is much harder than it ought to be, but once you’ve done it correctly for the first time, you just copy & paste.
I have my icon at:
/src/main/resources/images/gist-icon.png
Importantly, I have a resource which points to the images directory
<resource key="images" name="images/" type="download" location="images"/>
Then I can access the icon at:
/download/resources/${project.groupId}.${project.artifactId}/images/gist-icon.png
Here’s part of an example atlassian-plugin.xml:
<atlassian-plugin key="${project.groupId}.${project.artifactId}" name="${project.name}" plugins-version="2">
<plugin-info>
<description>${project.description}</description>
<version>${project.version}</version>
<vendor name="${project.organization.name}" url="${project.organization.url}" />
<param name="plugin-icon">images/gist-icon.png</param>
<param name="plugin-logo">images/pluginLogo.png</param>
<param name="atlassian-data-center-compatible">true</param>
</plugin-info>
<resource key="images" name="images/" type="download" location="images"/>
<xhtml-macro name="xhtml-gist-macro"
key="xhtml-gist-macro"
i18n-name-key="me.davidsimpson.confluence.addon.gister.xhtml-gist-macro.name"
class="me.davidsimpson.confluence.addon.gister.macro.GistMacro"
icon="/download/resources/${project.groupId}.${project.artifactId}/images/gist-icon.png">
<description key="me.davidsimpson.confluence.addon.gister.xhtml-gist-macro.desc"/>
<category name="external-content"/>
<parameters>
<parameter name="url" type="string" required="true"></parameter>
</parameters>
</xhtml-macro>
...
Others likely do it in different ways. This worked for me, so I’ve moved on
Thank you david, for the quick and correct reply. This worked for me.
For reference: what I did wrong was to put the resource download into a web-resource module. Might have worked if referenced differently/correctly.