How to detect if your macro is called while inplace-editing

Using the WYWSIG-Editor changes $xcontext.action to “edit”. The URL of the request typically contains now a “/bin/edit” and the query string an additional “editor=wysiwyg”, but the inplace-editor keeps the URL containing “/bin/view”, $xcontext.action=“view”.

The only change - I found - was the an additional “#edit” to the URL.
This is not reliable, you may have a local anchor.

The question remains: How to detect if your macro is called while inplace-editing?

Info: A macro is new evaluated if inplace-editing is started!

Info: The browser (firefox) shows the URL with “#edit”, but $request.getRequestURL() omit this.
This is correct: The anchor is not a part of the URL.

A nice application e.g. is a comment macro, which show additional infos while editing:
{{groovy}}
if (xcontext.action.equals(“edit”)) {print “{{wikimacrocontent/}}”} else {print “”}
{{/groovy}}

Thanks for help

Norbert

I found a work-around:

The variables inplaceEditingConfig and l10nKeys are not defined during (old) WYSIWYG-Editing and inplace-Editing.
So
if (binding.hasVariable("inplaceEditingConfig")) ...
or
if (binding.hasVariable("l10nKeys")) ..
helps.

Norbert