Viewing vs. Editing for a Confluence Macro

Is there a way to know which mode the macro is currently in? I’d like to display different components in a macro depending on whether or not the user is editing a confluence page.

Hi @RossTroha, currently this isn’t possible. Could you let us know your use case for displaying different UI in the edit view and the read view? Will help us to prioritise implementing functionality to enable your use case.

Keep in mind that one of the new Confluence Editor’s design principles is WYSIWYG, which means the edit mode should accurately reflect the view mode as much as possible. If you can think of other ways of achieving your use case, such as through macro configuration, we would love to hear about that too!

Ah yes, I think I remember seeing WYSIWYG mentioned in the docs. We’ll do it differently. Thanks for your time!

I want to bring up a use case where this principle does not work: exporting. I know currently Forge macros don’t have support for the export format anyway but unless you are planning to drop export support in Confluence I think this should happen in Forge at some point.

As an example our exporter apps (e.g. Scroll PDF Exporter, Scroll Word Exporter, …) provide macros that only output something when exporting and sometimes they don’t even output directly visible content (i.e. a “Page break” macro). These macros do not output anything in the page view but they need to do so in the editor, otherwise users can not see or edit the macro. This was already a problem with Connect macros in the new editor until we got the output.type parameter.

4 Likes

I’m tinkering with a demo macro now and trying to make a content-editable macro. Ideally I’d like to create an HTML / Javascript macro that would allow me to embed anything on a page. I have my custom resource set up, but still can’t find any mentioning in the docs of displaying a different ui in the edit view and the read view.

While my reading I also found some issues in this section here:

https://developer.atlassian.com/platform/forge/build-a-custom-ui-app-in-jira/#build-the-content-for-your-custom-ui

I believe it’s skipping a step, should read:

mkdir static
cd static
npx create-react-app hello-world
cd hello-world
npm install
npm run build

I’m eager to hear more about if there are plans to change this functionality for macros, I like the work on macro config, but call me old fashioned, I kind of like editing macros directly.

It makes so much sense to make an “edit” screen directly on the page. I know that there is a WYSIWYG attitude to most things, but headlines and TOC is not WYSIWYG. In the end it should be up to the developer.