Quantcast
Channel: Adobe Community : Popular Discussions - CQ5 (read only)
Viewing all articles
Browse latest Browse all 12476

Correctly Hide Edit Mode Elements in Preview Mode

$
0
0

Hello,

 

I wanted to know how I should modify the code below to correctly show content in the correct mode?  The code below works, but when switching to preview mode, I have to manually refresh the page to get the "Preview/Publish mode text" to disappear.  I'm aware I could modify the sidekick to force a refresh, but I'd prefer to do it similarly to how CQ does it (eliminate all edit mode components immediately without refreshing the page).  Thoughts?

 

import="com.day.cq.wcm.api.WCMMode"<%     if ((WCMMode.fromRequest(request) == WCMMode.EDIT) || (WCMMode.fromRequest(request) == WCMMode.DESIGN)) {           %><div>Edit mode only text</div><%    } else {        %><div>Preview/Publish mode text</div><%    };   
%>

Viewing all articles
Browse latest Browse all 12476

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>