-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: open in new window function without content (#579)
Refs: IRIS-5012
- Loading branch information
Showing
10 changed files
with
73 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
src/views/app/extra-windows/global-extra-window-manager.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2023 Zextras <https://www.zextras.com> | ||
* | ||
* SPDX-License-Identifier: AGPL-3.0-only | ||
*/ | ||
import React, { useEffect } from 'react'; | ||
|
||
import { ExtraWindowsManager, useExtraWindowsManager } from './extra-window-manager'; | ||
import { ExtraWindowsContextType, ExtraWindowsCreationResult } from '../../../types'; | ||
|
||
const globalContext: ExtraWindowsContextType = { | ||
createWindow: (): ExtraWindowsCreationResult => { | ||
throw new Error('global extra window manager not initialized'); | ||
}, | ||
closeWindow: () => { | ||
throw new Error('global extra window manager not initialized'); | ||
}, | ||
getWindow: () => { | ||
throw new Error('global extra window manager not initialized'); | ||
}, | ||
getFocusedWindow: () => { | ||
throw new Error('global extra window manager not initialized'); | ||
} | ||
}; | ||
|
||
const GlobalExtraWindowManagerProvider = (): null => { | ||
const context = useExtraWindowsManager(); | ||
useEffect(() => { | ||
globalContext.createWindow = context.createWindow; | ||
globalContext.closeWindow = context.closeWindow; | ||
globalContext.listWindows = context.listWindows; | ||
globalContext.getWindow = context.getWindow; | ||
globalContext.getFocusedWindow = context.getFocusedWindow; | ||
}, [context]); | ||
return null; | ||
}; | ||
|
||
export const GlobalExtraWindowManager = ({ | ||
children | ||
}: React.PropsWithChildren<Record<string, unknown>>): React.JSX.Element => ( | ||
<ExtraWindowsManager> | ||
<GlobalExtraWindowManagerProvider /> | ||
{children} | ||
</ExtraWindowsManager> | ||
); | ||
|
||
export const useGlobalExtraWindowManager = (): ExtraWindowsContextType => { | ||
if (!globalContext) { | ||
throw new Error('global extra window manager not initialized'); | ||
} | ||
return globalContext; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters