@github/paste-markdown
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -96,7 +96,11 @@ function insertText(textarea, text, options = { addNewline: true }) { | ||
return; | ||
if (!isURL(text)) | ||
return; | ||
if (isWithinLink(field)) | ||
return; | ||
const selectedText = field.value.substring(field.selectionStart, field.selectionEnd); | ||
if (!selectedText.length) | ||
return; | ||
event.stopPropagation(); | ||
event.preventDefault(); | ||
const selectedText = field.value.substring(field.selectionStart, field.selectionEnd); | ||
insertText(field, linkify(selectedText, text), { addNewline: false }); | ||
@@ -118,3 +122,3 @@ } | ||
function linkify(selectedText, text) { | ||
return selectedText.length && isURL(text) ? `[${selectedText}](${text})` : text; | ||
return `[${selectedText}](${text})`; | ||
} | ||
@@ -121,0 +125,0 @@ function isURL(url) { |
@@ -102,7 +102,11 @@ (function (global, factory) { | ||
return; | ||
if (!isURL(text)) | ||
return; | ||
if (isWithinLink(field)) | ||
return; | ||
const selectedText = field.value.substring(field.selectionStart, field.selectionEnd); | ||
if (!selectedText.length) | ||
return; | ||
event.stopPropagation(); | ||
event.preventDefault(); | ||
const selectedText = field.value.substring(field.selectionStart, field.selectionEnd); | ||
insertText(field, linkify(selectedText, text), { addNewline: false }); | ||
@@ -124,3 +128,3 @@ } | ||
function linkify(selectedText, text) { | ||
return selectedText.length && isURL(text) ? `[${selectedText}](${text})` : text; | ||
return `[${selectedText}](${text})`; | ||
} | ||
@@ -127,0 +131,0 @@ function isURL(url) { |
{ | ||
"name": "@github/paste-markdown", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Paste spreadsheet cells as a Markdown table.", | ||
@@ -5,0 +5,0 @@ "repository": "github/paste-markdown", |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
22241
527