Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.
SOLVED

AEM 6.3 Check edit mode issue in HTL

Avatar

Level 1

Hi All,

We are using 6.3 and just giving <div data-sly-test="${wcmmode.edit}">Edit Mode</div> is not working.

If we remove editor.html/ from the url and reload it, the Edit Mode text still appear.

Tried the thing mentioned in http://wcmaem.blogspot.in/2016/07/how-to-check-touch-ui-mode-in-sightly.html but same issue, only adding ?wcmmode=disabled at the end of the url is working.

Is someone have a workaround ?

Regards

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@EmericL

You need to change the mode other than EDIT before reloading the page without editor.html

Hope this will help.



Arun Patidar

View solution in original post

3 Replies

Avatar

Level 10

It works fine - just tested. Here is my component:

<sly data-sly-test="${wcmmode.edit}">

     <h4>XYZ</h4>

</sly>

<sly data-sly-test="${wcmmode.disabled}">

     <h4>ABC</h4>

</sly>

In edit mode - XYZ shows up:

SoonersPage3.png

When page is displayed out of edit mode - XYZ disappears as expected:

SoonersPage4.png

Avatar

Correct answer by
Community Advisor

@EmericL

You need to change the mode other than EDIT before reloading the page without editor.html

Hope this will help.



Arun Patidar

Avatar

Level 1

Thanks for the tips arunp99088702 this was the issue.

I think it's not very usable and confusing for the user.

If we open two tabs, one in edit mode and the other in preview the last changed page mode is taken for both because this functionality is cookie based.