I'm developing a macro, which uses it's parent page contents.
When this macro is rendered on a saved page, it reads its content normally. But when it is rendered in a preview mode and reads its parent page in the same manner, the page content is different: macros are replaced with Wysiwyg-macro and macro parameters are specified as parameters of this Wysiwyg-macro. Replacing this macro manually does not seem tobe a good solution, so I'm asking how to get normal page content, without Wysiwyg-macro?
When you install the Source Editor plugin above, once you've saved the page you can go in and edit again, and there will be a <> icon in the top right of the editor. You can click this and it will show all content as the source rather than WYSIWYG. Have you been able to test this, and is it what you require?
Note, it won't show the source content when just viewing the page, but it sounds like you only need it to display that content when editing. Is this correct?
Thank you for your answer.
I don't use Source Editor, I just read source page from my macro. Here is the code:
PageContext renderContext = conversionContext.getPageContext();
PageContext pageContext = ((PageContext) renderContext);
ContentEntityObject contentObject = pageContext.getEntity();
String page = contentObject.getBodyAsString();
So, the page variable contains page source in storage format, but all the macros on the page are enclosed in WYSIWYG macro body:
<td class="confluenceTd"> </td>
<td class="confluenceTd"><table class="wysiwyg-macro"
style="background-image: url('http://LEXUS:1990/confluence/plugins/servlet/confluence/placeholder/macro-heading?definition=e251bWVyaWNhbC1leHByZXNzaW9uOm91dGVyLXZhbHVlcy1zb3VyY2U9UGFnZSBjb250ZW50fGF0bGFzc2lhbi1tYWNyby1vdXRwdXQtdHlwZT1JTkxJTkV9&locale=en_GB&version=2'); background-repeat: no-repeat;"
What I need is to get page source without this WYSIWYG macro.
From my understanding, you wish to display the Confluence page as page source rather than WYSIWYG. Correct?
The Source Editor add-on that I recommended you install, will do just that, allow you to view Confluence pages in edit mode as the source, and not WYSIWYG.
If you've already tested that add-on, can you let me know why it might not work for your use case?
Thank you for letting me know why you weren't able to use the other add-on.
I'm still a little unclear on what you need to do exactly. Are you saying this is the functionality you want your macro to have? You want it to display page source in storage format anytime a user has it on a page and previews the page?
This sounds like something that our development community would need to help you with, so I will add the Confluence Development tag on your question and someone will be able to assist.
Hi my Community friends! For those who don't know me, I'm a product marketer on the Confluence Cloud team - nice to meet you! For those of you who do, you know that I've been all up in your Co...
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!
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