You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
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)");
document.body.appendChild(aux);
aux.focus();
document.execCommand("copy");
document.body.removeChild(aux);
}
+
<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.