| 689 | } |
| 690 | |
| 691 | protected makeEjsData(): EjsData { |
| 692 | const asLocalPath = (relPath: string) => { |
| 693 | if (!this.webviewPanel) { |
| 694 | return relPath; |
| 695 | } |
| 696 | const localUri = vscode.Uri.file(path.join(this.htmlRoot, relPath)); |
| 697 | return localUri.fsPath; |
| 698 | }; |
| 699 | const asWebViewPath = (localPath: string) => { |
| 700 | if (!this.webviewPanel) { |
| 701 | return localPath; |
| 702 | } |
| 703 | const localUri = vscode.Uri.file(path.join(this.htmlRoot, localPath)); |
| 704 | const webViewUri = this.webviewPanel.webview.asWebviewUri(localUri); |
| 705 | return webViewUri.toString(); |
| 706 | }; |
| 707 | let overwriteCssPath = ''; |
| 708 | if (this.customOverwriteCssPath) { |
| 709 | const uri = vscode.Uri.file(this.customOverwriteCssPath); |
| 710 | overwriteCssPath = this.webviewPanel?.webview.asWebviewUri(uri).toString() || ''; |
| 711 | } else { |
| 712 | overwriteCssPath = asWebViewPath('styleOverwrites.css'); |
| 713 | } |
| 714 | const ejsData: EjsData = { |
| 715 | overwriteStyles: this.stripStyles, |
| 716 | previewPlotLayout: this.previewPlotLayout, |
| 717 | plots: this.plots, |
| 718 | largePlot: this.plots[this.activeIndex], |
| 719 | activePlot: this.activePlot, |
| 720 | host: this.host, |
| 721 | asLocalPath: asLocalPath, |
| 722 | asWebViewPath: asWebViewPath, |
| 723 | makeCommandUri: makeWebviewCommandUriString, |
| 724 | overwriteCssPath: overwriteCssPath |
| 725 | }; |
| 726 | return ejsData; |
| 727 | } |
| 728 | |
| 729 | protected makeNewWebview(showOptions?: ShowOptions): vscode.WebviewPanel { |
| 730 | const webviewPanel = vscode.window.createWebviewPanel( |