File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
packages/app/src/embed/components/App Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -137,7 +137,23 @@ export default class App extends React.PureComponent<{}, State> {
137137 this . setState ( { showEditor : false , showPreview : true } ) ;
138138 setMixedView = ( ) => this . setState ( { showEditor : true , showPreview : true } ) ;
139139
140- setCurrentModule = ( id : string ) => this . setState ( { currentModule : id } ) ;
140+ setCurrentModule = ( id : string ) => {
141+ const newState : {
142+ currentModule : string ,
143+ showEditor ?: boolean ,
144+ showPreview ?: boolean ,
145+ } = { currentModule : id } ;
146+
147+ if ( ! this . state . showEditor ) {
148+ newState . showEditor = true ;
149+ if ( this . state . showPreview ) {
150+ // Means that the user was only looking at preview, which suggests that the screen is small.
151+ newState . showPreview = false ;
152+ }
153+ }
154+
155+ this . setState ( newState ) ;
156+ } ;
141157
142158 toggleSidebar = ( ) = > this . setState ( { sidebarOpen : ! this . state . sidebarOpen } ) ;
143159
You can’t perform that action at this time.
0 commit comments