1 Reply Latest reply on Sep 10, 2012 12:21 AM by piochoo

    Correctly Hide Edit Mode Elements in Preview Mode

    Jayatl Level 1



      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?


          if ((WCMMode.fromRequest(request) == WCMMode.EDIT) || (WCMMode.fromRequest(request) == WCMMode.DESIGN)) {    
              %><div>Edit mode only text</div><%
          } else { 
              %><div>Preview/Publish mode text</div><%