MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / openApprovalPreview

Method openApprovalPreview

apps/kimi-code/src/tui/kimi-tui.ts:2838–2855  ·  view source on GitHub ↗
(panel: ApprovalPanelComponent, block: ApprovalPreviewBlock)

Source from the content-addressed store, hash-verified

2836 // in the viewer, and restore on close. The approval panel instance is
2837 // kept around in `activeApprovalPanel` so its selection state survives.
2838 private openApprovalPreview(panel: ApprovalPanelComponent, block: ApprovalPreviewBlock): void {
2839 if (this.approvalPreview !== undefined) return;
2840 const savedChildren = [...this.state.ui.children];
2841 const viewer = new ApprovalPreviewViewer(
2842 {
2843 block,
2844 onClose: () => {
2845 this.closeApprovalPreview();
2846 },
2847 },
2848 this.state.terminal,
2849 );
2850 this.state.ui.clear();
2851 this.state.ui.addChild(viewer);
2852 this.state.ui.setFocus(viewer);
2853 this.state.ui.requestRender(true);
2854 this.approvalPreview = { component: viewer, savedChildren, panel };
2855 }
2856
2857 private closeApprovalPreview(): void {
2858 const preview = this.approvalPreview;

Callers 1

showApprovalPanelMethod · 0.95

Calls 5

closeApprovalPreviewMethod · 0.95
setFocusMethod · 0.80
clearMethod · 0.65
requestRenderMethod · 0.65
addChildMethod · 0.45

Tested by

no test coverage detected