Documentation
Macro Editor
Macro Parameters go a long way when it comes to macro configuration, but there are cases when a macro add-on needs more control over the UI.
Defining a Macro Editor allows you to implement a custom UI for the macro, by specifying a URL to a page in your add-on which will be shown in the dialog iFrame.
In order to persist custom data in your macro editor, use the Javascript Confluence API and the Dialog API. For example:
AP.require(["confluence", "dialog"], function (confluence, dialog) {
function onSubmit() {
var macroParams = {
key: value
};
confluence.saveMacro(macroParams);
confluence.closeMacroEditor();
return true;
}
dialog.getButton("submit").bind(onSubmit);
}
Example
{
"editor": {
"url": "/generate_md",
"editTitle": {
"value": "Edit MarkDown",
"i18n": "macro.md.edit"
},
"insertTitle": {
"value": "Insert MarkDown",
"i18n": "macro.md.insert"
},
"width": "400px",
"height": "300px"
}
}
Properties
url
Type
stringuri-templateRequired
Yes
Description
The URL to the macro configuration page in the add-on.
height
Type
stringDescription
The preferred height of the edit dialog, e.g. 300px.
editTitle
Type
Description
An optional title that will be shown in the edit dialog header for an existing macro.
insertTitle
Type
Description
An optional title that will be shown in the edit dialog header for a new macro.
width
Type
stringDescription
The preferred width of the edit dialog, e.g. 500px.