mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 12:19:20 +00:00
Insert <video> tag for shift+mp4 into .md (#179489)
* Insert `<video>` tag for `shift`+mp4 into .md * Simpler drop text
This commit is contained in:
@@ -24,6 +24,11 @@ export const imageFileExtensions = new Set<string>([
|
||||
'webp',
|
||||
]);
|
||||
|
||||
const videoFileExtensions = new Set<string>([
|
||||
'ogg',
|
||||
'mp4'
|
||||
]);
|
||||
|
||||
export function registerDropIntoEditorSupport(selector: vscode.DocumentSelector) {
|
||||
return vscode.languages.registerDocumentDropEditProvider(selector, new class implements vscode.DocumentDropEditProvider {
|
||||
async provideDocumentDropEdits(document: vscode.TextDocument, _position: vscode.Position, dataTransfer: vscode.DataTransfer, token: vscode.CancellationToken): Promise<vscode.DocumentDropEdit | undefined> {
|
||||
@@ -84,14 +89,21 @@ export function createUriListSnippet(document: vscode.TextDocument, uris: readon
|
||||
|
||||
const ext = URI.Utils.extname(uri).toLowerCase().replace('.', '');
|
||||
const insertAsImage = typeof options?.insertAsImage === 'undefined' ? imageFileExtensions.has(ext) : !!options.insertAsImage;
|
||||
const insertAsVideo = videoFileExtensions.has(ext);
|
||||
|
||||
snippet.appendText(insertAsImage ? '`);
|
||||
snippet.appendText(`](${mdPath})`);
|
||||
}
|
||||
|
||||
if (i < uris.length - 1 && uris.length > 1) {
|
||||
snippet.appendText(options?.separator ?? ' ');
|
||||
|
||||
Reference in New Issue
Block a user