From e8eb7bec1b9fbeb0804b710119485dfbbf9bfb93 Mon Sep 17 00:00:00 2001 From: Chris LaFreniere <40371649+chlafreniere@users.noreply.github.com> Date: Mon, 28 Jan 2019 14:02:23 -0800 Subject: [PATCH] Fix notebook selection issues including from placeholder (#3836) --- .../parts/notebook/cellViews/placeholderCell.component.html | 2 +- .../parts/notebook/cellViews/placeholderCell.component.ts | 5 ++++- src/sql/parts/notebook/notebook.component.ts | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/sql/parts/notebook/cellViews/placeholderCell.component.html b/src/sql/parts/notebook/cellViews/placeholderCell.component.html index 5679ce16bc..c70c404e9c 100644 --- a/src/sql/parts/notebook/cellViews/placeholderCell.component.html +++ b/src/sql/parts/notebook/cellViews/placeholderCell.component.html @@ -7,7 +7,7 @@
-

{{clickOn}} {{plusCode}} {{or}} {{plusText}} {{toAddCell}}

+

{{clickOn}} {{plusCode}} {{or}} {{plusText}} {{toAddCell}}

\ No newline at end of file diff --git a/src/sql/parts/notebook/cellViews/placeholderCell.component.ts b/src/sql/parts/notebook/cellViews/placeholderCell.component.ts index 1fe4ab13e3..38b73ce8e6 100644 --- a/src/sql/parts/notebook/cellViews/placeholderCell.component.ts +++ b/src/sql/parts/notebook/cellViews/placeholderCell.component.ts @@ -68,7 +68,10 @@ export class PlaceholderCellComponent extends CellView implements OnInit, OnChan return localize('toAddCell', 'to add a code or text cell'); } - public addCell(cellType: string): void { + public addCell(cellType: string, event?: Event): void { + if (event) { + event.stopPropagation(); + } let type: CellType = cellType; if (!type) { type = 'code'; diff --git a/src/sql/parts/notebook/notebook.component.ts b/src/sql/parts/notebook/notebook.component.ts index 98b2d91be2..af00049e83 100644 --- a/src/sql/parts/notebook/notebook.component.ts +++ b/src/sql/parts/notebook/notebook.component.ts @@ -173,14 +173,14 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe public unselectActiveCell() { if (this.model && this.model.activeCell) { this.model.activeCell.active = false; + this.model.activeCell = undefined; } this._changeRef.detectChanges(); } // Add cell based on cell type public addCell(cellType: CellType) { - let newCell = this._model.addCell(cellType); - this.selectCell(newCell); + this._model.addCell(cellType); } // Updates Notebook model's trust details