Check if in-place editing is active

I see. The in-place editor retrieves the rendered page content using an URL like this:

/xwiki/bin/view/Sandbox/?xpage=rendercontent&outputTitle=true&outputSyntax=annotatedxhtml&language=en&timestamp=1590141362584

So you’ll have to rely on one of these request parameters to determine if your macro is being edited in-place. I would check the outputSyntax because the annotatedxhtml syntax is specific to the WYSIWYG editor. So you could write:

#if ($xcontext.action == 'get' || $xcontext.action == 'edit' || $request.outputSyntax == 'annotatedxhtml')

Hope this helps,
Marius