mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-29 17:23:25 -05:00
Hide notebook toolbar icons in diff editor (#17303)
* hide notebook toolbar icons in diff editor * move showActions to notebookInput * make showActions readonly
This commit is contained in:
@@ -86,6 +86,8 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
||||
public previewFeaturesEnabled: boolean = false;
|
||||
public doubleClickEditEnabled: boolean;
|
||||
private _onScroll = new Emitter<void>();
|
||||
// Don't show the right hand toolbar actions if the notebook is created in a diff editor.
|
||||
private _showToolbarActions: boolean = this._notebookParams.input.showActions;
|
||||
|
||||
constructor(
|
||||
@Inject(forwardRef(() => ChangeDetectorRef)) private _changeRef: ChangeDetectorRef,
|
||||
@@ -481,12 +483,15 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
||||
{ element: kernelContainer },
|
||||
{ element: attachToContainer },
|
||||
{ element: spacerElement },
|
||||
{ element: viewsDropdownContainer },
|
||||
{ action: collapseCellsAction },
|
||||
{ action: clearResultsButton },
|
||||
{ action: this._trustedAction },
|
||||
{ action: runParametersAction },
|
||||
]);
|
||||
|
||||
if (this._showToolbarActions) {
|
||||
this._actionBar.addElement(viewsDropdownContainer);
|
||||
this._actionBar.addAction(collapseCellsAction);
|
||||
this._actionBar.addAction(clearResultsButton);
|
||||
this._actionBar.addAction(this._trustedAction);
|
||||
this._actionBar.addAction(runParametersAction);
|
||||
}
|
||||
} else {
|
||||
let kernelContainer = document.createElement('div');
|
||||
let kernelDropdown = this.instantiationService.createInstance(KernelsDropdown, kernelContainer, this.contextViewService, this.modelReady);
|
||||
@@ -523,11 +528,14 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
||||
{ action: addTextCellButton },
|
||||
{ element: kernelContainer },
|
||||
{ element: attachToContainer },
|
||||
{ action: this._trustedAction },
|
||||
{ action: this._runAllCellsAction },
|
||||
{ action: clearResultsButton },
|
||||
{ action: collapseCellsAction },
|
||||
]);
|
||||
|
||||
if (this._showToolbarActions) {
|
||||
this._actionBar.addAction(this._trustedAction);
|
||||
this._actionBar.addAction(clearResultsButton);
|
||||
this._actionBar.addAction(collapseCellsAction);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -589,12 +597,14 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
||||
* the primary array to the end of the toolbar.
|
||||
*/
|
||||
private fillInActionsForCurrentContext(): void {
|
||||
let primary: IAction[] = [];
|
||||
let secondary: IAction[] = [];
|
||||
let notebookBarMenu = this.menuService.createMenu(MenuId.NotebookToolbar, this.contextKeyService);
|
||||
let groups = notebookBarMenu.getActions({ arg: null, shouldForwardArgs: true });
|
||||
fillInActions(groups, { primary, secondary }, false, g => g === '', Number.MAX_SAFE_INTEGER, (action: SubmenuAction, group: string, groupSize: number) => group === undefined || group === '');
|
||||
this.addPrimaryContributedActions(primary);
|
||||
if (this._showToolbarActions) {
|
||||
let primary: IAction[] = [];
|
||||
let secondary: IAction[] = [];
|
||||
let notebookBarMenu = this.menuService.createMenu(MenuId.NotebookToolbar, this.contextKeyService);
|
||||
let groups = notebookBarMenu.getActions({ arg: null, shouldForwardArgs: true });
|
||||
fillInActions(groups, { primary, secondary }, false, g => g === '', Number.MAX_SAFE_INTEGER, (action: SubmenuAction, group: string, groupSize: number) => group === undefined || group === '');
|
||||
this.addPrimaryContributedActions(primary);
|
||||
}
|
||||
}
|
||||
|
||||
private detectChanges(): void {
|
||||
|
||||
Reference in New Issue
Block a user