The StudioContext object is passed to every action handler, allowing developers to interact with the Studio's environment. Key capabilities include:
- Layout Management:
performSplit, closeContentPane, setRootLayoutNode, and setActiveContentPaneId allow for structural changes to the workspace. - Content Interaction:
contentDataRef provides a mutable reference to the current content data, and updateContentPane allows refreshing content. - Pane/Tab Navigation:
handleAddTab, handleTabClose, handleTabSelect, and toggleZenMode manage the lifecycle and visibility of UI elements. - Utility:
generateId for creating unique identifiers and findPanePath for locating specific nodes within the layout tree.
export interface StudioContext {
rootLayoutNode: any;
contentDataRef: React.MutableRefObject<Record<string, any>>;
activeContentPaneId: string;
setActiveContentPaneId: (id: string) => void;
setRootLayoutNode: (node: any) => void;
performSplit: (targetPath: number[], side: string, contentType: string, contentId: string, targetPaneId?: string) => void;
closeContentPane: (paneId: string, nodePath: number[]) => void;
updateContentPane: (paneId: string, contentType: string, contentId: string, skipMessageLoad?: boolean) => void;
handleAddTab?: (paneId: string, contentType: string) => void;
handleTabClose?: (paneId: string, tabIndex: number) => void;
handleTabSelect?: (paneId: string, tabIndex: number) => void;
toggleZenMode?: (paneId: string) => void;
generateId: () => string;
findPanePath: (node: any, paneId: string, path?: number[]) => number[] | null;
notifyPaneUpdate?: (paneId: string) => void;
windowId?: string;
currentPath?: string;
}