Update extension.js
This commit is contained in:
parent
6ed987881f
commit
7499aa08bb
|
@ -2,18 +2,11 @@ const vscode = require('vscode');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
function activate(context) {
|
function activate(context) {
|
||||||
// Registrar o comando para abrir a visualização
|
|
||||||
let disposable = vscode.commands.registerCommand('erikraftDrop.open', function () {
|
|
||||||
vscode.commands.executeCommand('workbench.view.extension.erikraftDrop');
|
|
||||||
});
|
|
||||||
|
|
||||||
// Registrar o provedor de visualização
|
// Registrar o provedor de visualização
|
||||||
const viewProvider = new ErikrafTDropViewProvider(context.extensionPath);
|
const viewProvider = new ErikrafTDropViewProvider(context.extensionPath);
|
||||||
context.subscriptions.push(
|
context.subscriptions.push(
|
||||||
vscode.window.registerWebviewViewProvider('erikraftDrop.view', viewProvider)
|
vscode.window.registerWebviewViewProvider('erikraftDrop.view', viewProvider)
|
||||||
);
|
);
|
||||||
|
|
||||||
context.subscriptions.push(disposable);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class ErikrafTDropViewProvider {
|
class ErikrafTDropViewProvider {
|
||||||
|
@ -34,8 +27,11 @@ class ErikrafTDropViewProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
getWebviewContent(webview) {
|
getWebviewContent(webview) {
|
||||||
const iconPath = webview.asWebviewUri(vscode.Uri.file(
|
const darkIconPath = webview.asWebviewUri(vscode.Uri.file(
|
||||||
path.join(this.extensionPath, 'images', 'icon.png')
|
path.join(this.extensionPath, 'images', 'ui-icon-dark.svg')
|
||||||
|
));
|
||||||
|
const lightIconPath = webview.asWebviewUri(vscode.Uri.file(
|
||||||
|
path.join(this.extensionPath, 'images', 'ui-icon-light.svg')
|
||||||
));
|
));
|
||||||
|
|
||||||
return `
|
return `
|
||||||
|
@ -85,7 +81,10 @@ class ErikrafTDropViewProvider {
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="icon-container">
|
<div class="icon-container">
|
||||||
<img src="${iconPath}" alt="ErikrafT Drop Icon" />
|
<picture>
|
||||||
|
<source srcset="${darkIconPath}" media="(prefers-color-scheme: dark)" />
|
||||||
|
<img src="${lightIconPath}" alt="ErikrafT Drop Icon" />
|
||||||
|
</picture>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<iframe
|
<iframe
|
||||||
|
|
Loading…
Reference in New Issue