@@ -58,7 +58,7 @@ export interface NotebookLayoutConfiguration {
58
58
cellToolbarInteraction : string ;
59
59
compactView : boolean ;
60
60
focusIndicator : 'border' | 'gutter' ;
61
- insertToolbarPosition : 'betweenCells' | 'notebookToolbar' | 'both' | 'hidden' ;
61
+ insertToolbarBetweenCells : boolean ;
62
62
insertToolbarAlignment : 'left' | 'center' ;
63
63
globalToolbar : boolean ;
64
64
consolidatedOutputButton : boolean ;
@@ -133,7 +133,7 @@ export class NotebookOptions extends Disposable {
133
133
constructor (
134
134
private readonly configurationService : IConfigurationService ,
135
135
private readonly notebookExecutionStateService : INotebookExecutionStateService ,
136
- private readonly overrides ?: { cellToolbarInteraction : string ; globalToolbar : boolean ; dragAndDropEnabled : boolean }
136
+ private readonly overrides ?: { cellToolbarInteraction : string ; globalToolbar : boolean ; dragAndDropEnabled : boolean ; insertToolbarBetweenCells ?: boolean }
137
137
) {
138
138
super ( ) ;
139
139
const showCellStatusBar = this . configurationService . getValue < ShowCellStatusBarType > ( NotebookSetting . showCellStatusBar ) ;
@@ -145,7 +145,7 @@ export class NotebookOptions extends Disposable {
145
145
const cellToolbarInteraction = overrides ?. cellToolbarInteraction ?? this . configurationService . getValue < string > ( NotebookSetting . cellToolbarVisibility ) ;
146
146
const compactView = this . configurationService . getValue < boolean | undefined > ( NotebookSetting . compactView ) ?? true ;
147
147
const focusIndicator = this . _computeFocusIndicatorOption ( ) ;
148
- const insertToolbarPosition = this . _computeInsertToolbarPositionOption ( ) ;
148
+ const insertToolbarBetweenCells = overrides ?. insertToolbarBetweenCells ?? this . _computeInsertToolbarBetweenCellsOption ( ) ;
149
149
const insertToolbarAlignment = this . _computeInsertToolbarAlignmentOption ( ) ;
150
150
const showFoldingControls = this . _computeShowFoldingControlsOption ( ) ;
151
151
// const { bottomToolbarGap, bottomToolbarHeight } = this._computeBottomToolbarDimensions(compactView, insertToolbarPosition, insertToolbarAlignment);
@@ -219,7 +219,7 @@ export class NotebookOptions extends Disposable {
219
219
cellToolbarInteraction,
220
220
compactView,
221
221
focusIndicator,
222
- insertToolbarPosition ,
222
+ insertToolbarBetweenCells ,
223
223
insertToolbarAlignment,
224
224
showFoldingControls,
225
225
fontSize,
@@ -369,7 +369,7 @@ export class NotebookOptions extends Disposable {
369
369
configuration . cellToolbarLocation = this . configurationService . getValue < string | { [ key : string ] : string } > ( NotebookSetting . cellToolbarLocation ) ?? { 'default' : 'right' } ;
370
370
}
371
371
372
- if ( cellToolbarInteraction && ! this . overrides ?. cellToolbarInteraction ) {
372
+ if ( cellToolbarInteraction && this . overrides ?. cellToolbarInteraction === undefined ) {
373
373
configuration . cellToolbarInteraction = this . configurationService . getValue < string > ( NotebookSetting . cellToolbarVisibility ) ;
374
374
}
375
375
@@ -389,8 +389,8 @@ export class NotebookOptions extends Disposable {
389
389
configuration . insertToolbarAlignment = this . _computeInsertToolbarAlignmentOption ( ) ;
390
390
}
391
391
392
- if ( insertToolbarPosition ) {
393
- configuration . insertToolbarPosition = this . _computeInsertToolbarPositionOption ( ) ;
392
+ if ( insertToolbarPosition && this . overrides ?. insertToolbarBetweenCells === undefined ) {
393
+ configuration . insertToolbarBetweenCells = this . _computeInsertToolbarBetweenCellsOption ( ) ;
394
394
}
395
395
396
396
if ( globalToolbar && this . overrides ?. globalToolbar === undefined ) {
@@ -479,8 +479,9 @@ export class NotebookOptions extends Disposable {
479
479
} ) ;
480
480
}
481
481
482
- private _computeInsertToolbarPositionOption ( ) {
483
- return this . configurationService . getValue < 'betweenCells' | 'notebookToolbar' | 'both' | 'hidden' > ( NotebookSetting . insertToolbarLocation ) ?? 'both' ;
482
+ private _computeInsertToolbarBetweenCellsOption ( ) {
483
+ const configValue = this . configurationService . getValue < 'betweenCells' | 'notebookToolbar' | 'both' | 'hidden' > ( NotebookSetting . insertToolbarLocation ) ?? 'both' ;
484
+ return configValue === 'betweenCells' || configValue === 'both' ;
484
485
}
485
486
486
487
private _computeInsertToolbarAlignmentOption ( ) {
@@ -547,34 +548,37 @@ export class NotebookOptions extends Disposable {
547
548
return this . _layoutConfiguration . cellStatusBarHeight ;
548
549
}
549
550
550
- private _computeBottomToolbarDimensions ( compactView : boolean , insertToolbarPosition : 'betweenCells' | 'notebookToolbar' | 'both' | 'hidden' , insertToolbarAlignment : 'left' | 'center' , cellToolbar : 'right' | 'left' | 'hidden' ) : { bottomToolbarGap : number ; bottomToolbarHeight : number } {
551
+ private _computeBottomToolbarDimensions ( compactView : boolean , insertToolbarBetweenCells : boolean , insertToolbarAlignment : 'left' | 'center' , cellToolbar : 'right' | 'left' | 'hidden' ) : { bottomToolbarGap : number ; bottomToolbarHeight : number } {
552
+ if ( ! insertToolbarBetweenCells ) {
553
+ return compactView ? {
554
+ bottomToolbarGap : 0 ,
555
+ bottomToolbarHeight : 0
556
+ } : {
557
+ bottomToolbarGap : 12 ,
558
+ bottomToolbarHeight : 12
559
+ } ;
560
+ }
561
+
551
562
if ( insertToolbarAlignment === 'left' || cellToolbar !== 'hidden' ) {
552
563
return {
553
564
bottomToolbarGap : 18 ,
554
565
bottomToolbarHeight : 18
555
566
} ;
556
567
}
557
568
558
- if ( insertToolbarPosition === 'betweenCells' || insertToolbarPosition === 'both' ) {
559
- return compactView ? {
560
- bottomToolbarGap : 12 ,
561
- bottomToolbarHeight : 20
562
- } : {
563
- bottomToolbarGap : 20 ,
564
- bottomToolbarHeight : 20
565
- } ;
566
- } else {
567
- return {
568
- bottomToolbarGap : 0 ,
569
- bottomToolbarHeight : 0
570
- } ;
571
- }
569
+ return compactView ? {
570
+ bottomToolbarGap : 12 ,
571
+ bottomToolbarHeight : 20
572
+ } : {
573
+ bottomToolbarGap : 20 ,
574
+ bottomToolbarHeight : 20
575
+ } ;
572
576
}
573
577
574
578
computeBottomToolbarDimensions ( viewType ?: string ) : { bottomToolbarGap : number ; bottomToolbarHeight : number } {
575
579
const configuration = this . _layoutConfiguration ;
576
580
const cellToolbarPosition = this . computeCellToolbarLocation ( viewType ) ;
577
- const { bottomToolbarGap, bottomToolbarHeight } = this . _computeBottomToolbarDimensions ( configuration . compactView , configuration . insertToolbarPosition , configuration . insertToolbarAlignment , cellToolbarPosition ) ;
581
+ const { bottomToolbarGap, bottomToolbarHeight } = this . _computeBottomToolbarDimensions ( configuration . compactView , configuration . insertToolbarBetweenCells , configuration . insertToolbarAlignment , cellToolbarPosition ) ;
578
582
return {
579
583
bottomToolbarGap,
580
584
bottomToolbarHeight
@@ -616,7 +620,7 @@ export class NotebookOptions extends Disposable {
616
620
}
617
621
618
622
computeTopInsertToolbarHeight ( viewType ?: string ) : number {
619
- if ( this . _layoutConfiguration . insertToolbarPosition === 'betweenCells' || this . _layoutConfiguration . insertToolbarPosition === 'both' ) {
623
+ if ( this . _layoutConfiguration . insertToolbarBetweenCells ) {
620
624
return SCROLLABLE_ELEMENT_PADDING_TOP ;
621
625
}
622
626
0 commit comments