mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-07 17:23:56 -05:00
Editor focus based on activeCell, create text in edit, scroll to active (#3725)
This commit is contained in:
@@ -62,6 +62,7 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
||||
private _defaultKernel: nb.IKernelSpec;
|
||||
private _activeCell: ICellModel;
|
||||
private _providerId: string;
|
||||
private _isNewNotebook: boolean = true;
|
||||
|
||||
constructor(private notebookOptions: INotebookModelOptions, startSessionImmediately?: boolean, private connectionProfile?: IConnectionProfile) {
|
||||
super();
|
||||
@@ -170,6 +171,10 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
||||
return this._trustedMode;
|
||||
}
|
||||
|
||||
public get isNewNotebook(): boolean {
|
||||
return this._isNewNotebook;
|
||||
}
|
||||
|
||||
public get providerId(): string {
|
||||
return this._providerId;
|
||||
}
|
||||
@@ -218,6 +223,7 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
||||
version: ''
|
||||
};
|
||||
if (contents) {
|
||||
this._isNewNotebook = false;
|
||||
this._defaultLanguageInfo = this.getDefaultLanguageInfo(contents);
|
||||
this._savedKernelInfo = this.getSavedKernelInfo(contents);
|
||||
if (contents.cells && contents.cells.length > 0) {
|
||||
@@ -250,7 +256,9 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
||||
index = undefined;
|
||||
}
|
||||
// Set newly created cell as active cell
|
||||
this._activeCell.active = false;
|
||||
if (this._activeCell) {
|
||||
this._activeCell.active = false;
|
||||
}
|
||||
this._activeCell = cell;
|
||||
this._activeCell.active = true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user