mirror of
https://github.com/Microsoft/vscode
synced 2024-08-28 05:19:39 +00:00
Fix dropping image from webpage into markdown files
This commit is contained in:
parent
27759c6e03
commit
bba6c56123
|
@ -51,12 +51,14 @@ export function registerDropIntoEditor(selector: vscode.DocumentSelector) {
|
|||
|
||||
const snippet = new vscode.SnippetString();
|
||||
uris.forEach((uri, i) => {
|
||||
const rel = path.relative(URI.Utils.dirname(document.uri).fsPath, uri.fsPath);
|
||||
const mdPath = document.uri.scheme === uri.scheme
|
||||
? path.relative(URI.Utils.dirname(document.uri).fsPath, uri.fsPath)
|
||||
: uri.toString(false);
|
||||
|
||||
const ext = URI.Utils.extname(uri).toLowerCase();
|
||||
snippet.appendText(imageFileExtensions.has(ext) ? '![' : '[');
|
||||
snippet.appendTabstop();
|
||||
snippet.appendText(`](${rel})`);
|
||||
snippet.appendText(`](${mdPath})`);
|
||||
|
||||
if (i <= uris.length - 1 && uris.length > 1) {
|
||||
snippet.appendText(' ');
|
||||
|
|
Loading…
Reference in a new issue