File tree Expand file tree Collapse file tree 3 files changed +9
-16
lines changed Expand file tree Collapse file tree 3 files changed +9
-16
lines changed Original file line number Diff line number Diff line change @@ -371,9 +371,10 @@ export interface MosaicWindowActions {
371
371
*/
372
372
replaceWithNew: () => Promise <void >;
373
373
/**
374
- * Sets the open state for the tray that holds additional controls
374
+ * Sets the open state for the tray that holds additional controls.
375
+ * Pass 'toggle' to invert the current state.
375
376
*/
376
- setAdditionalControlsOpen: (open : boolean ) => void ;
377
+ setAdditionalControlsOpen: (open : boolean | ' toggle ' ) => void ;
377
378
/**
378
379
* Returns the path to this window
379
380
*/
Original file line number Diff line number Diff line change @@ -230,13 +230,9 @@ export class InternalMosaicWindow<T extends MosaicKey> extends React.Component<
230
230
return Promise . resolve ( createNode ! ( ...args ) ) . then ( ( node ) => mosaicActions . replaceWith ( path , node ) ) ;
231
231
} ;
232
232
233
- private setAdditionalControlsOpen = ( additionalControlsOpen : boolean ) => {
234
- this . setState ( { additionalControlsOpen } ) ;
235
- this . props . onAdditionalControlsToggle ?.( additionalControlsOpen ) ;
236
- } ;
237
-
238
- private toggleAdditionalControlsOpen = ( ) => {
239
- const additionalControlsOpen = ! this . state . additionalControlsOpen ;
233
+ private setAdditionalControlsOpen = ( additionalControlsOpenOption : boolean | 'toggle' ) => {
234
+ const additionalControlsOpen =
235
+ additionalControlsOpenOption === 'toggle' ? ! this . state . additionalControlsOpen : additionalControlsOpenOption ;
240
236
this . setState ( { additionalControlsOpen } ) ;
241
237
this . props . onAdditionalControlsToggle ?.( additionalControlsOpen ) ;
242
238
} ;
@@ -254,7 +250,6 @@ export class InternalMosaicWindow<T extends MosaicKey> extends React.Component<
254
250
split : this . split ,
255
251
replaceWithNew : this . swap ,
256
252
setAdditionalControlsOpen : this . setAdditionalControlsOpen ,
257
- toggleAdditionalControlsOpen : this . toggleAdditionalControlsOpen ,
258
253
getPath : this . getPath ,
259
254
connectDragSource : this . connectDragSource ,
260
255
} ,
Original file line number Diff line number Diff line change @@ -76,13 +76,10 @@ export interface MosaicWindowActions {
76
76
*/
77
77
replaceWithNew : ( ...args : any [ ] ) => Promise < void > ;
78
78
/**
79
- * Sets the open state for the tray that holds additional controls
79
+ * Sets the open state for the tray that holds additional controls.
80
+ * Pass 'toggle' to invert the current state.
80
81
*/
81
- setAdditionalControlsOpen : ( open : boolean ) => void ;
82
- /**
83
- * Sets the open state for the tray that holds additional controls
84
- */
85
- toggleAdditionalControlsOpen : ( ) => void ;
82
+ setAdditionalControlsOpen : ( open : boolean | 'toggle' ) => void ;
86
83
/**
87
84
* Returns the path to this window
88
85
*/
You can’t perform that action at this time.
0 commit comments