Tweak WebviewPanelOnDidChangeViewStateEvent to only provide a webview panel

Expose a webview panel's view state as properties. Make WebviewPanelOnDidChangeViewStateEvent only fire an event with the webview who's state changed
This commit is contained in:
Matt Bierner
2018-04-12 14:22:26 -07:00
parent 23113a4443
commit e16ec3c1ff
3 changed files with 20 additions and 10 deletions

View File

@@ -147,13 +147,13 @@ export class MarkdownPreviewManager implements vscode.WebviewPanelSerializer {
}
});
preview.onDidChangeViewState(({ active }) => {
preview.onDidChangeViewState(({ webviewPanel }) => {
disposeAll(this.previews.filter(otherPreview => preview !== otherPreview && preview!.matches(otherPreview)));
vscode.commands.executeCommand('setContext', MarkdownPreviewManager.markdownPreviewActiveContextKey,
active);
webviewPanel.visible);
this.activePreview = active ? preview : undefined;
this.activePreview = webviewPanel.visible ? preview : undefined;
});
return preview;