Files
Netcatty/components/ui/portal-container.tsx
T
Ryanisgoodandbincxz 6cfd319e3f feat: 在终端主机列表中新增和编辑主机 (#2363)
* docs: design terminal host management

* feat: add work-surface host editor state

* feat: add work-surface host editor layer

* feat: add host creation and edit menu actions

* feat: expose host management from terminal tree

* feat: edit hosts without leaving terminal

* fix: keep host editor subpanels interactive

* fix: keep terminal host toolbar unchanged

* chore: exclude internal design notes from PR

* fix: preserve terminal host editor state

* fix: harden terminal host editor interactions

* fix: fully hide inactive host editor

---------

Co-authored-by: bincxz <16399091+binaricat@users.noreply.github.com>
2026-07-21 16:51:03 +08:00

15 lines
485 B
TypeScript

import React, { createContext, useContext } from 'react';
const PortalContainerContext = createContext<HTMLElement | null>(null);
export const PortalContainerProvider: React.FC<{
container: HTMLElement | null;
children: React.ReactNode;
}> = ({ container, children }) => (
<PortalContainerContext.Provider value={container}>
{children}
</PortalContainerContext.Provider>
);
export const usePortalContainer = (): HTMLElement | null => useContext(PortalContainerContext);