mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-30 06:35:31 +01:00
* allow images in markdown preview editor to be copied * resolved feedback * added findPreview method * removed copy image command from showPreview * clean up --------- Co-authored-by: Meghan Kulkarni <t-mekulkarni@microsoft.com>
22 lines
864 B
TypeScript
22 lines
864 B
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
import * as vscode from 'vscode';
|
|
import { Command } from '../commandManager';
|
|
import { MarkdownPreviewManager } from '../preview/previewManager';
|
|
|
|
export class CopyImageCommand implements Command {
|
|
public readonly id = '_markdown.copyImage';
|
|
|
|
public constructor(
|
|
private readonly _webviewManager: MarkdownPreviewManager,
|
|
) { }
|
|
|
|
public execute(args: { id: string; resource: string }) {
|
|
const source = vscode.Uri.parse(args.resource);
|
|
this._webviewManager.findPreview(source)?.copyImage(args.id);
|
|
}
|
|
}
|