small changes (#186574)

* bug fixes

* added label to copyPaste.ts

* added localized label to copyPasteLinks file
This commit is contained in:
Meghan Kulkarni 2023-06-28 17:14:23 -07:00 committed by GitHub
parent 7fc5c6aa9a
commit 715334ba8c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 7 deletions

View file

@ -41,7 +41,7 @@
"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",
"configuration.markdown.editor.filePaste.enabled": "Enable pasting files into a Markdown editor to create Markdown links. Requires enabling `#editor.pasteAs.enabled#`.",
"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.",
"configuration.markdown.editor.pasteUrlAsFormattedLink.enabled": "Controls if a Markdown link is created when a URL is pasted into the Markdown editor.",
"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#`.",
"configuration.copyIntoWorkspace.mediaFiles": "Try to copy external image and video files into the workspace.",
"configuration.copyIntoWorkspace.never": "Do not copy external files into the workspace.",
"configuration.markdown.validate.enabled.description": "Enable all error reporting in Markdown files.",

View file

@ -27,8 +27,7 @@ class PasteEditProvider implements vscode.DocumentPasteEditProvider {
return createEdit;
}
const label = vscode.l10n.t('Insert Markdown Media');
const uriEdit = new vscode.DocumentPasteEdit('', this._id, label);
const uriEdit = new vscode.DocumentPasteEdit('', this._id, '');
const urlList = await dataTransfer.get('text/uri-list')?.asString();
if (!urlList) {
return;
@ -38,6 +37,7 @@ class PasteEditProvider implements vscode.DocumentPasteEditProvider {
return;
}
uriEdit.label = pasteEdit.label;
uriEdit.additionalEdit = pasteEdit.additionalEdits;
uriEdit.priority = this._getPriority(dataTransfer);
return uriEdit;

View file

@ -8,7 +8,7 @@ import { getMarkdownLink } from './shared';
class PasteLinkEditProvider implements vscode.DocumentPasteEditProvider {
private readonly _id = 'insertMarkdownLink';
readonly id = 'insertMarkdownLink';
async provideDocumentPasteEdits(
document: vscode.TextDocument,
ranges: readonly vscode.Range[],
@ -28,8 +28,7 @@ class PasteLinkEditProvider implements vscode.DocumentPasteEditProvider {
return;
}
const label = vscode.l10n.t('Insert Markdown Link');
const uriEdit = new vscode.DocumentPasteEdit('', this._id, label);
const uriEdit = new vscode.DocumentPasteEdit('', this.id, '');
const urlList = await item?.asString();
if (!urlList) {
return undefined;
@ -39,6 +38,7 @@ class PasteLinkEditProvider implements vscode.DocumentPasteEditProvider {
return;
}
uriEdit.label = pasteEdit.label;
uriEdit.additionalEdit = pasteEdit.additionalEdits;
return uriEdit;
}

View file

@ -153,7 +153,7 @@ export function createUriListSnippet(
if (insertAsMedia) {
insertedImageCount++;
snippet.appendText('![');
const placeholderText = options?.placeholderText ? (escapeBrackets(title) || 'Alt text') : 'label';
const placeholderText = escapeBrackets(title) || options?.placeholderText || 'Alt text';
const placeholderIndex = typeof options?.placeholderStartIndex !== 'undefined' ? options?.placeholderStartIndex + i : (placeholderValue === 0 ? undefined : placeholderValue);
snippet.appendPlaceholder(placeholderText, placeholderIndex);
snippet.appendText(`](${escapeMarkdownLinkPath(mdPath)})`);