@convertkit/editor-videos
Advanced tools
Comparing version 0.0.5 to 0.0.6
import React from 'react'; | ||
import isUrl from 'is-url'; | ||
import { getEventTransfer } from 'slate-react'; | ||
@@ -37,46 +38,2 @@ | ||
/** | ||
* Expose `isUrl`. | ||
*/ | ||
var isUrl_1 = isUrl; | ||
/** | ||
* RegExps. | ||
* A URL must match #1 and then at least one of #2/#3. | ||
* Use two levels of REs to avoid REDOS. | ||
*/ | ||
var protocolAndDomainRE = /^(?:\w+:)?\/\/(\S+)$/; | ||
var localhostDomainRE = /^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/; | ||
var nonLocalhostDomainRE = /^[^\s\.]+\.\S{2,}$/; | ||
/** | ||
* Loosely validate a URL `string`. | ||
* | ||
* @param {String} string | ||
* @return {Boolean} | ||
*/ | ||
function isUrl(string) { | ||
if (typeof string !== 'string') { | ||
return false; | ||
} | ||
var match = string.match(protocolAndDomainRE); | ||
if (!match) { | ||
return false; | ||
} | ||
var everythingAfterProtocol = match[1]; | ||
if (!everythingAfterProtocol) { | ||
return false; | ||
} | ||
if (localhostDomainRE.test(everythingAfterProtocol) || nonLocalhostDomainRE.test(everythingAfterProtocol)) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
var handledTransferType = function handledTransferType(type) { | ||
@@ -116,3 +73,3 @@ return type == "text" || type == "html"; | ||
if (!handledTransferType(transfer.type)) return next(); | ||
if (!isUrl_1(transfer.text)) return next(); | ||
if (!isUrl(transfer.text)) return next(); | ||
if (!transfer.text.match(supportedVideoLinkSnippet)) return next(); | ||
@@ -119,0 +76,0 @@ return editor.insertVideo({ |
{ | ||
"name": "@convertkit/editor-videos", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "A plugin for embedding videos in the ConvertKit Editor", | ||
@@ -33,6 +33,6 @@ "main": "index.js", | ||
"devDependencies": { | ||
"@convertkit/selection-toolbar": "^0.1.6", | ||
"@convertkit/selection-toolbar": "^0.1.7", | ||
"slate-hyperprint": "^2.2.6" | ||
}, | ||
"gitHead": "c29893ec56fbd2573583eeabbeb716ed2f92067d" | ||
"gitHead": "b3696cac4ed9258fc7bd2b12c8fa48a8d8c32d29" | ||
} |
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
5973
176