mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
@@ -36,6 +36,7 @@ import { onUnexpectedError } from 'vs/base/common/errors';
|
|||||||
import { INotification, INotificationService } from 'vs/platform/notification/common/notification';
|
import { INotification, INotificationService } from 'vs/platform/notification/common/notification';
|
||||||
import Severity from 'vs/base/common/severity';
|
import Severity from 'vs/base/common/severity';
|
||||||
import * as nls from 'vs/nls';
|
import * as nls from 'vs/nls';
|
||||||
|
import { NotebookModel } from 'sql/workbench/services/notebook/browser/models/notebookModel';
|
||||||
|
|
||||||
export type ModeViewSaveHandler = (handle: number) => Thenable<boolean>;
|
export type ModeViewSaveHandler = (handle: number) => Thenable<boolean>;
|
||||||
|
|
||||||
@@ -87,6 +88,12 @@ export class NotebookEditorModel extends EditorModel {
|
|||||||
let dirty = this.textEditorModel instanceof ResourceEditorModel ? false : this.textEditorModel.isDirty();
|
let dirty = this.textEditorModel instanceof ResourceEditorModel ? false : this.textEditorModel.isDirty();
|
||||||
this.setDirty(dirty);
|
this.setDirty(dirty);
|
||||||
}));
|
}));
|
||||||
|
this._register(this.textEditorModel.onDidLoad(async (e) => {
|
||||||
|
if (this.textEditorModel instanceof TextFileEditorModel) {
|
||||||
|
let model = this.getNotebookModel() as NotebookModel;
|
||||||
|
await model.loadContents(model.trustedMode, true);
|
||||||
|
}
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this._dirty = this.textEditorModel instanceof ResourceEditorModel ? false : this.textEditorModel.isDirty();
|
this._dirty = this.textEditorModel instanceof ResourceEditorModel ? false : this.textEditorModel.isDirty();
|
||||||
|
|||||||
@@ -339,6 +339,7 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
|||||||
this._register(model.onProviderIdChange((provider) => this.handleProviderIdChanged(provider)));
|
this._register(model.onProviderIdChange((provider) => this.handleProviderIdChanged(provider)));
|
||||||
this._register(model.kernelChanged((kernelArgs) => this.handleKernelChanged(kernelArgs)));
|
this._register(model.kernelChanged((kernelArgs) => this.handleKernelChanged(kernelArgs)));
|
||||||
this._register(model.onCellTypeChanged(() => this.detectChanges()));
|
this._register(model.onCellTypeChanged(() => this.detectChanges()));
|
||||||
|
this._register(model.layoutChanged(() => this.detectChanges()));
|
||||||
this._model = this._register(model);
|
this._model = this._register(model);
|
||||||
await this._model.loadContents(trusted);
|
await this._model.loadContents(trusted);
|
||||||
this.setLoading(false);
|
this.setLoading(false);
|
||||||
|
|||||||
@@ -322,7 +322,7 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
|||||||
return !ids ? [] : ids;
|
return !ids ? [] : ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async loadContents(isTrusted: boolean = false): Promise<void> {
|
public async loadContents(isTrusted = false, forceLayoutChange = false): Promise<void> {
|
||||||
try {
|
try {
|
||||||
this._trustedMode = isTrusted;
|
this._trustedMode = isTrusted;
|
||||||
|
|
||||||
@@ -369,6 +369,9 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
|||||||
if (this._cells.length === 0 || this._cells.every(cell => cell.cellType === CellTypes.Markdown)) {
|
if (this._cells.length === 0 || this._cells.every(cell => cell.cellType === CellTypes.Markdown)) {
|
||||||
this.trustedMode = true;
|
this.trustedMode = true;
|
||||||
}
|
}
|
||||||
|
if (forceLayoutChange) {
|
||||||
|
this._layoutChanged.fire();
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this._inErrorState = true;
|
this._inErrorState = true;
|
||||||
throw error;
|
throw error;
|
||||||
|
|||||||
Reference in New Issue
Block a user