Hi @ChongJingHong ,
We don’t have official public documentation for MacroJsOverrides
as far as I’m aware. However I’m more than happy to answer any questions about specific override functionality.
If you want to create an entirely custom dialog, you will have to override the opener
function.
If the opener
override is present, the macro browser
will call the custom opener
function rather than the default. You will then have to do all the work of rendering an AUI dialog
containing the content of the macro editor, including all of the parameter inputs fields, a save button and ideally a previewer. Then once the user clicks the save button, you can call tinymce.confluence.macrobrowser.macroBrowserComplete
with an object containing the macro parameter data to be stored on the page.
E.g.
AJS.toInit(function () {
AJS.MacroBrowser.setMacroJsOverride('macroName', { opener: function (macro) {
// add dialog2 to DOM and show dialog
submitButton.addEventListener('click', function(e) {
// Collect all user inputted macro data
tinymce.confluence.macrobrowser.macroBrowserComplete({name: 'macroName', params: macroData})
});
});
});
If you don’t need to override the entire macro editor dialog, a subset of the other supported macro overrides are:
Customise macro input fields
-
field
override to customise the specific field input elements
Callbacks to modify the raw macro data input by the user:
-
manipulateMarkup
- called once the macro editor form submit has been clicked. Called with the entire macro editor metadata including the parameters before the parameters are extracted from the form. -
beforeParamsRetrieved
- called aftermanipulateMarkup
with the final macro parameters right beforemacroBrowserComplete
is called.
Callback when previewing the macro:
-
postPreview
- called with the preview iframe element and macro metadata when the user previews the macro
We also have callbacks for when an existing macro is being edited
-
updateSelectedMacro
- called with the macro object -
getMacroDetailsFromSelectedMacro
- called with the macro metadata