Skip to content

Commit 3c161fd

Browse files
authored
Add better label when adding video/video to md (microsoft#183379)
1 parent 80d9edb commit 3c161fd

File tree

1 file changed

+10
-3
lines changed
  • extensions/markdown-language-features/src/languageFeatures/copyFiles

1 file changed

+10
-3
lines changed

extensions/markdown-language-features/src/languageFeatures/copyFiles/shared.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ export function createUriListSnippet(
106106

107107
let insertedLinkCount = 0;
108108
let insertedImageCount = 0;
109+
let insertedAudioVideoCount = 0;
109110

110111
uris.forEach((uri, i) => {
111112
const mdPath = getMdPath(dir, uri);
@@ -116,12 +117,12 @@ export function createUriListSnippet(
116117
const insertAsAudio = mediaFileExtensions.get(ext) === MediaKind.Audio;
117118

118119
if (insertAsVideo) {
119-
insertedImageCount++;
120+
insertedAudioVideoCount++;
120121
snippet.appendText(`<video src="${mdPath}" controls title="`);
121122
snippet.appendPlaceholder('Title');
122123
snippet.appendText('"></video>');
123124
} else if (insertAsAudio) {
124-
insertedImageCount++;
125+
insertedAudioVideoCount++;
125126
snippet.appendText(`<audio src="${mdPath}" controls title="`);
126127
snippet.appendPlaceholder('Title');
127128
snippet.appendText('"></audio>');
@@ -147,7 +148,13 @@ export function createUriListSnippet(
147148
});
148149

149150
let label: string;
150-
if (insertedImageCount > 0 && insertedLinkCount > 0) {
151+
if (insertedAudioVideoCount > 0) {
152+
if (insertedLinkCount > 0) {
153+
label = vscode.l10n.t('Insert Markdown Media and Links');
154+
} else {
155+
label = vscode.l10n.t('Insert Markdown Media');
156+
}
157+
} else if (insertedImageCount > 0 && insertedLinkCount > 0) {
151158
label = vscode.l10n.t('Insert Markdown Images and Links');
152159
} else if (insertedImageCount > 0) {
153160
label = insertedImageCount > 1

0 commit comments

Comments
 (0)