mirror of
https://github.com/Microsoft/vscode
synced 2024-10-02 17:32:41 +00:00
parent
c77b63e865
commit
9c95828898
|
@ -7,7 +7,8 @@ import * as vscode from 'vscode';
|
|||
import { IMdParser } from '../../markdownEngine';
|
||||
import { ITextDocument } from '../../types/textDocument';
|
||||
import { Mime } from '../../util/mimes';
|
||||
import { createInsertUriListEdit, externalUriSchemes } from './shared';
|
||||
import { createInsertUriListEdit } from './shared';
|
||||
import { Schemes } from '../../util/schemes';
|
||||
|
||||
export enum PasteUrlAsMarkdownLink {
|
||||
Always = 'always',
|
||||
|
@ -170,6 +171,14 @@ async function shouldSmartPasteForSelection(
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
const externalUriSchemes: ReadonlySet<string> = new Set([
|
||||
Schemes.http,
|
||||
Schemes.https,
|
||||
Schemes.mailto,
|
||||
Schemes.file,
|
||||
]);
|
||||
|
||||
export function findValidUriInText(text: string): string | undefined {
|
||||
const trimmedUrlList = text.trim();
|
||||
|
||||
|
@ -186,7 +195,7 @@ export function findValidUriInText(text: string): string | undefined {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!externalUriSchemes.includes(uri.scheme.toLowerCase()) || uri.authority.length <= 1) {
|
||||
if (!externalUriSchemes.has(uri.scheme.toLowerCase()) || uri.authority.length <= 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,12 +19,6 @@ enum MediaKind {
|
|||
Audio,
|
||||
}
|
||||
|
||||
export const externalUriSchemes = [
|
||||
'http',
|
||||
'https',
|
||||
'mailto',
|
||||
];
|
||||
|
||||
export const mediaFileExtensions = new Map<string, MediaKind>([
|
||||
// Images
|
||||
['bmp', MediaKind.Image],
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
export const Schemes = Object.freeze({
|
||||
http: 'http',
|
||||
https: 'https',
|
||||
file: 'file',
|
||||
untitled: 'untitled',
|
||||
mailto: 'mailto',
|
||||
|
|
Loading…
Reference in a new issue