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.
I. If you don't overwrite head.jsp
- Open /libs/wcm/core/components/init/init.jsp
- Add the previewReload property as follows and save the changes:
CQ.WCM.launchSidekick("<%= currentPage.getPath() %>", { propsDialog: "<%= dlgPath == null ? "" : dlgPath %>", locked: <%= currentPage.isLocked() %>, previewReload: "true" });
- Now CQ is setup to refresh automatically when switching to preview mode.
II. If you have overwritten head.jsp
- Overlay /libs/wcm/core/components/init/init.jsp by copy it to /apps/wcm/core/components/init/init.jsp
- Add the previewReload property as follows and save the changes:
CQ.WCM.launchSidekick("<%= currentPage.getPath() %>", { propsDialog: "<%= dlgPath == null ? "" : dlgPath %>", locked: <%= currentPage.isLocked() %>, previewReload: "true" });
- Include new file in head.jsp.
- Now CQ is setup to refresh automatically when switching to preview mode.
Nhận xét
Đăng nhận xét