@@ -47,7 +47,6 @@ import {
4747} from 'shared/modules/stream/streamDuck'
4848import { sleep } from 'shared/services/utils'
4949import { FrameButton } from 'browser-components/buttons'
50- import ConfirmationDialog from 'browser-components/ConfirmationDialog'
5150import Render from 'browser-components/Render'
5251import { CSVSerializer } from 'services/serializer'
5352import {
@@ -133,7 +132,6 @@ function FrameTitlebar(props: FrameTitleBarProps) {
133132 // makes sure the frame is updated as links in frame is followed
134133 editorRef . current ?. setValue ( props . frame . cmd )
135134 } , [ props . frame . cmd ] )
136- const [ confirmationDialogOpen , setConfirmationDialogOpen ] = useState ( false )
137135 const editorRef = useRef < MonacoHandles > ( null )
138136
139137 /* When the frametype is changed the titlebar is unmounted
@@ -163,6 +161,17 @@ function FrameTitlebar(props: FrameTitleBarProps) {
163161 } , [ props . frame . isRerun ] )
164162 useEffect ( gainFocusCallback , [ gainFocusCallback ] )
165163
164+ useEffect ( ( ) => {
165+ if ( props . bus && props . fullscreen ) {
166+ return props . bus . take ( editor . SET_CONTENT , ( { message } ) => {
167+ setRenderEditor ( true )
168+ // timeout needed for editor to mount if not yet mounted.
169+ setTimeout ( ( ) => editorRef . current ?. setValue ( message ) , 0 )
170+ } )
171+ }
172+ return undefined
173+ } , [ props . bus , props . fullscreen ] )
174+
166175 function hasData ( ) {
167176 return props . numRecords > 0
168177 }
@@ -400,34 +409,10 @@ function FrameTitlebar(props: FrameTitleBarProps) {
400409 < SVGInline svg = { controlsPlay } width = "12px" />
401410 </ FrameButton >
402411 </ Render >
403- < ConfirmationDialog
404- confirmLabel = "Yes, close frame"
405- onClose = { ( ) => {
406- setConfirmationDialogOpen ( false )
407- } }
408- onConfirm = { ( ) => {
409- setConfirmationDialogOpen ( false )
410- props . onCloseClick ( frame . id , frame . requestId , props . request )
411- } }
412- open = { confirmationDialogOpen }
413- >
414- < h2 style = { { fontWeight : 'normal' } } > Close frame?</ h2 >
415- < p >
416- Closing the frame cannot be undone.
417- < br />
418- You can access you query history by running < code >
419- :history
420- </ code > { ' ' }
421- command.
422- </ p >
423- < p > Do you want to close the frame anyway?</ p >
424- </ ConfirmationDialog >
425412 < FrameButton
426413 title = "Close"
427414 onClick = { ( ) => {
428- frame . isRerun
429- ? setConfirmationDialogOpen ( true )
430- : props . onCloseClick ( frame . id , frame . requestId , props . request )
415+ props . onCloseClick ( frame . id , frame . requestId , props . request )
431416 } }
432417 >
433418 < CloseIcon />
0 commit comments