CQ5: preview mode in sidekick does not refresh automatically

Issue

If you are using the sidekick to switch between edit, design and preview modes, you may notice that the pages refreshes automatically when switching to edit and design mode, but not when switching to preview mode.

This can cause problems if you are using the WCMMode methods and properties in your application to display a different page view depending on the current mode (i.e. using conditional logic based on WCMMode.DESIGN, WCMMode.EDIT and WCMMode.PREVIEW).  If the page does not refresh when switching to preview mode, then it will display the same objects and state as it did in edit mode.

Solution

The solution is simply to force a page refresh automatically when switching to preview mode.

  1. Open /libs/wcm/core/components/init/init.jsp
  2. Add the previewReload property as follows and save the changes:
    CQ.WCM.launchSidekick("<%= currentPage.getPath() %>", {
        propsDialog: "<%= dlgPath == null ? "" : dlgPath %>",
        locked: <%= currentPage.isLocked() %>,
        previewReload: "true"
    });
  3. Now CQ is setup to refresh automatically when switching to preview mode.

reference: (32750)

VN:F [1.9.22_1171]
Was this helpful? Please rate the content.
Rating: 9.2/10 (13 votes cast)