Skip to content

Commit

Permalink
fix: webview options
Browse files Browse the repository at this point in the history
  • Loading branch information
regchiu committed May 25, 2024
1 parent 470ba8a commit af33bc4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/dotlottieEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export class DotlottieEditorProvider implements vscode.CustomEditorProvider<Dotl
new DotlottieEditorProvider(context),
{
webviewOptions: {
retainContextWhenHidden: true,
retainContextWhenHidden: false,
},
supportsMultipleEditorsPerDocument: false,
},
Expand Down Expand Up @@ -195,7 +195,7 @@ export class DotlottieEditorProvider implements vscode.CustomEditorProvider<Dotl

webviewPanel.webview.html = this.getHtmlForWebview(webviewPanel.webview)
// Pass dotlottie uri to webview
await webviewPanel.webview.postMessage(webviewPanel.webview.asWebviewUri(document.uri))
webviewPanel.webview.postMessage(webviewPanel.webview.asWebviewUri(document.uri))

webviewPanel.webview.onDidReceiveMessage((e) => this.onMessage(document, e))

Expand Down
4 changes: 2 additions & 2 deletions src/lottieViewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,14 @@ export class LottieViewerPanel {
this._updateForFile(webview, jsonUri)
}

private async _updateForFile(webview: vscode.Webview, jsonUri: vscode.Uri) {
private _updateForFile(webview: vscode.Webview, jsonUri: vscode.Uri) {
const fileName = posix.basename(jsonUri.path)

this._panel.title = `VSCode Lottie Preview | ${fileName}`

this._panel.webview.html = this._getHtmlForWebview(webview)
// Pass dotlottie uri to webview
await this._panel.webview.postMessage(webview.asWebviewUri(jsonUri))
this._panel.webview.postMessage(webview.asWebviewUri(jsonUri))
}

private _getHtmlForWebview(webview: vscode.Webview) {
Expand Down

0 comments on commit af33bc4

Please sign in to comment.