File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
ui/src/app/shared/components Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ const MonacoEditorLazy = React.lazy(() =>
3030 const Component = ( props : MonacoProps ) => {
3131 const [ height , setHeight ] = React . useState ( 0 ) ;
3232 const [ theme , setTheme ] = React . useState ( 'dark' ) ;
33+ const editorApiRef = React . useRef < monacoEditor . editor . IEditor | null > ( null ) ;
3334
3435 React . useEffect ( ( ) => {
3536 const destroySystemThemeListener = useSystemTheme ( systemTheme => {
@@ -55,6 +56,16 @@ const MonacoEditorLazy = React.lazy(() =>
5556 } ;
5657 } , [ ] ) ;
5758
59+ React . useEffect ( ( ) => {
60+ const onResize = ( ) => {
61+ editorApiRef . current ?. layout ( ) ;
62+ } ;
63+ window . addEventListener ( 'resize' , onResize ) ;
64+ return ( ) => {
65+ window . removeEventListener ( 'resize' , onResize ) ;
66+ } ;
67+ } , [ ] ) ;
68+
5869 return (
5970 < div
6071 style = { {
@@ -79,6 +90,7 @@ const MonacoEditorLazy = React.lazy(() =>
7990 } ) ;
8091
8192 container . editorApi = editor ;
93+ editorApiRef . current = editor ;
8294 }
8395
8496 const model = monaco . editor . createModel ( props . editor . input . text , props . editor . input . language ) ;
You can’t perform that action at this time.
0 commit comments