Skip to content

Commit

Permalink
Fix error in HtmlContentView.ShowContent when no JS/CSS provided (#1925)
Browse files Browse the repository at this point in the history
  • Loading branch information
rkeithhill authored and TylerLeonhardt committed Apr 27, 2019
1 parent 6f91a44 commit 13f7387
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/features/CustomViews.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,18 @@ class HtmlContentView extends CustomView {
this.webviewPanel.dispose();
}

let localResourceRoots: vscode.Uri[] = this.htmlContent.javaScriptPaths.map((p) => {
return vscode.Uri.parse(path.dirname(p));
});
localResourceRoots = localResourceRoots.concat(this.htmlContent.styleSheetPaths.map((p) => {
return vscode.Uri.parse(path.dirname(p));
}));
let localResourceRoots: vscode.Uri[] = [];
if (this.htmlContent.javaScriptPaths) {
localResourceRoots = localResourceRoots.concat(this.htmlContent.javaScriptPaths.map((p) => {
return vscode.Uri.parse(path.dirname(p));
}));
}

if (this.htmlContent.styleSheetPaths) {
localResourceRoots = localResourceRoots.concat(this.htmlContent.styleSheetPaths.map((p) => {
return vscode.Uri.parse(path.dirname(p));
}));
}

this.webviewPanel = vscode.window.createWebviewPanel(
this.id,
Expand Down

0 comments on commit 13f7387

Please sign in to comment.