Detect Edit/Preview Mode of the Page


When editing a Confluence page, you can’t interact with the macro.
With a highly interactive macro, you often are tempted to interact with the macro
in edit/preview mode. So, we would like to disable interactive elements in edit mode to avoid this frustration, like remove links, gray out buttons etc.

With Atlassian Connect, you can find out the context with AP.navigator.getLocation, where there is a ‘contentedit’ target.
However, in Forge Custome-UI I couldn’t find this information. Is there a way to detect that the page is in edit mode / the macro in preview mode?


Duplicate question, see Viewing vs. Editing for a Confluence Macro