mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-19 17:22:48 -05:00
Enable double click edit (#12200)
* fix to working version * add comment documentation * minor changes based on review * resolve comments * remnove unnecessary assignment
This commit is contained in:
@@ -57,6 +57,7 @@ import { NotebookInput } from 'sql/workbench/contrib/notebook/browser/models/not
|
||||
import { IColorTheme } from 'vs/platform/theme/common/themeService';
|
||||
import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { CellToolbarComponent } from 'sql/workbench/contrib/notebook/browser/cellViews/cellToolbar.component';
|
||||
|
||||
export const NOTEBOOK_SELECTOR: string = 'notebook-component';
|
||||
|
||||
@@ -71,6 +72,7 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
||||
|
||||
@ViewChildren(CodeCellComponent) private codeCells: QueryList<CodeCellComponent>;
|
||||
@ViewChildren(TextCellComponent) private textCells: QueryList<TextCellComponent>;
|
||||
@ViewChildren(CellToolbarComponent) private cellToolbar: QueryList<CellToolbarComponent>;
|
||||
|
||||
private _model: NotebookModel;
|
||||
protected _actionBar: Taskbar;
|
||||
@@ -85,6 +87,7 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
||||
private _navProvider: INavigationProvider;
|
||||
private navigationResult: nb.NavigationResult;
|
||||
public previewFeaturesEnabled: boolean = false;
|
||||
public doubleClickEditEnabled: boolean;
|
||||
|
||||
constructor(
|
||||
@Inject(forwardRef(() => ChangeDetectorRef)) private _changeRef: ChangeDetectorRef,
|
||||
@@ -113,6 +116,9 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
||||
this._register(this._configurationService.onDidChangeConfiguration(e => {
|
||||
this.previewFeaturesEnabled = this._configurationService.getValue('workbench.enablePreviewFeatures');
|
||||
}));
|
||||
this._register(this._configurationService.onDidChangeConfiguration(e => {
|
||||
this.doubleClickEditEnabled = this._configurationService.getValue('notebook.enableDoubleClickEdit');
|
||||
}));
|
||||
}
|
||||
|
||||
private updateProfile(): void {
|
||||
@@ -203,6 +209,18 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
||||
this.detectChanges();
|
||||
}
|
||||
|
||||
// Handles double click to edit icon change
|
||||
// See textcell.component.ts for changing edit behavior
|
||||
public enableActiveCellIconOnDoubleClick() {
|
||||
if (this.doubleClickEditEnabled) {
|
||||
const toolbarComponent = (<CellToolbarComponent>this.cellToolbar.first);
|
||||
const toolbarEditCellAction = toolbarComponent.getEditCellAction();
|
||||
if (!toolbarEditCellAction.editMode) {
|
||||
toolbarEditCellAction.editMode = !toolbarEditCellAction.editMode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add cell based on cell type
|
||||
public addCell(cellType: CellType, index?: number, event?: Event) {
|
||||
if (event) {
|
||||
|
||||
Reference in New Issue
Block a user