Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

How to copy a Macro filled with content, without going into the Edit Mode?

Hey Guys,

I've been working on a solution to copy a macro filled with content, without going into the Edit mode. I did some research, I iterated on couple of drafts but to no avail.

Let me try to structure the problem, and path I went through.

1. Reasoning (the need)

The reason behind this kind of solution is to serve a user, that has read only permission, a possibilty to copy into his own Confluence page not only the outcome of the macro's work but also the whole macro filled with the content, so he/she can modify it, while keeping him/her from editing the page.

2. Example of use

There is a form (a ContiForm) pre-populated with content and variety of options already picked. Setting up such form takes a good while. Through such solution user could copy the form into his Confluence page, modify 1-2 fields and re-use the whole bunch of options. But he/she would not have a chance to change anything in the source page, since has read-only privileges.

3. Attempts

So I've tried adding js scripts through html macro, with and without using the jQuery.

The furthest I got was to copy specific part of the page with full formatting and function (the result of macro's work), but not the macro itself.

function copy(element_id){
var aux = document.createElement("div");
aux.setAttribute("contentEditable", true);
aux.innerHTML = document.getElementById(element_id).innerHTML;
aux.setAttribute("onfocus", "document.execCommand('selectAll',false,null)");


<p id="demo"><b>Bold text</b> and <u>underlined text</u>.</p>
<button onclick="copy('demo')">Copy Result</button>

I know it might seem this is a very hacky attempt, but that was my idea. I have no experience in velocity, nor I have administration privileges in the the said Confluence sever instance. Hence this is the way I tried to achieve the goal with such attempt.

4. Discussion starter

If you have any insight you might share, or idea of your own or some advice, I'd be more the happy to read your input.

Any constructive help would be most appreciated.



Log in or Sign up to comment
Community showcase
Published in Confluence

An update on Confluence Cloud customer feedback – June 2022

Hi everyone, We’re always looking at how to improve Confluence and customer feedback plays an important role in making sure we're investing in the areas that will bring the most value to the most c...

179 views 1 3
Read article

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