Macro $xcontext.action wrong stats in inline edit mode

Hi,

I want to write a macro, show different context between edit and view mode. In view mode I have HTML to display. If I use the macro just with the normal fullpage editor, everything works fine. But when a user press the “edit” button and it’s change to the inline editor. The variable “$xcontext.action” keep the state “view” and the html content is not shown at all.

here my code shorten to the essential part:

{{velocity}}
#if("$xcontext.action" == "view")
    {{html}}
      some html code
    {{/html}}
#else
  {{info}}
    rendering not supported!
  {{/info}}
#end
{{/velocity}}

When output $xcontext.action direct over the if condition, it’s stay at “view”. In the above example the whole macro is then show nothing in the inline editor mode.

How can I catch this case and maybe still presenting the else block?

Thanks for support.

Yes, this is something we now need to improve with the introduction of the inplace editing… It used to work but not anymore. We need to document it.

For now, please check Check if in-place editing is active - #4 by mflorea

Thanks

1 Like

Apparently this is not true, it was also failing before but it was less obvious to notice. From Marius:

with in-place you notice the problem when the editor is loaded. With standalone, you need to insert a new macro or edit an existing one, or toggle Source and back to notice it.