Trying to hook up basic save for custom editors

This commit is contained in:
Matt Bierner
2019-11-18 11:18:12 -08:00
parent 942287eb44
commit 8bbe3157f0
8 changed files with 42 additions and 16 deletions

View File

@@ -256,6 +256,10 @@ export class ExtHostWebviewEditor extends Disposable implements vscode.WebviewPa
assertIsDefined(this._capabilities).editingCapability?.applyEdits(edits);
}
async _onSave(): Promise<void> {
await assertIsDefined(this._capabilities).editingCapability?.save();
}
private assertNotDisposed() {
if (this._isDisposed) {
throw new Error('Webview is disposed');
@@ -459,6 +463,11 @@ export class ExtHostWebviews implements ExtHostWebviewsShape {
panel._redoEdits(edits);
}
async $onSave(handle: WebviewPanelHandle): Promise<void> {
const panel = this.getWebviewPanel(handle);
return panel?._onSave();
}
private getWebviewPanel(handle: WebviewPanelHandle): ExtHostWebviewEditor | undefined {
return this._webviewPanels.get(handle);
}