Files
vscode/extensions/markdown-language-features/src/commands/copyImage.ts
T
MeghanKulkarniandMeghan Kulkarni 67cc0965b3 allow images in markdown preview editor to be copied (#184432)
* 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>
2023-06-07 18:08:22 +00:00

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);
}
}