I've tried to add styles to the Confluence editor. It wouldn't take them. Perhaps one of Atlassian's values is "Don't f@@k the editor".
<web-resource name="editor-scripts" key="editor-scripts">
<resource name="editor-templates.js" type="download"
location="assets/js/editor-templates.js" />
<!-- // TODO: Check whether I need a context here -->
</web-resource>
<web-resource name="editor-styles" key="editor-styles">
<resource name="css/confluence-editor.css" type="download"
location="assets/css/confluence-editor.css"/>
<dependency>com.atlassian.confluence.plugins:confluence-editor-plugins</dependency>
<dependency>${project.groupId}.${project.artifactId}:editor-scripts</dependency>
<dependency>com.atlassian.auiplugin:ajs</dependency>
<context>editor</context>
<!-- // TODO: Check whether I need all the dependencies here -->
</web-resource>
My confluence-editor.css
styles just wouldn't be accepted. Javascript injection worked just fine though. Perhaps I could use JS to inject my styles?
Yup. Adding this to my editor-templates.js
file worked a treat:
var editorCss = AJS.params.staticResourceUrlPrefix
+ '/download/resources/me.davidsimpson.confluence.addon.awesome-addon'
+ ':editor-styles/css/confluence-editor.css';
if (AJS.params.isDevMode) {
editorCss = editorCss + '?_=' + Date.now();
}
$('#wysiwygTextarea_ifr').contents().find('head').append(
'<link type="text/css" rel="stylesheet" href="' + editorCss + '" media="all">'
);
Note the cache busting timestamp for local development.