Notebooks: Add Placeholder Cell, Fix Link Styling (#3728)

* Placeholder cell to add new real cells

* Fix links in notebooks to show correct color, rely on angular ngif for placeholder

* Fix failing test where one cell was expected by default

* Remove unnecessary TODO
This commit is contained in:
Chris LaFreniere
2019-01-14 17:29:06 -08:00
committed by GitHub
parent 6dc4096299
commit e0ceddce09
11 changed files with 140 additions and 20 deletions

View File

@@ -217,7 +217,7 @@ export class NotebookModel extends Disposable implements INotebookModel {
}
let factory = this.notebookOptions.factory;
// if cells already exist, create them with language info (if it is saved)
this._cells = undefined;
this._cells = [];
this._defaultLanguageInfo = {
name: this._providerId === SQL_NOTEBOOK_PROVIDER ? 'sql' : 'python',
version: ''
@@ -230,9 +230,6 @@ export class NotebookModel extends Disposable implements INotebookModel {
this._cells = contents.cells.map(c => factory.createCell(c, { notebook: this, isTrusted: isTrusted }));
}
}
if (!this._cells) {
this._cells = [this.createCell(CellTypes.Code)];
}
} catch (error) {
this._inErrorState = true;
throw error;
@@ -244,7 +241,7 @@ export class NotebookModel extends Disposable implements INotebookModel {
}
public addCell(cellType: CellType, index?: number): ICellModel {
if (this.inErrorState || !this._cells) {
if (this.inErrorState) {
return null;
}
let cell = this.createCell(cellType);