@github/paste-markdown
Advanced tools
Comparing version 1.3.4 to 1.3.5
@@ -274,3 +274,3 @@ function insertText(textarea, text) { | ||
event.preventDefault(); | ||
insertText(field, linkify(selectedText, text)); | ||
insertText(field, linkify(selectedText, text.trim())); | ||
} | ||
@@ -293,6 +293,14 @@ function hasPlainText(transfer) { | ||
} | ||
const URL_REGEX = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\/?\s*?$/i; | ||
function isURL(url) { | ||
return URL_REGEX.test(url); | ||
try { | ||
const parsedURL = new URL(url); | ||
return removeTrailingSlash(parsedURL.href).trim() === removeTrailingSlash(url).trim(); | ||
} | ||
catch (_a) { | ||
return false; | ||
} | ||
} | ||
function removeTrailingSlash(url) { | ||
return url.endsWith('/') ? url.slice(0, url.length - 1) : url; | ||
} | ||
@@ -299,0 +307,0 @@ function install$1(el) { |
@@ -280,3 +280,3 @@ (function (global, factory) { | ||
event.preventDefault(); | ||
insertText(field, linkify(selectedText, text)); | ||
insertText(field, linkify(selectedText, text.trim())); | ||
} | ||
@@ -299,6 +299,14 @@ function hasPlainText(transfer) { | ||
} | ||
const URL_REGEX = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\/?\s*?$/i; | ||
function isURL(url) { | ||
return URL_REGEX.test(url); | ||
try { | ||
const parsedURL = new URL(url); | ||
return removeTrailingSlash(parsedURL.href).trim() === removeTrailingSlash(url).trim(); | ||
} | ||
catch (_a) { | ||
return false; | ||
} | ||
} | ||
function removeTrailingSlash(url) { | ||
return url.endsWith('/') ? url.slice(0, url.length - 1) : url; | ||
} | ||
@@ -305,0 +313,0 @@ function install$1(el) { |
{ | ||
"name": "@github/paste-markdown", | ||
"version": "1.3.4", | ||
"version": "1.3.5", | ||
"description": "Paste spreadsheet cells as a Markdown table.", | ||
@@ -5,0 +5,0 @@ "repository": "github/paste-markdown", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36508
896