Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Create custom macro dialog in confluence

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?

4 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

2 votes
Answer accepted

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()")
	}
});


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});

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 !

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.

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.

Hi All,

If any one knows how to include the "preview" and "parameters" to custom dialog please let me know.

Thanks

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you