mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-28 17:23:19 -05:00
Notebooks: Fix Selection/Focus when New Cells Added (#3649)
* Improvemnents to Active Cell * Fix minor spacing issue * fix editor focus order * Fix for add cell above/below * cleanup logic to have activeCell logic all reside in notebook model
This commit is contained in:
@@ -203,9 +203,9 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
||||
return this._cells.findIndex((cell) => cell.equals(cellModel));
|
||||
}
|
||||
|
||||
public addCell(cellType: CellType, index?: number): void {
|
||||
public addCell(cellType: CellType, index?: number): ICellModel {
|
||||
if (this.inErrorState || !this._cells) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
let cell = this.createCell(cellType);
|
||||
|
||||
@@ -215,12 +215,18 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
||||
this._cells.push(cell);
|
||||
index = undefined;
|
||||
}
|
||||
// Set newly created cell as active cell
|
||||
this._activeCell.active = false;
|
||||
this._activeCell = cell;
|
||||
this._activeCell.active = true;
|
||||
|
||||
this._contentChangedEmitter.fire({
|
||||
changeType: NotebookChangeType.CellsAdded,
|
||||
cells: [cell],
|
||||
cellIndex: index
|
||||
});
|
||||
|
||||
return cell;
|
||||
}
|
||||
|
||||
private createCell(cellType: CellType): ICellModel {
|
||||
|
||||
Reference in New Issue
Block a user