This commit is contained in:
2026-05-23 16:57:24 +08:00
parent 9d6ed4b0a5
commit 6be55255b2
10 changed files with 44 additions and 12 deletions

View File

@@ -1,9 +1,12 @@
import * as vscode from 'vscode';
export class LauncherViewProvider implements vscode.WebviewViewProvider {
constructor(private readonly context: vscode.ExtensionContext) {}
resolveWebviewView(view: vscode.WebviewView) {
view.webview.options = { enableScripts: true };
view.webview.html = getHtml();
const version = this.context.extension.packageJSON.version as string;
view.webview.html = getHtml(version);
view.webview.onDidReceiveMessage((msg) => {
if (msg?.type === 'open' && typeof msg.command === 'string') {
vscode.commands.executeCommand(msg.command);
@@ -12,7 +15,7 @@ export class LauncherViewProvider implements vscode.WebviewViewProvider {
}
}
function getHtml(): string {
function getHtml(version: string): string {
return `<!DOCTYPE html>
<html>
<head>
@@ -35,7 +38,7 @@ function getHtml(): string {
</style>
</head>
<body>
<h3>HPL Toolbox</h3>
<h3>HPL Toolbox ${version}</h3>
<button class="tool-btn" data-cmd="hplToolbox.openPlecUpload">
PLEC Upload
<span class="tool-desc">Upload HTML to internal PLEC server</span>