提交 764b2ae6 编写于 作者: R rebornix

Add/Delete cell with right model update.

上级 6cd184e2
...@@ -477,7 +477,6 @@ export class NotebookEditor extends BaseEditor implements INotebookEditor, Noteb ...@@ -477,7 +477,6 @@ export class NotebookEditor extends BaseEditor implements INotebookEditor, Noteb
let newCell = this.instantiationService.createInstance(CellViewModel, this.viewType!, this.model!.notebook!.handle, newModeCell!, false); let newCell = this.instantiationService.createInstance(CellViewModel, this.viewType!, this.model!.notebook!.handle, newModeCell!, false);
this.viewCells!.splice(insertIndex, 0, newCell); this.viewCells!.splice(insertIndex, 0, newCell);
this.model!.insertCell(newCell.cell, insertIndex);
this.list?.splice(insertIndex, 0, [newCell]); this.list?.splice(insertIndex, 0, [newCell]);
this.list?.setFocus([insertIndex]); this.list?.setFocus([insertIndex]);
...@@ -532,7 +531,6 @@ export class NotebookEditor extends BaseEditor implements INotebookEditor, Noteb ...@@ -532,7 +531,6 @@ export class NotebookEditor extends BaseEditor implements INotebookEditor, Noteb
// await this.notebookService.createNotebookCell(this.viewType!, this.model!.notebook!.uri, insertIndex, language, type); // await this.notebookService.createNotebookCell(this.viewType!, this.model!.notebook!.uri, insertIndex, language, type);
await this.notebookService.deleteNotebookCell(this.viewType!, this.model!.notebook!.uri, index); await this.notebookService.deleteNotebookCell(this.viewType!, this.model!.notebook!.uri, index);
this.viewCells!.splice(index, 1); this.viewCells!.splice(index, 1);
this.model!.deleteCell(cell.cell);
this.list?.splice(index, 1); this.list?.splice(index, 1);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册