@tiptap/extension-youtube
Advanced tools
Comparing version 2.1.12 to 2.1.13
import { Node, nodePasteRule, mergeAttributes } from '@tiptap/core'; | ||
const YOUTUBE_REGEX = /^(https?:\/\/)?(www\.|music\.)?(youtube\.com|youtu\.be)(?!.*\/channel\/)(?!\/@)(.+)?$/; | ||
const YOUTUBE_REGEX_GLOBAL = /^(https?:\/\/)?(www\.|music\.)?(youtube\.com|youtu\.be)(?!.*\/channel\/)(?!\/@)(.+)?$/g; | ||
const YOUTUBE_REGEX = /^(https?:\/\/)?(www\.|music\.)?(youtube\.com|youtu\.be)\/(?!channel\/)(?!@)(.+)?$/; | ||
const YOUTUBE_REGEX_GLOBAL = /^(https?:\/\/)?(www\.|music\.)?(youtube\.com|youtu\.be)\/(?!channel\/)(?!@)(.+)?$/g; | ||
const isValidYoutubeUrl = (url) => { | ||
@@ -13,2 +13,5 @@ return url.match(YOUTUBE_REGEX); | ||
const { url, allowFullscreen, autoplay, ccLanguage, ccLoadPolicy, controls, disableKBcontrols, enableIFrameApi, endTime, interfaceLanguage, ivLoadPolicy, loop, modestBranding, nocookie, origin, playlist, progressBarColor, startAt, } = options; | ||
if (!isValidYoutubeUrl(url)) { | ||
return null; | ||
} | ||
// if is already an embed url, return it | ||
@@ -15,0 +18,0 @@ if (url.includes('/embed/')) { |
@@ -7,4 +7,4 @@ (function (global, factory) { | ||
const YOUTUBE_REGEX = /^(https?:\/\/)?(www\.|music\.)?(youtube\.com|youtu\.be)(?!.*\/channel\/)(?!\/@)(.+)?$/; | ||
const YOUTUBE_REGEX_GLOBAL = /^(https?:\/\/)?(www\.|music\.)?(youtube\.com|youtu\.be)(?!.*\/channel\/)(?!\/@)(.+)?$/g; | ||
const YOUTUBE_REGEX = /^(https?:\/\/)?(www\.|music\.)?(youtube\.com|youtu\.be)\/(?!channel\/)(?!@)(.+)?$/; | ||
const YOUTUBE_REGEX_GLOBAL = /^(https?:\/\/)?(www\.|music\.)?(youtube\.com|youtu\.be)\/(?!channel\/)(?!@)(.+)?$/g; | ||
const isValidYoutubeUrl = (url) => { | ||
@@ -18,2 +18,5 @@ return url.match(YOUTUBE_REGEX); | ||
const { url, allowFullscreen, autoplay, ccLanguage, ccLoadPolicy, controls, disableKBcontrols, enableIFrameApi, endTime, interfaceLanguage, ivLoadPolicy, loop, modestBranding, nocookie, origin, playlist, progressBarColor, startAt, } = options; | ||
if (!isValidYoutubeUrl(url)) { | ||
return null; | ||
} | ||
// if is already an embed url, return it | ||
@@ -20,0 +23,0 @@ if (url.includes('/embed/')) { |
{ | ||
"name": "@tiptap/extension-youtube", | ||
"description": "a youtube embed extension for tiptap", | ||
"version": "2.1.12", | ||
"version": "2.1.13", | ||
"homepage": "https://tiptap.dev", | ||
@@ -32,3 +32,3 @@ "keywords": [ | ||
"devDependencies": { | ||
"@tiptap/core": "^2.1.12" | ||
"@tiptap/core": "^2.1.13" | ||
}, | ||
@@ -35,0 +35,0 @@ "peerDependencies": { |
@@ -1,3 +0,3 @@ | ||
export const YOUTUBE_REGEX = /^(https?:\/\/)?(www\.|music\.)?(youtube\.com|youtu\.be)(?!.*\/channel\/)(?!\/@)(.+)?$/ | ||
export const YOUTUBE_REGEX_GLOBAL = /^(https?:\/\/)?(www\.|music\.)?(youtube\.com|youtu\.be)(?!.*\/channel\/)(?!\/@)(.+)?$/g | ||
export const YOUTUBE_REGEX = /^(https?:\/\/)?(www\.|music\.)?(youtube\.com|youtu\.be)\/(?!channel\/)(?!@)(.+)?$/ | ||
export const YOUTUBE_REGEX_GLOBAL = /^(https?:\/\/)?(www\.|music\.)?(youtube\.com|youtu\.be)\/(?!channel\/)(?!@)(.+)?$/g | ||
@@ -55,2 +55,6 @@ export const isValidYoutubeUrl = (url: string) => { | ||
if (!isValidYoutubeUrl(url)) { | ||
return null | ||
} | ||
// if is already an embed url, return it | ||
@@ -57,0 +61,0 @@ if (url.includes('/embed/')) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
79923
1043