Update extension.js

This commit is contained in:
ErikrafT 2025-05-04 09:26:20 -03:00 committed by GitHub
parent 6ed987881f
commit 7499aa08bb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 10 deletions

View File

@ -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