mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-18 09:35:39 -05:00
Introduce Trust Book in Book Viewlet (#9414)
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { ok } from 'vs/base/common/assert';
|
||||
@@ -50,6 +49,7 @@ export class ExtHostNotebookDocumentData implements IDisposable {
|
||||
get cells() { return data._cells; },
|
||||
get kernelSpec() { return data._kernelSpec; },
|
||||
save() { return data._save(); },
|
||||
setTrusted(isTrusted) { data._setTrusted(isTrusted); },
|
||||
validateCellRange(range) { return data._validateRange(range); },
|
||||
};
|
||||
}
|
||||
@@ -61,7 +61,13 @@ export class ExtHostNotebookDocumentData implements IDisposable {
|
||||
return Promise.reject(new Error('Document has been closed'));
|
||||
}
|
||||
return this._proxy.$trySaveDocument(this._uri);
|
||||
}
|
||||
|
||||
private _setTrusted(isTrusted: boolean): Thenable<boolean> {
|
||||
if (this._isDisposed) {
|
||||
return Promise.reject(new Error('Document has been closed'));
|
||||
}
|
||||
return this._proxy.$trySetTrusted(this._uri, isTrusted);
|
||||
}
|
||||
|
||||
public onModelChanged(data: INotebookModelChangedData) {
|
||||
|
||||
@@ -82,6 +82,10 @@ export class NotebookEditorEdit {
|
||||
return range;
|
||||
}
|
||||
|
||||
setTrusted(isTrusted: boolean) {
|
||||
this._document.setTrusted(isTrusted);
|
||||
}
|
||||
|
||||
insertCell(value: Partial<azdata.nb.ICellContents>, index?: number, collapsed?: boolean): void {
|
||||
if (index === null || index === undefined) {
|
||||
// If not specified, assume adding to end of list
|
||||
|
||||
@@ -891,6 +891,7 @@ export interface ExtHostNotebookDocumentsAndEditorsShape {
|
||||
}
|
||||
|
||||
export interface MainThreadNotebookDocumentsAndEditorsShape extends IDisposable {
|
||||
$trySetTrusted(_uri: UriComponents, isTrusted: boolean): Thenable<boolean>;
|
||||
$trySaveDocument(uri: UriComponents): Thenable<boolean>;
|
||||
$tryShowNotebookDocument(resource: UriComponents, options: INotebookShowOptions): Promise<string>;
|
||||
$tryApplyEdits(id: string, modelVersionId: number, edits: ISingleNotebookEditOperation[], opts: IUndoStopOptions): Promise<boolean>;
|
||||
|
||||
Reference in New Issue
Block a user