Confluence: How to use a (user - or java-plugin-) macro to insert elements in Confluence 4.x WYSIWYG-Editor ?

Hello everybody,

is there a way to use a user-macro to just insert HTML and/or other macros into a page (which can be filled in as usual, without using parameters of the user macro) ?

For example, I have a user macro like this:

## Macro title: My Macro
## Macro has a body: Y or N
## Body processing: Selected body processing option
## Output: Selected output option
##
## Developed by: My Name
## Date created: dd/mm/yyyy
## Installed by: My Name

## This is an example macro
## @noparams
<ac:macro ac:name="details"><ac:rich-text-body><table><tbody><tr><td>insert keyword</td><td><p>insert text here</p></td></tr></tbody></table></ac:rich-text-body></ac:macro>

I know that I could replace one "insert keyword" with a macro-parameter and the second "insert text" with $body, but this is not as flexible as it would be if I could insert this way a complex page template which would show up WITH ALL ELEMENTS (secions, columns, Tables...) in the 4.x WYSIWYG Editor.

Just to be clear: I want to be able to insert "something" into a page which will be inserted "as is" and not "hidden" behind a gray box "my user macro name".

How can this be done?

Thanks a lot for any hint!

Sven

PS: Please vote here:

https://jira.atlassian.com/browse/CONF-11744

2 answers

1 accepted

0 votes
Accepted answer
David Simpson Community Champion Jan 22, 2012

Not possible with a user macro. Perhaps try using a template instead.

No way? Even not with reflection or something advanced?

Templates are "OLD 3.x Style", they are "deprecated"... To be able to use templates in 4.x in a acceptable way, there should be a XHTML-Storage-Format -> 3.x-Wiki-Markup-Converter. But this will never exists (I've seen all the big discussion threads about the new WYSIWYG-Editor and Wiki-Markup), as some new macros don't support the old syntax any more...

It should be possible to "inject" into the editor some "template-like" pre-configured macros using the new XHTML-Storage format as base... We just need to "hook"/"find" the call which does the initial "load" of the storage-format into the editor and call this from a user-macro (or a full-fashioned Java-macro if necessary)

Perhaps Atlassian will realize that 4.x-templates are - finally - not so difficult to implement ?!?

0 votes
Paul Curren Atlassian Team Jun 28, 2012

The closest we have is the facility for you to provide your own placeholder image.

See the developer documentation.

The general problem is that macro placeholders need to be as atomic as possible. You shouldn't be able to remove or change parts of them and you should be able to copy/paste or drag and drop them around the editor as a single entity.

We are already pushing the "illusion" with our table based body macro placeholders where we have a lot of special javascript that tries to make sure you cannot edit these tables.

There is a chance at some point in the (far) future that richer macro placeholders will be possible. It is pretty dependent on us moving our Editor to use contenteditable rather than the current designMode based approach.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted yesterday in Agile

What is Scrum? A good, bad, and ugly answer.

In a world of dark-scrum, faux-scrum, and scrum-butt, the question still remains: What is scrum and how do you do it “right?” That’s the question we set out to answer. I'm Max, I've been teaching c...

66 views 0 2
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you