Details
-
Bug
-
Resolution: Fixed
-
Critical
-
None
-
None
-
None
-
-
Empty show more show less
-
HL & LD 2
-
3
Description
inEditor() should only return true when in the actual editing view.
inEditorPreview() should true when in the preview mode (Same behavirour as it has now)
It is consistant cmsfn, it is more natural for developers to use in their apps, and it will fix the problem that the greenbars are rendered in the Page Editor Preview.
Notes
The helper functions exposed in react-editor and angular-editor, inEditor() and inEditorPreview() should peform the same function to our our freemarker templating functions cmsfn.
cmsfn.inEditMode()
cmsfn.inPreviewMode()
https://documentation.magnolia-cms.com/display/DOCS61/cmsfn#cmsfn-Checkforeditmode
But the behaviour is different.
In cmsfn, inEditMode() only returns true if you are in the PageEditor edit view, NOT if you are in the preview view.
As far as usage in the React and Angular apps - the most common question is “Am I in the actual page editor?” to know whether to call templateDefinitions endpoint or not. Now it is strange because I have to do something like
if (EditorContextHelper.inEditor && !EditorContextHelper.inEditorPreview(){ //call templateDefinitions }
Acceptance Criteria
- Ensure that green bars are not displayed in the Preview (as described below.)
Previous ticket description:
Preview in Admincentral shows green bars in React in 1.0.1
With react-editor 1.0.1, the adminCentral Preview also renders 'green bars', but it should not.
Note, this only happens if an Area is selected in the pageEditor, and then you switch to the Preview.
If no Areas are selected, then no green bars are rendered in the preview.
Potential root causes:
1. EmbeddableArea now calls the refresh() command:
I'm not sure why the area needs to call the refresh() command, I would think that it is up to the app itself to make these calls.
2. Currently any call to the mgnlRefresh() function must first check if the page is in Preview mode, because the inEditor() command returns true whether in preview mode or not. (see attached image)