From e160cdd9a6ebaa6381d152ef7925d880195655cb Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 23 Dec 2020 15:00:29 +0100 Subject: [PATCH] add isExternalURL --- apps/remix-ide/src/app/compiler/compiler-imports.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/remix-ide/src/app/compiler/compiler-imports.js b/apps/remix-ide/src/app/compiler/compiler-imports.js index 9ce5fc57b7..e13ef36570 100644 --- a/apps/remix-ide/src/app/compiler/compiler-imports.js +++ b/apps/remix-ide/src/app/compiler/compiler-imports.js @@ -14,7 +14,7 @@ const profile = { name: 'contentImport', displayName: 'content import', version: packageJson.version, - methods: ['resolve', 'resolveAndSave'] + methods: ['resolve', 'resolveAndSave', 'isExternalUrl'] } module.exports = class CompilerImports extends Plugin { @@ -105,6 +105,15 @@ module.exports = class CompilerImports extends Plugin { return /^([^/]+)/.exec(url) } + isExternalUrl (url) { + for (const handler of this.handlers()) { + if (handler.match.exec(url)) { + return true + } + } + return false + } + /** * resolve the content of @arg url. This only resolves external URLs. *