(panel: ApprovalPanelComponent, block: ApprovalPreviewBlock)
| 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; |
no test coverage detected