This document discusses how to add metadata to Confluence macros to improve the user experience. It covers adding basic metadata like the macro name, description and icon to make it visible in the macro browser. It also covers adding parameter metadata to generate a user-friendly macro form. JavaScript hooks can be used to further customize the form. The presentation demonstrates these techniques through an example macro and encourages attendees to apply them to their own macros to integrate with the macro browser and improve discoverability.
2. Throw your hands in the air!
• Written a Confluence plugin?
• Written a Confluence macro?
• Added basic metadata for all macros?
• For all macro parameters?
• With a custom user interface?
3. Fear & Loathing
• Confluence 4.0 == no wiki markup editor
• Macro metadata or bust
4. Always look on the bright side
• Macro Browser is your advertisement
• Browse / Search
• No more notation guide
• Five minutes
5. What’s covered?
• Basic metadata - the browser
• Parameter metadata - the macro form
• JavaScript hook intro
• Demo (FIVE MINUTES)
6. Who’s talking?
• David Taylor
• Confluence Developer
• 3 years on front-end features
• Co-wrote the Macro Browser
60. No API, No docs, No worries
AJS.MacroBrowser.setMacroJsOverride(macroName, override)
The override object has optional properties:
- fields,
- beforeParamsSet,
- beforeParamsRetrieved
- and some _really_ obscure ones
61. No API, No docs, No worries
override.fields
- overrides the parameter field UI based on
parameter type or parameter name
override.fields.string[“my-param”] = function(param) {
return AJS.MacroBrowser.ParameterFields["_hidden"]
(param, {});
}
- uses a hidden HTML text field for the “my-param” string
parameter.
62. No API, No docs, No worries
override.beforeParamsSet
- a function to run before an existing macro is loaded into
the parameter form fields
override.beforeParamsRetrieved
- a function to run before the form fields are converted
into a macro parameter string