* Check if running in Office Add-in environment
()
| 53 | * Check if running in Office Add-in environment |
| 54 | */ |
| 55 | function isOfficeEnvironment(): boolean { |
| 56 | try { |
| 57 | return ( |
| 58 | typeof window !== "undefined" && |
| 59 | "Office" in window && |
| 60 | // eslint-disable-next-line @typescript-eslint/no-explicit-any |
| 61 | typeof (window as any).Office?.context !== "undefined" |
| 62 | ); |
| 63 | } catch { |
| 64 | return false; |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | // Check if we're in ISOLATED world (can access chrome.runtime.sendMessage) |
| 69 | const isIsolatedWorld = !!getBrowserAPI()?.runtime?.sendMessage; |