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

Sven
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 19, 2012

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
David at David Simpson Apps
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
January 22, 2012

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

Sven
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 23, 2012

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
Atlassian Team members are employees working across the company in a wide variety of roles.
June 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.

TAGS
AUG Leaders

Atlassian Community Events