Notebooks: Fix double-click to edit with source as array (#7027)

* Fix dbl click to  edit with source as array

* Fix equality check
This commit is contained in:
Chris LaFreniere
2019-09-03 10:37:19 -07:00
committed by GitHub
parent 33a7fe38e1
commit 4626f37671

View File

@@ -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;