open image

This commit is contained in:
notoriousmango
2024-11-26 19:53:31 +09:00
parent 6b2777169d
commit 0b243279cc
7 changed files with 64 additions and 2 deletions

View File

@@ -443,6 +443,7 @@ export interface IManagedMarkdownPreview {
readonly onDidChangeViewState: vscode.Event<vscode.WebviewPanelOnDidChangeViewStateEvent>;
copyImage(id: string): void;
openImage(imagePath: string): void;
dispose(): void;
refresh(): void;
updateConfiguration(): void;
@@ -524,6 +525,12 @@ export class StaticMarkdownPreview extends Disposable implements IManagedMarkdow
});
}
openImage(imagePath: string): void {
const uri = vscode.Uri.file(imagePath);
this._webviewPanel.reveal();
vscode.commands.executeCommand('vscode.open', uri);
}
private readonly _onDispose = this._register(new vscode.EventEmitter<void>());
public readonly onDispose = this._onDispose.event;
@@ -679,6 +686,12 @@ export class DynamicMarkdownPreview extends Disposable implements IManagedMarkdo
});
}
openImage(imagePath: string): void {
const uri = vscode.Uri.file(imagePath);
this._webviewPanel.reveal();
vscode.commands.executeCommand('vscode.open', uri);
}
private readonly _onDisposeEmitter = this._register(new vscode.EventEmitter<void>());
public readonly onDispose = this._onDisposeEmitter.event;