From 4626f376712932d0d498d5697cd6fea333f071a7 Mon Sep 17 00:00:00 2001 From: Chris LaFreniere <40371649+chlafreniere@users.noreply.github.com> Date: Tue, 3 Sep 2019 10:37:19 -0700 Subject: [PATCH] Notebooks: Fix double-click to edit with source as array (#7027) * Fix dbl click to edit with source as array * Fix equality check --- .../electron-browser/cellViews/textCell.component.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/sql/workbench/parts/notebook/electron-browser/cellViews/textCell.component.ts b/src/sql/workbench/parts/notebook/electron-browser/cellViews/textCell.component.ts index d4d8b655d7..decc9b2249 100644 --- a/src/sql/workbench/parts/notebook/electron-browser/cellViews/textCell.component.ts +++ b/src/sql/workbench/parts/notebook/electron-browser/cellViews/textCell.component.ts @@ -164,10 +164,12 @@ export class TextCellComponent extends CellView implements OnInit, OnChanges { */ private updatePreview(): void { let trustedChanged = this.cellModel && this._lastTrustedMode !== this.cellModel.trustedMode; - let contentChanged = this._content !== this.cellModel.source || this.cellModel.source.length === 0; + let cellModelSourceJoined = Array.isArray(this.cellModel.source) ? this.cellModel.source.join('') : this.cellModel.source; + let contentJoined = Array.isArray(this._content) ? this._content.join('') : this._content; + let contentChanged = contentJoined !== cellModelSourceJoined || cellModelSourceJoined.length === 0; if (trustedChanged || contentChanged) { this._lastTrustedMode = this.cellModel.trustedMode; - if (!this.cellModel.source && !this.isEditMode) { + if ((!cellModelSourceJoined) && !this.isEditMode) { this._content = localize('doubleClickEdit', "Double-click to edit"); } else { this._content = this.cellModel.source;