Revert "extract _assertWebviewForMarkdownPreview"

This reverts commit e5afd67095.
This commit is contained in:
rebornix 2021-03-24 12:45:18 -07:00
parent 2c232fed6a
commit 15ba6b4c95
No known key found for this signature in database
GPG key ID: 181FC90D15393C20

View file

@ -2052,7 +2052,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
};
}
private async _assertWebviewForMarkdownPreview() {
async createMarkdownPreview(cell: MarkdownCellViewModel) {
if (!this.useRenderer) {
// TODO: handle case where custom renderer is disabled?
return;
@ -2065,10 +2065,6 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
if (!this._webview.isResolved()) {
await this._resolveWebview();
}
}
async createMarkdownPreview(cell: MarkdownCellViewModel) {
await this._assertWebviewForMarkdownPreview();
if (!this._webview) {
return;
@ -2079,25 +2075,69 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
}
async unhideMarkdownPreview(cell: MarkdownCellViewModel) {
await this._assertWebviewForMarkdownPreview();
if (!this.useRenderer) {
// TODO: handle case where custom renderer is disabled?
return;
}
if (!this._webview) {
return;
}
if (!this._webview.isResolved()) {
await this._resolveWebview();
}
await this._webview?.unhideMarkdownPreview(cell.id);
}
async hideMarkdownPreview(cell: MarkdownCellViewModel) {
await this._assertWebviewForMarkdownPreview();
if (!this.useRenderer) {
// TODO: handle case where custom renderer is disabled?
return;
}
if (!this._webview) {
return;
}
if (!this._webview.isResolved()) {
await this._resolveWebview();
}
await this._webview?.hideMarkdownPreview(cell.id);
}
async removeMarkdownPreview(cell: MarkdownCellViewModel) {
await this._assertWebviewForMarkdownPreview();
if (!this.useRenderer) {
// TODO: handle case where custom renderer is disabled?
return;
}
if (!this._webview) {
return;
}
if (!this._webview.isResolved()) {
await this._resolveWebview();
}
await this._webview?.removeMarkdownPreview(cell.id);
}
async updateMarkdownPreviewSelectionState(cell: ICellViewModel, isSelected: boolean): Promise<void> {
await this._assertWebviewForMarkdownPreview();
if (!this.useRenderer) {
// TODO: handle case where custom renderer is disabled?
return;
}
if (!this._webview) {
return;
}
if (!this._webview.isResolved()) {
await this._resolveWebview();
}
await this._webview?.updateMarkdownPreviewSelectionState(cell.id, isSelected);
}