mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 09:08:48 +01:00
move openImage logic to command
This commit is contained in:
@@ -14,9 +14,9 @@ export class OpenImageCommand implements Command {
|
|||||||
private readonly _webviewManager: MarkdownPreviewManager,
|
private readonly _webviewManager: MarkdownPreviewManager,
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
public execute(args: { resource: string, imageSource: string }) {
|
public execute(args: { resource: string; imageSource: string }) {
|
||||||
const source = vscode.Uri.parse(args.resource);
|
const source = vscode.Uri.parse(args.resource);
|
||||||
const { fsPath } = vscode.Uri.parse(args.imageSource);
|
const imageSource = vscode.Uri.file(vscode.Uri.parse(args.imageSource).path);
|
||||||
this._webviewManager.findPreview(source)?.openImage(fsPath);
|
vscode.commands.executeCommand('vscode.open', imageSource, this._webviewManager.findPreview(source));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -443,7 +443,6 @@ export interface IManagedMarkdownPreview {
|
|||||||
readonly onDidChangeViewState: vscode.Event<vscode.WebviewPanelOnDidChangeViewStateEvent>;
|
readonly onDidChangeViewState: vscode.Event<vscode.WebviewPanelOnDidChangeViewStateEvent>;
|
||||||
|
|
||||||
copyImage(id: string): void;
|
copyImage(id: string): void;
|
||||||
openImage(imagePath: string): void;
|
|
||||||
dispose(): void;
|
dispose(): void;
|
||||||
refresh(): void;
|
refresh(): void;
|
||||||
updateConfiguration(): void;
|
updateConfiguration(): void;
|
||||||
@@ -525,12 +524,6 @@ 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>());
|
private readonly _onDispose = this._register(new vscode.EventEmitter<void>());
|
||||||
public readonly onDispose = this._onDispose.event;
|
public readonly onDispose = this._onDispose.event;
|
||||||
|
|
||||||
@@ -686,12 +679,6 @@ 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>());
|
private readonly _onDisposeEmitter = this._register(new vscode.EventEmitter<void>());
|
||||||
public readonly onDispose = this._onDisposeEmitter.event;
|
public readonly onDispose = this._onDisposeEmitter.event;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user