I’m developing an Addon for confluence cloud similar to the Expand but allowing the user to specify if it’s expanded by default with a parameter.
In the edit view everything looks fine
But I’m now struggling with the published view. I’m fetching the macro.body with the Id and trying to render it dynamically, but I’m missing something because it’s not being interpreted (it shows only the text and not the image for example)
But if I inspect the source I can see the actual markup, it’s not now being rendered and I can’t find in the api a way to process it.
Here’s the code that inserts the innerHTML for the div with the macro body
(It’s inside the HBS file)
AP.require("request", function(request) {
var pageId = getUrlParameter("pageId");
var pageVersion = getUrlParameter("pageVersion");
var macroId = getUrlParameter("macroId");
var macroHash = getUrlParameter("macroHash");
var macroTypeUrl = macroId ? "id/" + macroId : "hash/" + macroHash;
request({
url: "/rest/api/content/" + pageId +
"/history/" + pageVersion +
"/macro/" + macroTypeUrl,
success: function(response) {
var macro = JSON.parse(response);
document.getElementById('html-body').innerHTML = macro.body;
}, error: function(response) {
$("#html-body").html('ooops');
}
});
});
If someone could help me / point me in the right direction, that’d be fantastic!
Thanks!