Skip to content

Commit 715334b

Browse files
small changes (microsoft#186574)
* bug fixes * added label to copyPaste.ts * added localized label to copyPasteLinks file
1 parent 7fc5c6a commit 715334b

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

extensions/markdown-language-features/package.nls.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"configuration.markdown.editor.drop.copyIntoWorkspace": "Controls if files outside of the workspace that are dropped into a Markdown editor should be copied into the workspace.\n\nUse `#markdown.copyFiles.destination#` to configure where copied dropped files should be created",
4242
"configuration.markdown.editor.filePaste.enabled": "Enable pasting files into a Markdown editor to create Markdown links. Requires enabling `#editor.pasteAs.enabled#`.",
4343
"configuration.markdown.editor.filePaste.copyIntoWorkspace": "Controls if files outside of the workspace that are pasted into a Markdown editor should be copied into the workspace.\n\nUse `#markdown.copyFiles.destination#` to configure where copied files should be created.",
44-
"configuration.markdown.editor.pasteUrlAsFormattedLink.enabled": "Controls if a Markdown link is created when a URL is pasted into the Markdown editor.",
44+
"configuration.markdown.editor.pasteUrlAsFormattedLink.enabled": "Controls if a Markdown link is created when a URL is pasted into the Markdown editor. Requires enabling `#editor.pasteAs.enabled#`.",
4545
"configuration.copyIntoWorkspace.mediaFiles": "Try to copy external image and video files into the workspace.",
4646
"configuration.copyIntoWorkspace.never": "Do not copy external files into the workspace.",
4747
"configuration.markdown.validate.enabled.description": "Enable all error reporting in Markdown files.",

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ class PasteEditProvider implements vscode.DocumentPasteEditProvider {
2727
return createEdit;
2828
}
2929

30-
const label = vscode.l10n.t('Insert Markdown Media');
31-
const uriEdit = new vscode.DocumentPasteEdit('', this._id, label);
30+
const uriEdit = new vscode.DocumentPasteEdit('', this._id, '');
3231
const urlList = await dataTransfer.get('text/uri-list')?.asString();
3332
if (!urlList) {
3433
return;
@@ -38,6 +37,7 @@ class PasteEditProvider implements vscode.DocumentPasteEditProvider {
3837
return;
3938
}
4039

40+
uriEdit.label = pasteEdit.label;
4141
uriEdit.additionalEdit = pasteEdit.additionalEdits;
4242
uriEdit.priority = this._getPriority(dataTransfer);
4343
return uriEdit;

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { getMarkdownLink } from './shared';
88

99
class PasteLinkEditProvider implements vscode.DocumentPasteEditProvider {
1010

11-
private readonly _id = 'insertMarkdownLink';
11+
readonly id = 'insertMarkdownLink';
1212
async provideDocumentPasteEdits(
1313
document: vscode.TextDocument,
1414
ranges: readonly vscode.Range[],
@@ -28,8 +28,7 @@ class PasteLinkEditProvider implements vscode.DocumentPasteEditProvider {
2828
return;
2929
}
3030

31-
const label = vscode.l10n.t('Insert Markdown Link');
32-
const uriEdit = new vscode.DocumentPasteEdit('', this._id, label);
31+
const uriEdit = new vscode.DocumentPasteEdit('', this.id, '');
3332
const urlList = await item?.asString();
3433
if (!urlList) {
3534
return undefined;
@@ -39,6 +38,7 @@ class PasteLinkEditProvider implements vscode.DocumentPasteEditProvider {
3938
return;
4039
}
4140

41+
uriEdit.label = pasteEdit.label;
4242
uriEdit.additionalEdit = pasteEdit.additionalEdits;
4343
return uriEdit;
4444
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ export function createUriListSnippet(
153153
if (insertAsMedia) {
154154
insertedImageCount++;
155155
snippet.appendText('![');
156-
const placeholderText = options?.placeholderText ? (escapeBrackets(title) || 'Alt text') : 'label';
156+
const placeholderText = escapeBrackets(title) || options?.placeholderText || 'Alt text';
157157
const placeholderIndex = typeof options?.placeholderStartIndex !== 'undefined' ? options?.placeholderStartIndex + i : (placeholderValue === 0 ? undefined : placeholderValue);
158158
snippet.appendPlaceholder(placeholderText, placeholderIndex);
159159
snippet.appendText(`](${escapeMarkdownLinkPath(mdPath)})`);

0 commit comments

Comments
 (0)