mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-29 01:25:37 -05:00
Set notebook as trusted after executing a cell. (#9108)
* Also set trusted by default when opening a notebook without any code cells.
This commit is contained in:
@@ -339,6 +339,8 @@ export class CellModel implements ICellModel {
|
||||
}
|
||||
let content = this.source;
|
||||
if ((Array.isArray(content) && content.length > 0) || (!Array.isArray(content) && content)) {
|
||||
this.notebookModel.trustedMode = true;
|
||||
|
||||
// requestExecute expects a string for the code parameter
|
||||
content = Array.isArray(content) ? content.join('') : content;
|
||||
const future = kernel.requestExecute({
|
||||
|
||||
@@ -308,6 +308,11 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Trust notebook by default if there are no code cells
|
||||
if (this._cells.length === 0 || this._cells.every(cell => cell.cellType === CellTypes.Markdown)) {
|
||||
this.trustedMode = true;
|
||||
}
|
||||
} catch (error) {
|
||||
this._inErrorState = true;
|
||||
throw error;
|
||||
|
||||
Reference in New Issue
Block a user