I followed this doc, https://developer.atlassian.com/display/CONFDEV/Adding+an+Option+to+the+Editor+Insert+Menu to add my plugin to the "insert" menu. UNfortunately it is coming up with the same error as https://answers.atlassian.com/questions/27554/no-macro-metadata-when-editing-a-macro-in-editor (and I tried all resolutions there)
But more importantly I actually want to completely customize the content that shows there, and then link to a specific xwork action of mine, rather then just showing some plugin parameters.
What I really want is something like Gliffy's insert macro dialog.
It seems that I could use AJS to bind to the rich editor's init mode, and that's where the maze of JS in the confluence code loses me.
Anyone have experience with a custom dialog for macro?
Community moderators have prevented the ability to post new answers.
Hi Eddie,
I think this presentation has the information you are looking for: http://www.slideshare.net/GoAtlassian/pimp-my-confluence-plugin-atlascamp-2011. Specifically you probably want to use AJS.MacroBrowser.setMacroJsOverride to create your own dialog.
Thanks for the link, lots of good stuff there!
Question though, I don't technically have my own macro, but instead and hijacking that menu as a result of the "Add" menu disappearing in Confluence 5.
So it seems the AJS.MacroBrowser.setMacroJsOverride requires my macro name, and not necessary the id of the web-item. (at least it doesn't seem to be triggering for me)
<web-item key="editor-featured-macro-scribbles" name="Insert Scribbles" section="system.editor.featured.macros.default" weight="12"> <description>Adds a new scribbles to the current page</description> <label key="scribbles.action.add" /> <link linkId="scribble-macro"/><!-- name of macro to associate with --> </web-item>
OverridingTheMacroBrowser11AJS.MacroBrowser.setMacroJsOverride('scribble-macro',{opener: function(macro){ console.log(">>MacroJsOverride()") } });
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
THanks for the great link. Slide 135 is exactly what I want, but it seems to be misbehaving for me, perhaps just a fluke with my running SDK instance.
<!-- confluence 5 nix's the add menu, use insert instead.. --> <!-- https://developer.atlassian.com/display/CONFDEV/Adding+an+Option+to+the+Editor+Insert+Menu --> <!-- the link must be present, but contents are ignored. instead use a macro to bind to it --> <web-item key="editor-featured-macro-scribbles" name="Insert Scribbles" section="system.editor.featured.macros.default" weight="12"> <description>Adds a new scribbles to the current page</description> <label key="scribbles.action.add" /> <link linkId="scribble-macro"/><!-- name of macro to associate with --> </web-item> <xhtml-macro key="scribble-macro" name="scribble-macro" class="com.edwardawebb.confluence.scribbles.ScribbleMacro" > <!-- description is used in the macro browser --> <description key="scribbles.action.add">Insert Scribbles into the current page</description> <category name="visuals"/> </xhtml-macro>
function createScribbleMacro(){ console.log(">>createScribblesMacroDialog"); var dialog = new AJS.Dialog({ width:200, height:200, id:"dialog-name", closeOnOutsideClick: true }); dialog.show(); return dialog; } AJS.MacroBrowser.setMacroJsOverride('scribble-macro',{opener: createScribbleMacro});
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Seems my issue was with the macro module, apparently <parameters /> is required if you do not have any parameters, otherwise the macro is invalid and ignored.
After adding that and a clean/run cycle my custom dialog is appearing, Thanks again Matthew for the great resource !
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
OK, so I found that i can get a handle to the dialog using
AJS.bind("show.dialog", function(e, data) { //manipulate dialog here } });
But there is no way to determine if it is the dialog for my macro, or any other macro.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Been poking around a few more days with no luck. I am actually unsure now if blueprints are the way to make these dialigs or not. Still invesitgating a javascript route to hijack the dialog and add my own content.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.