From 0c848b720959ac7d3c20abe9c7d3eb12f526f494 Mon Sep 17 00:00:00 2001 From: Illia Kovalenko <23364749+illiakovalenko@users.noreply.github.com> Date: Tue, 5 Jul 2022 16:29:28 +0300 Subject: [PATCH] [sitecore-jss] Make it clear that isEditorActive only works in browser (#1089) --- packages/sitecore-jss/src/utils/editing.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/sitecore-jss/src/utils/editing.ts b/packages/sitecore-jss/src/utils/editing.ts index 2308d3b00e..7f2f43921f 100644 --- a/packages/sitecore-jss/src/utils/editing.ts +++ b/packages/sitecore-jss/src/utils/editing.ts @@ -16,6 +16,11 @@ type ExtendedWindow = Window & * Static utility class for Sitecore Experience Editor */ export class ExperienceEditor { + /** + * Determines whether the current execution context is within a Experience Editor. + * Experience Editor environment can be identified only in the browser + * @returns true if executing within a Experience Editor + */ static isActive(): boolean { if (isServer()) { return false; @@ -43,6 +48,11 @@ export const ChromeRediscoveryGlobalFunctionName = { * Static utility class for Sitecore Horizon Editor */ export class HorizonEditor { + /** + * Determines whether the current execution context is within a Horizon Editor. + * Horizon Editor environment can be identified only in the browser + * @returns true if executing within a Horizon Editor + */ static isActive(): boolean { if (isServer()) { return false; @@ -61,7 +71,8 @@ export class HorizonEditor { } /** - * Determines whether the current execution context is within a Sitecore editor + * Determines whether the current execution context is within a Sitecore editor. + * Sitecore Editor environment can be identified only in the browser * @returns true if executing within a Sitecore editor */ export const isEditorActive = (): boolean => {