File tree Expand file tree Collapse file tree 3 files changed +80
-35
lines changed Expand file tree Collapse file tree 3 files changed +80
-35
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -267,13 +267,18 @@ function endingPosition(
267267 const inputNorthPanel = next . northPanel
268268 const inputSouthPanel = next . southPanel
269269
270- const {
270+ let {
271271 prevNorthFile,
272272 prevSouthFile,
273273 nextNorthFile,
274274 nextSouthFile,
275275 } = getStepFiles ( prev , next , false )
276276
277+ // getStepFiles return the intermediate files, we need to patch the ending state (2to1south)
278+ if ( ! inputSouthPanel && nextSouthFile ) {
279+ nextNorthFile = nextSouthFile
280+ }
281+
277282 return {
278283 northPanel : {
279284 tabs : inputNorthPanel . tabs . map ( title => ( {
Original file line number Diff line number Diff line change @@ -128,3 +128,77 @@ export const twoPanelEditor = () => {
128128 </ Page >
129129 )
130130}
131+
132+ export const twoToOneSouth = ( ) => {
133+ const [ first , setFirst ] = React . useState ( true )
134+ const files = [
135+ {
136+ name : "index.js" ,
137+ lang : "js" ,
138+ code : "console.log('index')" ,
139+ } ,
140+ {
141+ name : "app.js" ,
142+ lang : "js" ,
143+ code : "function app() {}" ,
144+ } ,
145+ ]
146+
147+ const props = first
148+ ? {
149+ files : [
150+ {
151+ name : "index.js" ,
152+ lang : "js" ,
153+ code : "console.log('index 1')" ,
154+ } ,
155+ {
156+ name : "app.js" ,
157+ lang : "js" ,
158+ code : "function app1() {}" ,
159+ } ,
160+ ] ,
161+ northPanel : {
162+ active : "app.js" ,
163+ tabs : [ "app.js" ] ,
164+ heightRatio : 0.5 ,
165+ } ,
166+ southPanel : {
167+ active : "index.js" ,
168+ tabs : [ "index.js" ] ,
169+ heightRatio : 0.5 ,
170+ } ,
171+ }
172+ : {
173+ files : [
174+ {
175+ name : "index.js" ,
176+ lang : "js" ,
177+ code : "console.log('index 2')" ,
178+ } ,
179+ {
180+ name : "app.js" ,
181+ lang : "js" ,
182+ code : "function app2() {}" ,
183+ } ,
184+ ] ,
185+ northPanel : {
186+ active : "index.js" ,
187+ tabs : [ "app.js" , "index.js" ] ,
188+ heightRatio : 0.5 ,
189+ } ,
190+ }
191+
192+ return (
193+ < Page >
194+ < Editor
195+ { ...props }
196+ codeProps = { { maxZoom : 1.2 , minColumns : 10 } }
197+ frameProps = { { height : 500 } }
198+ />
199+ < button onClick = { ( ) => setFirst ( ! first ) } >
200+ Toggle
201+ </ button >
202+ </ Page >
203+ )
204+ }
You can’t perform that action at this time.
0 commit comments