Skip to content

Commit b8e979f

Browse files
Merge pull request #51 from adobe/issue/detect-remoteapp
fix: deprecate isInEditor and update its usage to isInEditor from page model manager
2 parents 06d0d8d + b7eea37 commit b8e979f

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/EditorContext.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
*/
1212

1313
import React from 'react';
14-
import Utils from './Utils';
14+
import { AuthoringUtils } from '@adobe/aem-spa-page-model-manager';
1515

16-
const EditorContext = React.createContext(Utils.isInEditor());
16+
const EditorContext = React.createContext(AuthoringUtils.isInEditor());
1717

1818
const withEditorContext = (Component: React.ComponentType<any>): any => {
1919
const context = (props: React.ReactPropTypes): React.ReactElement => {

src/Utils.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*/
1212

1313
import { normalize as normalizePath } from 'path';
14-
import { AEM_MODE, Model, PathUtils } from '@adobe/aem-spa-page-model-manager';
14+
import { AEM_MODE, Model, PathUtils, AuthoringUtils } from '@adobe/aem-spa-page-model-manager';
1515
import { Constants } from './Constants';
1616

1717
/**
@@ -47,9 +47,10 @@ interface ComponentProps {
4747
const Utils = {
4848
/**
4949
* Is the app used in the context of the AEM Page editor.
50+
* @deprecated use AuthoringUtils.isInEditor from aem-spa-page-model-manager
5051
*/
5152
isInEditor(): boolean {
52-
return [ AEM_MODE.EDIT, AEM_MODE.PREVIEW ].includes(getWCMMode());
53+
return AuthoringUtils.isInEditor();
5354
},
5455

5556
/**

0 commit comments

Comments
 (0)