From 14a80725513858d2316caa19d3ebc192b8c4084b Mon Sep 17 00:00:00 2001 From: Sevo Kukol Date: Tue, 12 Sep 2023 13:21:01 +0200 Subject: [PATCH] Add Platform.Fabric to run in context of Fabric --- src/ConfigContext.ts | 2 ++ src/Utils/WindowUtils.ts | 3 +++ src/hooks/useKnockoutExplorer.ts | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/src/ConfigContext.ts b/src/ConfigContext.ts index 18346e838..6a753a280 100644 --- a/src/ConfigContext.ts +++ b/src/ConfigContext.ts @@ -16,6 +16,7 @@ export enum Platform { Portal = "Portal", Hosted = "Hosted", Emulator = "Emulator", + Fabric = "Fabric", } export interface ConfigContext { @@ -187,6 +188,7 @@ export async function initializeConfiguration(): Promise { console.error(`Invalid platform query parameter: ${platform}`); break; case Platform.Portal: + case Platform.Fabric: case Platform.Hosted: case Platform.Emulator: updateConfigContext({ platform }); diff --git a/src/Utils/WindowUtils.ts b/src/Utils/WindowUtils.ts index 1ddd451e8..f426572b2 100644 --- a/src/Utils/WindowUtils.ts +++ b/src/Utils/WindowUtils.ts @@ -5,6 +5,9 @@ export const getDataExplorerWindow = (currentWindow: Window): Window | undefined if (currentWindow.parent === currentWindow) { return undefined; } + if (currentWindow.parent.parent === currentWindow.top) { // Fabric + return currentWindow; + } if (currentWindow.parent === currentWindow.top) { return currentWindow; } diff --git a/src/hooks/useKnockoutExplorer.ts b/src/hooks/useKnockoutExplorer.ts index 8e18c5732..b907bc3cc 100644 --- a/src/hooks/useKnockoutExplorer.ts +++ b/src/hooks/useKnockoutExplorer.ts @@ -60,6 +60,10 @@ export function useKnockoutExplorer(platform: Platform): Explorer { } else if (platform === Platform.Portal) { const explorer = await configurePortal(); setExplorer(explorer); + } else if (platform === Platform.Fabric) { + //TODO: need Fabric specific implementation similar to portal + const explorer = await configureHosted(); + setExplorer(explorer); } } };