Make "Double-click to edit" in empty md cell a bit nicer looking (#4102)

This commit is contained in:
Chris LaFreniere
2019-02-22 14:00:35 -10:00
committed by Kevin Cunnane
parent 889d5e5b28
commit 1e915aad20

View File

@@ -129,9 +129,10 @@ export class TextCellComponent extends CellView implements OnInit, OnChanges {
private updatePreview() {
if (this._content !== this.cellModel.source || this.cellModel.source.length === 0) {
if (!this.cellModel.source && !this.isEditMode) {
(<HTMLElement>this.output.nativeElement).innerHTML = localize('doubleClickEdit', 'Double-click to edit');
this._content = localize('doubleClickEdit', 'Double-click to edit');
} else {
this._content = this.sanitizeContent(this.cellModel.source);
}
// todo: pass in the notebook filename instead of undefined value
this._commandService.executeCommand<string>('notebook.showPreview', undefined, this._content).then((htmlcontent) => {
let outputElement = <HTMLElement>this.output.nativeElement;
@@ -139,7 +140,6 @@ export class TextCellComponent extends CellView implements OnInit, OnChanges {
});
}
}
}
//Sanitizes the content based on trusted mode of Cell Model
private sanitizeContent(content: string): string {