Introduce Trust Book in Book Viewlet (#9414)

This commit is contained in:
Jorge Berumen
2020-03-13 09:11:38 -07:00
committed by GitHub
parent 744e655dd3
commit d5fdec5699
21 changed files with 590 additions and 10 deletions

View File

@@ -606,4 +606,25 @@ export class NotebookService extends Disposable implements INotebookService {
editor.navigateToSection(sectionId);
}
}
/**
* Trusts a notebook with the specified URI.
* @param notebookUri The notebook URI to set the trusted mode for.
* @param isTrusted True if the notebook is to be trusted, false otherwise.
*/
async setTrusted(notebookUri: URI, isTrusted: boolean): Promise<boolean> {
let editor = this.findNotebookEditor(notebookUri);
if (editor && editor.model) {
if (isTrusted) {
this._trustedCacheQueue.push(notebookUri);
} else {
this._unTrustedCacheQueue.push(notebookUri);
}
await this.updateTrustedCache();
editor.model.trustedMode = isTrusted;
}
return isTrusted;
}
}