@tiptap/extension-youtube 3.20.1 → 3.20.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tiptap/extension-youtube",
3
3
  "description": "a youtube embed extension for tiptap",
4
- "version": "3.20.1",
4
+ "version": "3.20.3",
5
5
  "homepage": "https://tiptap.dev",
6
6
  "keywords": [
7
7
  "tiptap",
@@ -31,10 +31,10 @@
31
31
  "dist"
32
32
  ],
33
33
  "devDependencies": {
34
- "@tiptap/core": "^3.20.1"
34
+ "@tiptap/core": "^3.20.3"
35
35
  },
36
36
  "peerDependencies": {
37
- "@tiptap/core": "^3.20.1"
37
+ "@tiptap/core": "^3.20.3"
38
38
  },
39
39
  "repository": {
40
40
  "type": "git",
package/src/youtube.ts CHANGED
@@ -2,6 +2,9 @@ import { createAtomBlockMarkdownSpec, mergeAttributes, Node, nodePasteRule } fro
2
2
 
3
3
  import { getEmbedUrlFromYoutubeUrl, isValidYoutubeUrl, YOUTUBE_REGEX_GLOBAL } from './utils.js'
4
4
 
5
+ export type { GetEmbedUrlOptions } from './utils.js'
6
+ export { getEmbedUrlFromYoutubeUrl, isValidYoutubeUrl } from './utils.js'
7
+
5
8
  export interface YoutubeOptions {
6
9
  /**
7
10
  * Controls if the paste handler for youtube videos should be added.
package/dist/index.cjs DELETED
@@ -1,294 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/index.ts
21
- var index_exports = {};
22
- __export(index_exports, {
23
- Youtube: () => Youtube,
24
- default: () => index_default
25
- });
26
- module.exports = __toCommonJS(index_exports);
27
-
28
- // src/youtube.ts
29
- var import_core = require("@tiptap/core");
30
-
31
- // src/utils.ts
32
- var YOUTUBE_REGEX = /^((?:https?:)?\/\/)?((?:www|m|music)\.)?((?:youtube\.com|youtu\.be|youtube-nocookie\.com))(\/(?:[\w-]+\?v=|embed\/|v\/)?)([\w-]+)(\S+)?$/;
33
- var YOUTUBE_REGEX_GLOBAL = /^((?:https?:)?\/\/)?((?:www|m|music)\.)?((?:youtube\.com|youtu\.be|youtube-nocookie\.com))(\/(?:[\w-]+\?v=|embed\/|v\/)?)([\w-]+)(\S+)?$/g;
34
- var isValidYoutubeUrl = (url) => {
35
- return url.match(YOUTUBE_REGEX);
36
- };
37
- var getYoutubeEmbedUrl = (nocookie, isPlaylist) => {
38
- if (isPlaylist) {
39
- return "https://www.youtube-nocookie.com/embed/videoseries?list=";
40
- }
41
- return nocookie ? "https://www.youtube-nocookie.com/embed/" : "https://www.youtube.com/embed/";
42
- };
43
- var getEmbedUrlFromYoutubeUrl = (options) => {
44
- const {
45
- url,
46
- allowFullscreen,
47
- autoplay,
48
- ccLanguage,
49
- ccLoadPolicy,
50
- controls,
51
- disableKBcontrols,
52
- enableIFrameApi,
53
- endTime,
54
- interfaceLanguage,
55
- ivLoadPolicy,
56
- loop,
57
- modestBranding,
58
- nocookie,
59
- origin,
60
- playlist,
61
- progressBarColor,
62
- startAt,
63
- rel
64
- } = options;
65
- if (!isValidYoutubeUrl(url)) {
66
- return null;
67
- }
68
- if (url.includes("/embed/")) {
69
- return url;
70
- }
71
- if (url.includes("youtu.be")) {
72
- const id = url.split("/").pop();
73
- if (!id) {
74
- return null;
75
- }
76
- return `${getYoutubeEmbedUrl(nocookie)}${id}`;
77
- }
78
- const videoIdRegex = /(?:(v|list)=|shorts\/)([-\w]+)/gm;
79
- const matches = videoIdRegex.exec(url);
80
- if (!matches || !matches[2]) {
81
- return null;
82
- }
83
- let outputUrl = `${getYoutubeEmbedUrl(nocookie, matches[1] === "list")}${matches[2]}`;
84
- const params = [];
85
- if (allowFullscreen === false) {
86
- params.push("fs=0");
87
- }
88
- if (autoplay) {
89
- params.push("autoplay=1");
90
- }
91
- if (ccLanguage) {
92
- params.push(`cc_lang_pref=${ccLanguage}`);
93
- }
94
- if (ccLoadPolicy) {
95
- params.push("cc_load_policy=1");
96
- }
97
- if (!controls) {
98
- params.push("controls=0");
99
- }
100
- if (disableKBcontrols) {
101
- params.push("disablekb=1");
102
- }
103
- if (enableIFrameApi) {
104
- params.push("enablejsapi=1");
105
- }
106
- if (endTime) {
107
- params.push(`end=${endTime}`);
108
- }
109
- if (interfaceLanguage) {
110
- params.push(`hl=${interfaceLanguage}`);
111
- }
112
- if (ivLoadPolicy) {
113
- params.push(`iv_load_policy=${ivLoadPolicy}`);
114
- }
115
- if (loop) {
116
- params.push("loop=1");
117
- }
118
- if (modestBranding) {
119
- params.push("modestbranding=1");
120
- }
121
- if (origin) {
122
- params.push(`origin=${origin}`);
123
- }
124
- if (playlist) {
125
- params.push(`playlist=${playlist}`);
126
- }
127
- if (startAt) {
128
- params.push(`start=${startAt}`);
129
- }
130
- if (progressBarColor) {
131
- params.push(`color=${progressBarColor}`);
132
- }
133
- if (rel !== void 0) {
134
- params.push(`rel=${rel}`);
135
- }
136
- if (params.length) {
137
- outputUrl += `${matches[1] === "list" ? "&" : "?"}${params.join("&")}`;
138
- }
139
- return outputUrl;
140
- };
141
-
142
- // src/youtube.ts
143
- var Youtube = import_core.Node.create({
144
- name: "youtube",
145
- addOptions() {
146
- return {
147
- addPasteHandler: true,
148
- allowFullscreen: true,
149
- autoplay: false,
150
- ccLanguage: void 0,
151
- ccLoadPolicy: void 0,
152
- controls: true,
153
- disableKBcontrols: false,
154
- enableIFrameApi: false,
155
- endTime: 0,
156
- height: 480,
157
- interfaceLanguage: void 0,
158
- ivLoadPolicy: 0,
159
- loop: false,
160
- modestBranding: false,
161
- HTMLAttributes: {},
162
- inline: false,
163
- nocookie: false,
164
- origin: "",
165
- playlist: "",
166
- progressBarColor: void 0,
167
- width: 640,
168
- rel: 1
169
- };
170
- },
171
- inline() {
172
- return this.options.inline;
173
- },
174
- group() {
175
- return this.options.inline ? "inline" : "block";
176
- },
177
- draggable: true,
178
- addAttributes() {
179
- return {
180
- src: {
181
- default: null
182
- },
183
- start: {
184
- default: 0
185
- },
186
- width: {
187
- default: this.options.width
188
- },
189
- height: {
190
- default: this.options.height
191
- }
192
- };
193
- },
194
- parseHTML() {
195
- return [
196
- {
197
- tag: "div[data-youtube-video] iframe"
198
- }
199
- ];
200
- },
201
- addCommands() {
202
- return {
203
- setYoutubeVideo: (options) => ({ commands }) => {
204
- if (!isValidYoutubeUrl(options.src)) {
205
- return false;
206
- }
207
- return commands.insertContent({
208
- type: this.name,
209
- attrs: options
210
- });
211
- }
212
- };
213
- },
214
- addPasteRules() {
215
- if (!this.options.addPasteHandler) {
216
- return [];
217
- }
218
- return [
219
- (0, import_core.nodePasteRule)({
220
- find: YOUTUBE_REGEX_GLOBAL,
221
- type: this.type,
222
- getAttributes: (match) => {
223
- return { src: match.input };
224
- }
225
- })
226
- ];
227
- },
228
- renderHTML({ HTMLAttributes }) {
229
- const embedUrl = getEmbedUrlFromYoutubeUrl({
230
- url: HTMLAttributes.src,
231
- allowFullscreen: this.options.allowFullscreen,
232
- autoplay: this.options.autoplay,
233
- ccLanguage: this.options.ccLanguage,
234
- ccLoadPolicy: this.options.ccLoadPolicy,
235
- controls: this.options.controls,
236
- disableKBcontrols: this.options.disableKBcontrols,
237
- enableIFrameApi: this.options.enableIFrameApi,
238
- endTime: this.options.endTime,
239
- interfaceLanguage: this.options.interfaceLanguage,
240
- ivLoadPolicy: this.options.ivLoadPolicy,
241
- loop: this.options.loop,
242
- modestBranding: this.options.modestBranding,
243
- nocookie: this.options.nocookie,
244
- origin: this.options.origin,
245
- playlist: this.options.playlist,
246
- progressBarColor: this.options.progressBarColor,
247
- startAt: HTMLAttributes.start || 0,
248
- rel: this.options.rel
249
- });
250
- HTMLAttributes.src = embedUrl;
251
- return [
252
- "div",
253
- { "data-youtube-video": "" },
254
- [
255
- "iframe",
256
- (0, import_core.mergeAttributes)(
257
- this.options.HTMLAttributes,
258
- {
259
- width: this.options.width,
260
- height: this.options.height,
261
- allowfullscreen: this.options.allowFullscreen,
262
- autoplay: this.options.autoplay,
263
- ccLanguage: this.options.ccLanguage,
264
- ccLoadPolicy: this.options.ccLoadPolicy,
265
- disableKBcontrols: this.options.disableKBcontrols,
266
- enableIFrameApi: this.options.enableIFrameApi,
267
- endTime: this.options.endTime,
268
- interfaceLanguage: this.options.interfaceLanguage,
269
- ivLoadPolicy: this.options.ivLoadPolicy,
270
- loop: this.options.loop,
271
- modestBranding: this.options.modestBranding,
272
- origin: this.options.origin,
273
- playlist: this.options.playlist,
274
- progressBarColor: this.options.progressBarColor,
275
- rel: this.options.rel
276
- },
277
- HTMLAttributes
278
- )
279
- ]
280
- ];
281
- },
282
- ...(0, import_core.createAtomBlockMarkdownSpec)({
283
- nodeName: "youtube",
284
- allowedAttributes: ["src", "width", "height", "start"]
285
- })
286
- });
287
-
288
- // src/index.ts
289
- var index_default = Youtube;
290
- // Annotate the CommonJS export names for ESM import in node:
291
- 0 && (module.exports = {
292
- Youtube
293
- });
294
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/index.ts","../src/youtube.ts","../src/utils.ts"],"sourcesContent":["import { Youtube } from './youtube.js'\n\nexport * from './youtube.js'\n\nexport default Youtube\n","import { createAtomBlockMarkdownSpec, mergeAttributes, Node, nodePasteRule } from '@tiptap/core'\n\nimport { getEmbedUrlFromYoutubeUrl, isValidYoutubeUrl, YOUTUBE_REGEX_GLOBAL } from './utils.js'\n\nexport interface YoutubeOptions {\n /**\n * Controls if the paste handler for youtube videos should be added.\n * @default true\n * @example false\n */\n addPasteHandler: boolean\n\n /**\n * Controls if the youtube video should be allowed to go fullscreen.\n * @default true\n * @example false\n */\n allowFullscreen: boolean\n\n /**\n * Controls if the youtube video should autoplay.\n * @default false\n * @example true\n */\n autoplay: boolean\n\n /**\n * The language of the captions shown in the youtube video.\n * @default undefined\n * @example 'en'\n */\n ccLanguage?: string\n\n /**\n * Controls if the captions should be shown in the youtube video.\n * @default undefined\n * @example true\n */\n ccLoadPolicy?: boolean\n\n /**\n * Controls if the controls should be shown in the youtube video.\n * @default true\n * @example false\n */\n controls: boolean\n\n /**\n * Controls if the keyboard controls should be disabled in the youtube video.\n * @default false\n * @example true\n */\n disableKBcontrols: boolean\n\n /**\n * Controls if the iframe api should be enabled in the youtube video.\n * @default false\n * @example true\n */\n enableIFrameApi: boolean\n\n /**\n * The end time of the youtube video.\n * @default 0\n * @example 120\n */\n endTime: number\n\n /**\n * The height of the youtube video.\n * @default 480\n * @example 720\n */\n height: number\n\n /**\n * The language of the youtube video.\n * @default undefined\n * @example 'en'\n */\n interfaceLanguage?: string\n\n /**\n * Controls if the video annotations should be shown in the youtube video.\n * @default 0\n * @example 1\n */\n ivLoadPolicy: number\n\n /**\n * Controls if the youtube video should loop.\n * @default false\n * @example true\n */\n loop: boolean\n\n /**\n * Controls if the youtube video should show a small youtube logo.\n * @default false\n * @example true\n */\n modestBranding: boolean\n\n /**\n * The HTML attributes for a youtube video node.\n * @default {}\n * @example { class: 'foo' }\n */\n HTMLAttributes: Record<string, any>\n\n /**\n * Controls if the youtube node should be inline or not.\n * @default false\n * @example true\n */\n inline: boolean\n\n /**\n * Controls if the youtube video should be loaded from youtube-nocookie.com.\n * @default false\n * @example true\n */\n nocookie: boolean\n\n /**\n * The origin of the youtube video.\n * @default ''\n * @example 'https://tiptap.dev'\n */\n origin: string\n\n /**\n * The playlist of the youtube video.\n * @default ''\n * @example 'PLQg6GaokU5CwiVmsZ0dZm6VeIg0V5z1tK'\n */\n playlist: string\n\n /**\n * The color of the youtube video progress bar.\n * @default undefined\n * @example 'red'\n */\n progressBarColor?: string\n\n /**\n * The width of the youtube video.\n * @default 640\n * @example 1280\n */\n width: number\n\n /**\n * Controls if the related youtube videos at the end are from the same channel.\n * @default 1\n * @example 0\n */\n rel: number\n}\n\n/**\n * The options for setting a youtube video.\n */\ntype SetYoutubeVideoOptions = { src: string; width?: number; height?: number; start?: number }\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n youtube: {\n /**\n * Insert a youtube video\n * @param options The youtube video attributes\n * @example editor.commands.setYoutubeVideo({ src: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ' })\n */\n setYoutubeVideo: (options: SetYoutubeVideoOptions) => ReturnType\n }\n }\n}\n\n/**\n * This extension adds support for youtube videos.\n * @see https://www.tiptap.dev/api/nodes/youtube\n */\nexport const Youtube = Node.create<YoutubeOptions>({\n name: 'youtube',\n\n addOptions() {\n return {\n addPasteHandler: true,\n allowFullscreen: true,\n autoplay: false,\n ccLanguage: undefined,\n ccLoadPolicy: undefined,\n controls: true,\n disableKBcontrols: false,\n enableIFrameApi: false,\n endTime: 0,\n height: 480,\n interfaceLanguage: undefined,\n ivLoadPolicy: 0,\n loop: false,\n modestBranding: false,\n HTMLAttributes: {},\n inline: false,\n nocookie: false,\n origin: '',\n playlist: '',\n progressBarColor: undefined,\n width: 640,\n rel: 1,\n }\n },\n\n inline() {\n return this.options.inline\n },\n\n group() {\n return this.options.inline ? 'inline' : 'block'\n },\n\n draggable: true,\n\n addAttributes() {\n return {\n src: {\n default: null,\n },\n start: {\n default: 0,\n },\n width: {\n default: this.options.width,\n },\n height: {\n default: this.options.height,\n },\n }\n },\n\n parseHTML() {\n return [\n {\n tag: 'div[data-youtube-video] iframe',\n },\n ]\n },\n\n addCommands() {\n return {\n setYoutubeVideo:\n (options: SetYoutubeVideoOptions) =>\n ({ commands }) => {\n if (!isValidYoutubeUrl(options.src)) {\n return false\n }\n\n return commands.insertContent({\n type: this.name,\n attrs: options,\n })\n },\n }\n },\n\n addPasteRules() {\n if (!this.options.addPasteHandler) {\n return []\n }\n\n return [\n nodePasteRule({\n find: YOUTUBE_REGEX_GLOBAL,\n type: this.type,\n getAttributes: match => {\n return { src: match.input }\n },\n }),\n ]\n },\n\n renderHTML({ HTMLAttributes }) {\n const embedUrl = getEmbedUrlFromYoutubeUrl({\n url: HTMLAttributes.src,\n allowFullscreen: this.options.allowFullscreen,\n autoplay: this.options.autoplay,\n ccLanguage: this.options.ccLanguage,\n ccLoadPolicy: this.options.ccLoadPolicy,\n controls: this.options.controls,\n disableKBcontrols: this.options.disableKBcontrols,\n enableIFrameApi: this.options.enableIFrameApi,\n endTime: this.options.endTime,\n interfaceLanguage: this.options.interfaceLanguage,\n ivLoadPolicy: this.options.ivLoadPolicy,\n loop: this.options.loop,\n modestBranding: this.options.modestBranding,\n nocookie: this.options.nocookie,\n origin: this.options.origin,\n playlist: this.options.playlist,\n progressBarColor: this.options.progressBarColor,\n startAt: HTMLAttributes.start || 0,\n rel: this.options.rel,\n })\n\n HTMLAttributes.src = embedUrl\n\n return [\n 'div',\n { 'data-youtube-video': '' },\n [\n 'iframe',\n mergeAttributes(\n this.options.HTMLAttributes,\n {\n width: this.options.width,\n height: this.options.height,\n allowfullscreen: this.options.allowFullscreen,\n autoplay: this.options.autoplay,\n ccLanguage: this.options.ccLanguage,\n ccLoadPolicy: this.options.ccLoadPolicy,\n disableKBcontrols: this.options.disableKBcontrols,\n enableIFrameApi: this.options.enableIFrameApi,\n endTime: this.options.endTime,\n interfaceLanguage: this.options.interfaceLanguage,\n ivLoadPolicy: this.options.ivLoadPolicy,\n loop: this.options.loop,\n modestBranding: this.options.modestBranding,\n origin: this.options.origin,\n playlist: this.options.playlist,\n progressBarColor: this.options.progressBarColor,\n rel: this.options.rel,\n },\n HTMLAttributes,\n ),\n ],\n ]\n },\n\n ...createAtomBlockMarkdownSpec({\n nodeName: 'youtube',\n allowedAttributes: ['src', 'width', 'height', 'start'],\n }),\n})\n","export const YOUTUBE_REGEX =\n /^((?:https?:)?\\/\\/)?((?:www|m|music)\\.)?((?:youtube\\.com|youtu\\.be|youtube-nocookie\\.com))(\\/(?:[\\w-]+\\?v=|embed\\/|v\\/)?)([\\w-]+)(\\S+)?$/\nexport const YOUTUBE_REGEX_GLOBAL =\n /^((?:https?:)?\\/\\/)?((?:www|m|music)\\.)?((?:youtube\\.com|youtu\\.be|youtube-nocookie\\.com))(\\/(?:[\\w-]+\\?v=|embed\\/|v\\/)?)([\\w-]+)(\\S+)?$/g\n\nexport const isValidYoutubeUrl = (url: string) => {\n return url.match(YOUTUBE_REGEX)\n}\n\nexport interface GetEmbedUrlOptions {\n url: string\n allowFullscreen?: boolean\n autoplay?: boolean\n ccLanguage?: string\n ccLoadPolicy?: boolean\n controls?: boolean\n disableKBcontrols?: boolean\n enableIFrameApi?: boolean\n endTime?: number\n interfaceLanguage?: string\n ivLoadPolicy?: number\n loop?: boolean\n modestBranding?: boolean\n nocookie?: boolean\n origin?: string\n playlist?: string\n progressBarColor?: string\n startAt?: number\n rel?: number\n}\n\nexport const getYoutubeEmbedUrl = (nocookie?: boolean, isPlaylist?: boolean) => {\n if (isPlaylist) {\n return 'https://www.youtube-nocookie.com/embed/videoseries?list='\n }\n return nocookie ? 'https://www.youtube-nocookie.com/embed/' : 'https://www.youtube.com/embed/'\n}\n\nexport const getEmbedUrlFromYoutubeUrl = (options: GetEmbedUrlOptions) => {\n const {\n url,\n allowFullscreen,\n autoplay,\n ccLanguage,\n ccLoadPolicy,\n controls,\n disableKBcontrols,\n enableIFrameApi,\n endTime,\n interfaceLanguage,\n ivLoadPolicy,\n loop,\n modestBranding,\n nocookie,\n origin,\n playlist,\n progressBarColor,\n startAt,\n rel,\n } = options\n\n if (!isValidYoutubeUrl(url)) {\n return null\n }\n\n // if is already an embed url, return it\n if (url.includes('/embed/')) {\n return url\n }\n\n // if is a youtu.be url, get the id after the /\n if (url.includes('youtu.be')) {\n const id = url.split('/').pop()\n\n if (!id) {\n return null\n }\n return `${getYoutubeEmbedUrl(nocookie)}${id}`\n }\n\n const videoIdRegex = /(?:(v|list)=|shorts\\/)([-\\w]+)/gm\n const matches = videoIdRegex.exec(url)\n\n if (!matches || !matches[2]) {\n return null\n }\n\n let outputUrl = `${getYoutubeEmbedUrl(nocookie, matches[1] === 'list')}${matches[2]}`\n\n const params = []\n\n if (allowFullscreen === false) {\n params.push('fs=0')\n }\n\n if (autoplay) {\n params.push('autoplay=1')\n }\n\n if (ccLanguage) {\n params.push(`cc_lang_pref=${ccLanguage}`)\n }\n\n if (ccLoadPolicy) {\n params.push('cc_load_policy=1')\n }\n\n if (!controls) {\n params.push('controls=0')\n }\n\n if (disableKBcontrols) {\n params.push('disablekb=1')\n }\n\n if (enableIFrameApi) {\n params.push('enablejsapi=1')\n }\n\n if (endTime) {\n params.push(`end=${endTime}`)\n }\n\n if (interfaceLanguage) {\n params.push(`hl=${interfaceLanguage}`)\n }\n\n if (ivLoadPolicy) {\n params.push(`iv_load_policy=${ivLoadPolicy}`)\n }\n\n if (loop) {\n params.push('loop=1')\n }\n\n if (modestBranding) {\n params.push('modestbranding=1')\n }\n\n if (origin) {\n params.push(`origin=${origin}`)\n }\n\n if (playlist) {\n params.push(`playlist=${playlist}`)\n }\n\n if (startAt) {\n params.push(`start=${startAt}`)\n }\n\n if (progressBarColor) {\n params.push(`color=${progressBarColor}`)\n }\n\n if (rel !== undefined) {\n params.push(`rel=${rel}`)\n }\n\n if (params.length) {\n outputUrl += `${matches[1] === 'list' ? '&' : '?'}${params.join('&')}`\n }\n\n return outputUrl\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,kBAAkF;;;ACA3E,IAAM,gBACX;AACK,IAAM,uBACX;AAEK,IAAM,oBA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QAAQ;AAAA,YAChC,cAAc,KAAK,QAAQ;AAAA,YAC3B,MAAM,KAAK,QAAQ;AAAA,YACnB,gBAAgB,KAAK,QAAQ;AAAA,YAC7B,QAAQ,KAAK,QAAQ;AAAA,YACrB,UAAU,KAAK,QAAQ;AAAA,YACvB,kBAAkB,KAAK,QAAQ;AAAA,YAC/B,KAAK,KAAK,QAAQ;AAAA,UACpB;AAAA,UACA;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,OAAG,yCAA4B;AAAA,IAC7B,UAAU;AAAA,IACV,mBAAmB,CAAC,OAAO,SAAS,UAAU,OAAO;AAAA,EACvD,CAAC;AACH,CAAC;;;ADjVD,IAAO,gBAAQ;","names":[]}
package/dist/index.d.cts DELETED
@@ -1,164 +0,0 @@
1
- import { Node } from '@tiptap/core';
2
-
3
- interface YoutubeOptions {
4
- /**
5
- * Controls if the paste handler for youtube videos should be added.
6
- * @default true
7
- * @example false
8
- */
9
- addPasteHandler: boolean;
10
- /**
11
- * Controls if the youtube video should be allowed to go fullscreen.
12
- * @default true
13
- * @example false
14
- */
15
- allowFullscreen: boolean;
16
- /**
17
- * Controls if the youtube video should autoplay.
18
- * @default false
19
- * @example true
20
- */
21
- autoplay: boolean;
22
- /**
23
- * The language of the captions shown in the youtube video.
24
- * @default undefined
25
- * @example 'en'
26
- */
27
- ccLanguage?: string;
28
- /**
29
- * Controls if the captions should be shown in the youtube video.
30
- * @default undefined
31
- * @example true
32
- */
33
- ccLoadPolicy?: boolean;
34
- /**
35
- * Controls if the controls should be shown in the youtube video.
36
- * @default true
37
- * @example false
38
- */
39
- controls: boolean;
40
- /**
41
- * Controls if the keyboard controls should be disabled in the youtube video.
42
- * @default false
43
- * @example true
44
- */
45
- disableKBcontrols: boolean;
46
- /**
47
- * Controls if the iframe api should be enabled in the youtube video.
48
- * @default false
49
- * @example true
50
- */
51
- enableIFrameApi: boolean;
52
- /**
53
- * The end time of the youtube video.
54
- * @default 0
55
- * @example 120
56
- */
57
- endTime: number;
58
- /**
59
- * The height of the youtube video.
60
- * @default 480
61
- * @example 720
62
- */
63
- height: number;
64
- /**
65
- * The language of the youtube video.
66
- * @default undefined
67
- * @example 'en'
68
- */
69
- interfaceLanguage?: string;
70
- /**
71
- * Controls if the video annotations should be shown in the youtube video.
72
- * @default 0
73
- * @example 1
74
- */
75
- ivLoadPolicy: number;
76
- /**
77
- * Controls if the youtube video should loop.
78
- * @default false
79
- * @example true
80
- */
81
- loop: boolean;
82
- /**
83
- * Controls if the youtube video should show a small youtube logo.
84
- * @default false
85
- * @example true
86
- */
87
- modestBranding: boolean;
88
- /**
89
- * The HTML attributes for a youtube video node.
90
- * @default {}
91
- * @example { class: 'foo' }
92
- */
93
- HTMLAttributes: Record<string, any>;
94
- /**
95
- * Controls if the youtube node should be inline or not.
96
- * @default false
97
- * @example true
98
- */
99
- inline: boolean;
100
- /**
101
- * Controls if the youtube video should be loaded from youtube-nocookie.com.
102
- * @default false
103
- * @example true
104
- */
105
- nocookie: boolean;
106
- /**
107
- * The origin of the youtube video.
108
- * @default ''
109
- * @example 'https://tiptap.dev'
110
- */
111
- origin: string;
112
- /**
113
- * The playlist of the youtube video.
114
- * @default ''
115
- * @example 'PLQg6GaokU5CwiVmsZ0dZm6VeIg0V5z1tK'
116
- */
117
- playlist: string;
118
- /**
119
- * The color of the youtube video progress bar.
120
- * @default undefined
121
- * @example 'red'
122
- */
123
- progressBarColor?: string;
124
- /**
125
- * The width of the youtube video.
126
- * @default 640
127
- * @example 1280
128
- */
129
- width: number;
130
- /**
131
- * Controls if the related youtube videos at the end are from the same channel.
132
- * @default 1
133
- * @example 0
134
- */
135
- rel: number;
136
- }
137
- /**
138
- * The options for setting a youtube video.
139
- */
140
- type SetYoutubeVideoOptions = {
141
- src: string;
142
- width?: number;
143
- height?: number;
144
- start?: number;
145
- };
146
- declare module '@tiptap/core' {
147
- interface Commands<ReturnType> {
148
- youtube: {
149
- /**
150
- * Insert a youtube video
151
- * @param options The youtube video attributes
152
- * @example editor.commands.setYoutubeVideo({ src: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ' })
153
- */
154
- setYoutubeVideo: (options: SetYoutubeVideoOptions) => ReturnType;
155
- };
156
- }
157
- }
158
- /**
159
- * This extension adds support for youtube videos.
160
- * @see https://www.tiptap.dev/api/nodes/youtube
161
- */
162
- declare const Youtube: Node<YoutubeOptions, any>;
163
-
164
- export { Youtube, type YoutubeOptions, Youtube as default };
package/dist/index.d.ts DELETED
@@ -1,164 +0,0 @@
1
- import { Node } from '@tiptap/core';
2
-
3
- interface YoutubeOptions {
4
- /**
5
- * Controls if the paste handler for youtube videos should be added.
6
- * @default true
7
- * @example false
8
- */
9
- addPasteHandler: boolean;
10
- /**
11
- * Controls if the youtube video should be allowed to go fullscreen.
12
- * @default true
13
- * @example false
14
- */
15
- allowFullscreen: boolean;
16
- /**
17
- * Controls if the youtube video should autoplay.
18
- * @default false
19
- * @example true
20
- */
21
- autoplay: boolean;
22
- /**
23
- * The language of the captions shown in the youtube video.
24
- * @default undefined
25
- * @example 'en'
26
- */
27
- ccLanguage?: string;
28
- /**
29
- * Controls if the captions should be shown in the youtube video.
30
- * @default undefined
31
- * @example true
32
- */
33
- ccLoadPolicy?: boolean;
34
- /**
35
- * Controls if the controls should be shown in the youtube video.
36
- * @default true
37
- * @example false
38
- */
39
- controls: boolean;
40
- /**
41
- * Controls if the keyboard controls should be disabled in the youtube video.
42
- * @default false
43
- * @example true
44
- */
45
- disableKBcontrols: boolean;
46
- /**
47
- * Controls if the iframe api should be enabled in the youtube video.
48
- * @default false
49
- * @example true
50
- */
51
- enableIFrameApi: boolean;
52
- /**
53
- * The end time of the youtube video.
54
- * @default 0
55
- * @example 120
56
- */
57
- endTime: number;
58
- /**
59
- * The height of the youtube video.
60
- * @default 480
61
- * @example 720
62
- */
63
- height: number;
64
- /**
65
- * The language of the youtube video.
66
- * @default undefined
67
- * @example 'en'
68
- */
69
- interfaceLanguage?: string;
70
- /**
71
- * Controls if the video annotations should be shown in the youtube video.
72
- * @default 0
73
- * @example 1
74
- */
75
- ivLoadPolicy: number;
76
- /**
77
- * Controls if the youtube video should loop.
78
- * @default false
79
- * @example true
80
- */
81
- loop: boolean;
82
- /**
83
- * Controls if the youtube video should show a small youtube logo.
84
- * @default false
85
- * @example true
86
- */
87
- modestBranding: boolean;
88
- /**
89
- * The HTML attributes for a youtube video node.
90
- * @default {}
91
- * @example { class: 'foo' }
92
- */
93
- HTMLAttributes: Record<string, any>;
94
- /**
95
- * Controls if the youtube node should be inline or not.
96
- * @default false
97
- * @example true
98
- */
99
- inline: boolean;
100
- /**
101
- * Controls if the youtube video should be loaded from youtube-nocookie.com.
102
- * @default false
103
- * @example true
104
- */
105
- nocookie: boolean;
106
- /**
107
- * The origin of the youtube video.
108
- * @default ''
109
- * @example 'https://tiptap.dev'
110
- */
111
- origin: string;
112
- /**
113
- * The playlist of the youtube video.
114
- * @default ''
115
- * @example 'PLQg6GaokU5CwiVmsZ0dZm6VeIg0V5z1tK'
116
- */
117
- playlist: string;
118
- /**
119
- * The color of the youtube video progress bar.
120
- * @default undefined
121
- * @example 'red'
122
- */
123
- progressBarColor?: string;
124
- /**
125
- * The width of the youtube video.
126
- * @default 640
127
- * @example 1280
128
- */
129
- width: number;
130
- /**
131
- * Controls if the related youtube videos at the end are from the same channel.
132
- * @default 1
133
- * @example 0
134
- */
135
- rel: number;
136
- }
137
- /**
138
- * The options for setting a youtube video.
139
- */
140
- type SetYoutubeVideoOptions = {
141
- src: string;
142
- width?: number;
143
- height?: number;
144
- start?: number;
145
- };
146
- declare module '@tiptap/core' {
147
- interface Commands<ReturnType> {
148
- youtube: {
149
- /**
150
- * Insert a youtube video
151
- * @param options The youtube video attributes
152
- * @example editor.commands.setYoutubeVideo({ src: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ' })
153
- */
154
- setYoutubeVideo: (options: SetYoutubeVideoOptions) => ReturnType;
155
- };
156
- }
157
- }
158
- /**
159
- * This extension adds support for youtube videos.
160
- * @see https://www.tiptap.dev/api/nodes/youtube
161
- */
162
- declare const Youtube: Node<YoutubeOptions, any>;
163
-
164
- export { Youtube, type YoutubeOptions, Youtube as default };
package/dist/index.js DELETED
@@ -1,267 +0,0 @@
1
- // src/youtube.ts
2
- import { createAtomBlockMarkdownSpec, mergeAttributes, Node, nodePasteRule } from "@tiptap/core";
3
-
4
- // src/utils.ts
5
- var YOUTUBE_REGEX = /^((?:https?:)?\/\/)?((?:www|m|music)\.)?((?:youtube\.com|youtu\.be|youtube-nocookie\.com))(\/(?:[\w-]+\?v=|embed\/|v\/)?)([\w-]+)(\S+)?$/;
6
- var YOUTUBE_REGEX_GLOBAL = /^((?:https?:)?\/\/)?((?:www|m|music)\.)?((?:youtube\.com|youtu\.be|youtube-nocookie\.com))(\/(?:[\w-]+\?v=|embed\/|v\/)?)([\w-]+)(\S+)?$/g;
7
- var isValidYoutubeUrl = (url) => {
8
- return url.match(YOUTUBE_REGEX);
9
- };
10
- var getYoutubeEmbedUrl = (nocookie, isPlaylist) => {
11
- if (isPlaylist) {
12
- return "https://www.youtube-nocookie.com/embed/videoseries?list=";
13
- }
14
- return nocookie ? "https://www.youtube-nocookie.com/embed/" : "https://www.youtube.com/embed/";
15
- };
16
- var getEmbedUrlFromYoutubeUrl = (options) => {
17
- const {
18
- url,
19
- allowFullscreen,
20
- autoplay,
21
- ccLanguage,
22
- ccLoadPolicy,
23
- controls,
24
- disableKBcontrols,
25
- enableIFrameApi,
26
- endTime,
27
- interfaceLanguage,
28
- ivLoadPolicy,
29
- loop,
30
- modestBranding,
31
- nocookie,
32
- origin,
33
- playlist,
34
- progressBarColor,
35
- startAt,
36
- rel
37
- } = options;
38
- if (!isValidYoutubeUrl(url)) {
39
- return null;
40
- }
41
- if (url.includes("/embed/")) {
42
- return url;
43
- }
44
- if (url.includes("youtu.be")) {
45
- const id = url.split("/").pop();
46
- if (!id) {
47
- return null;
48
- }
49
- return `${getYoutubeEmbedUrl(nocookie)}${id}`;
50
- }
51
- const videoIdRegex = /(?:(v|list)=|shorts\/)([-\w]+)/gm;
52
- const matches = videoIdRegex.exec(url);
53
- if (!matches || !matches[2]) {
54
- return null;
55
- }
56
- let outputUrl = `${getYoutubeEmbedUrl(nocookie, matches[1] === "list")}${matches[2]}`;
57
- const params = [];
58
- if (allowFullscreen === false) {
59
- params.push("fs=0");
60
- }
61
- if (autoplay) {
62
- params.push("autoplay=1");
63
- }
64
- if (ccLanguage) {
65
- params.push(`cc_lang_pref=${ccLanguage}`);
66
- }
67
- if (ccLoadPolicy) {
68
- params.push("cc_load_policy=1");
69
- }
70
- if (!controls) {
71
- params.push("controls=0");
72
- }
73
- if (disableKBcontrols) {
74
- params.push("disablekb=1");
75
- }
76
- if (enableIFrameApi) {
77
- params.push("enablejsapi=1");
78
- }
79
- if (endTime) {
80
- params.push(`end=${endTime}`);
81
- }
82
- if (interfaceLanguage) {
83
- params.push(`hl=${interfaceLanguage}`);
84
- }
85
- if (ivLoadPolicy) {
86
- params.push(`iv_load_policy=${ivLoadPolicy}`);
87
- }
88
- if (loop) {
89
- params.push("loop=1");
90
- }
91
- if (modestBranding) {
92
- params.push("modestbranding=1");
93
- }
94
- if (origin) {
95
- params.push(`origin=${origin}`);
96
- }
97
- if (playlist) {
98
- params.push(`playlist=${playlist}`);
99
- }
100
- if (startAt) {
101
- params.push(`start=${startAt}`);
102
- }
103
- if (progressBarColor) {
104
- params.push(`color=${progressBarColor}`);
105
- }
106
- if (rel !== void 0) {
107
- params.push(`rel=${rel}`);
108
- }
109
- if (params.length) {
110
- outputUrl += `${matches[1] === "list" ? "&" : "?"}${params.join("&")}`;
111
- }
112
- return outputUrl;
113
- };
114
-
115
- // src/youtube.ts
116
- var Youtube = Node.create({
117
- name: "youtube",
118
- addOptions() {
119
- return {
120
- addPasteHandler: true,
121
- allowFullscreen: true,
122
- autoplay: false,
123
- ccLanguage: void 0,
124
- ccLoadPolicy: void 0,
125
- controls: true,
126
- disableKBcontrols: false,
127
- enableIFrameApi: false,
128
- endTime: 0,
129
- height: 480,
130
- interfaceLanguage: void 0,
131
- ivLoadPolicy: 0,
132
- loop: false,
133
- modestBranding: false,
134
- HTMLAttributes: {},
135
- inline: false,
136
- nocookie: false,
137
- origin: "",
138
- playlist: "",
139
- progressBarColor: void 0,
140
- width: 640,
141
- rel: 1
142
- };
143
- },
144
- inline() {
145
- return this.options.inline;
146
- },
147
- group() {
148
- return this.options.inline ? "inline" : "block";
149
- },
150
- draggable: true,
151
- addAttributes() {
152
- return {
153
- src: {
154
- default: null
155
- },
156
- start: {
157
- default: 0
158
- },
159
- width: {
160
- default: this.options.width
161
- },
162
- height: {
163
- default: this.options.height
164
- }
165
- };
166
- },
167
- parseHTML() {
168
- return [
169
- {
170
- tag: "div[data-youtube-video] iframe"
171
- }
172
- ];
173
- },
174
- addCommands() {
175
- return {
176
- setYoutubeVideo: (options) => ({ commands }) => {
177
- if (!isValidYoutubeUrl(options.src)) {
178
- return false;
179
- }
180
- return commands.insertContent({
181
- type: this.name,
182
- attrs: options
183
- });
184
- }
185
- };
186
- },
187
- addPasteRules() {
188
- if (!this.options.addPasteHandler) {
189
- return [];
190
- }
191
- return [
192
- nodePasteRule({
193
- find: YOUTUBE_REGEX_GLOBAL,
194
- type: this.type,
195
- getAttributes: (match) => {
196
- return { src: match.input };
197
- }
198
- })
199
- ];
200
- },
201
- renderHTML({ HTMLAttributes }) {
202
- const embedUrl = getEmbedUrlFromYoutubeUrl({
203
- url: HTMLAttributes.src,
204
- allowFullscreen: this.options.allowFullscreen,
205
- autoplay: this.options.autoplay,
206
- ccLanguage: this.options.ccLanguage,
207
- ccLoadPolicy: this.options.ccLoadPolicy,
208
- controls: this.options.controls,
209
- disableKBcontrols: this.options.disableKBcontrols,
210
- enableIFrameApi: this.options.enableIFrameApi,
211
- endTime: this.options.endTime,
212
- interfaceLanguage: this.options.interfaceLanguage,
213
- ivLoadPolicy: this.options.ivLoadPolicy,
214
- loop: this.options.loop,
215
- modestBranding: this.options.modestBranding,
216
- nocookie: this.options.nocookie,
217
- origin: this.options.origin,
218
- playlist: this.options.playlist,
219
- progressBarColor: this.options.progressBarColor,
220
- startAt: HTMLAttributes.start || 0,
221
- rel: this.options.rel
222
- });
223
- HTMLAttributes.src = embedUrl;
224
- return [
225
- "div",
226
- { "data-youtube-video": "" },
227
- [
228
- "iframe",
229
- mergeAttributes(
230
- this.options.HTMLAttributes,
231
- {
232
- width: this.options.width,
233
- height: this.options.height,
234
- allowfullscreen: this.options.allowFullscreen,
235
- autoplay: this.options.autoplay,
236
- ccLanguage: this.options.ccLanguage,
237
- ccLoadPolicy: this.options.ccLoadPolicy,
238
- disableKBcontrols: this.options.disableKBcontrols,
239
- enableIFrameApi: this.options.enableIFrameApi,
240
- endTime: this.options.endTime,
241
- interfaceLanguage: this.options.interfaceLanguage,
242
- ivLoadPolicy: this.options.ivLoadPolicy,
243
- loop: this.options.loop,
244
- modestBranding: this.options.modestBranding,
245
- origin: this.options.origin,
246
- playlist: this.options.playlist,
247
- progressBarColor: this.options.progressBarColor,
248
- rel: this.options.rel
249
- },
250
- HTMLAttributes
251
- )
252
- ]
253
- ];
254
- },
255
- ...createAtomBlockMarkdownSpec({
256
- nodeName: "youtube",
257
- allowedAttributes: ["src", "width", "height", "start"]
258
- })
259
- });
260
-
261
- // src/index.ts
262
- var index_default = Youtube;
263
- export {
264
- Youtube,
265
- index_default as default
266
- };
267
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/youtube.ts","../src/utils.ts","../src/index.ts"],"sourcesContent":["import { createAtomBlockMarkdownSpec, mergeAttributes, Node, nodePasteRule } from '@tiptap/core'\n\nimport { getEmbedUrlFromYoutubeUrl, isValidYoutubeUrl, YOUTUBE_REGEX_GLOBAL } from './utils.js'\n\nexport interface YoutubeOptions {\n /**\n * Controls if the paste handler for youtube videos should be added.\n * @default true\n * @example false\n */\n addPasteHandler: boolean\n\n /**\n * Controls if the youtube video should be allowed to go fullscreen.\n * @default true\n * @example false\n */\n allowFullscreen: boolean\n\n /**\n * Controls if the youtube video should autoplay.\n * @default false\n * @example true\n */\n autoplay: boolean\n\n /**\n * The language of the captions shown in the youtube video.\n * @default undefined\n * @example 'en'\n */\n ccLanguage?: string\n\n /**\n * Controls if the captions should be shown in the youtube video.\n * @default undefined\n * @example true\n */\n ccLoadPolicy?: boolean\n\n /**\n * Controls if the controls should be shown in the youtube video.\n * @default true\n * @example false\n */\n controls: boolean\n\n /**\n * Controls if the keyboard controls should be disabled in the youtube video.\n * @default false\n * @example true\n */\n disableKBcontrols: boolean\n\n /**\n * Controls if the iframe api should be enabled in the youtube video.\n * @default false\n * @example true\n */\n enableIFrameApi: boolean\n\n /**\n * The end time of the youtube video.\n * @default 0\n * @example 120\n */\n endTime: number\n\n /**\n * The height of the youtube video.\n * @default 480\n * @example 720\n */\n height: number\n\n /**\n * The language of the youtube video.\n * @default undefined\n * @example 'en'\n */\n interfaceLanguage?: string\n\n /**\n * Controls if the video annotations should be shown in the youtube video.\n * @default 0\n * @example 1\n */\n ivLoadPolicy: number\n\n /**\n * Controls if the youtube video should loop.\n * @default false\n * @example true\n */\n loop: boolean\n\n /**\n * Controls if the youtube video should show a small youtube logo.\n * @default false\n * @example true\n */\n modestBranding: boolean\n\n /**\n * The HTML attributes for a youtube video node.\n * @default {}\n * @example { class: 'foo' }\n */\n HTMLAttributes: Record<string, any>\n\n /**\n * Controls if the youtube node should be inline or not.\n * @default false\n * @example true\n */\n inline: boolean\n\n /**\n * Controls if the youtube video should be loaded from youtube-nocookie.com.\n * @default false\n * @example true\n */\n nocookie: boolean\n\n /**\n * The origin of the youtube video.\n * @default ''\n * @example 'https://tiptap.dev'\n */\n origin: string\n\n /**\n * The playlist of the youtube video.\n * @default ''\n * @example 'PLQg6GaokU5CwiVmsZ0dZm6VeIg0V5z1tK'\n */\n playlist: string\n\n /**\n * The color of the youtube video progress bar.\n * @default undefined\n * @example 'red'\n */\n progressBarColor?: string\n\n /**\n * The width of the youtube video.\n * @default 640\n * @example 1280\n */\n width: number\n\n /**\n * Controls if the related youtube videos at the end are from the same channel.\n * @default 1\n * @example 0\n */\n rel: number\n}\n\n/**\n * The options for setting a youtube video.\n */\ntype SetYoutubeVideoOptions = { src: string; width?: number; height?: number; start?: number }\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n youtube: {\n /**\n * Insert a youtube video\n * @param options The youtube video attributes\n * @example editor.commands.setYoutubeVideo({ src: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ' })\n */\n setYoutubeVideo: (options: SetYoutubeVideoOptions) => ReturnType\n }\n }\n}\n\n/**\n * This extension adds support for youtube videos.\n * @see https://www.tiptap.dev/api/nodes/youtube\n */\nexport const Youtube = Node.create<YoutubeOptions>({\n name: 'youtube',\n\n addOptions() {\n return {\n addPasteHandler: true,\n allowFullscreen: true,\n autoplay: false,\n ccLanguage: undefined,\n ccLoadPolicy: undefined,\n controls: true,\n disableKBcontrols: false,\n enableIFrameApi: false,\n endTime: 0,\n height: 480,\n interfaceLanguage: undefined,\n ivLoadPolicy: 0,\n loop: false,\n modestBranding: false,\n HTMLAttributes: {},\n inline: false,\n nocookie: false,\n origin: '',\n playlist: '',\n progressBarColor: undefined,\n width: 640,\n rel: 1,\n }\n },\n\n inline() {\n return this.options.inline\n },\n\n group() {\n return this.options.inline ? 'inline' : 'block'\n },\n\n draggable: true,\n\n addAttributes() {\n return {\n src: {\n default: null,\n },\n start: {\n default: 0,\n },\n width: {\n default: this.options.width,\n },\n height: {\n default: this.options.height,\n },\n }\n },\n\n parseHTML() {\n return [\n {\n tag: 'div[data-youtube-video] iframe',\n },\n ]\n },\n\n addCommands() {\n return {\n setYoutubeVideo:\n (options: SetYoutubeVideoOptions) =>\n ({ commands }) => {\n if (!isValidYoutubeUrl(options.src)) {\n return false\n }\n\n return commands.insertContent({\n type: this.name,\n attrs: options,\n })\n },\n }\n },\n\n addPasteRules() {\n if (!this.options.addPasteHandler) {\n return []\n }\n\n return [\n nodePasteRule({\n find: YOUTUBE_REGEX_GLOBAL,\n type: this.type,\n getAttributes: match => {\n return { src: match.input }\n },\n }),\n ]\n },\n\n renderHTML({ HTMLAttributes }) {\n const embedUrl = getEmbedUrlFromYoutubeUrl({\n url: HTMLAttributes.src,\n allowFullscreen: this.options.allowFullscreen,\n autoplay: this.options.autoplay,\n ccLanguage: this.options.ccLanguage,\n ccLoadPolicy: this.options.ccLoadPolicy,\n controls: this.options.controls,\n disableKBcontrols: this.options.disableKBcontrols,\n enableIFrameApi: this.options.enableIFrameApi,\n endTime: this.options.endTime,\n interfaceLanguage: this.options.interfaceLanguage,\n ivLoadPolicy: this.options.ivLoadPolicy,\n loop: this.options.loop,\n modestBranding: this.options.modestBranding,\n nocookie: this.options.nocookie,\n origin: this.options.origin,\n playlist: this.options.playlist,\n progressBarColor: this.options.progressBarColor,\n startAt: HTMLAttributes.start || 0,\n rel: this.options.rel,\n })\n\n HTMLAttributes.src = embedUrl\n\n return [\n 'div',\n { 'data-youtube-video': '' },\n [\n 'iframe',\n mergeAttributes(\n this.options.HTMLAttributes,\n {\n width: this.options.width,\n height: this.options.height,\n allowfullscreen: this.options.allowFullscreen,\n autoplay: this.options.autoplay,\n ccLanguage: this.options.ccLanguage,\n ccLoadPolicy: this.options.ccLoadPolicy,\n disableKBcontrols: this.options.disableKBcontrols,\n enableIFrameApi: this.options.enableIFrameApi,\n endTime: this.options.endTime,\n interfaceLanguage: this.options.interfaceLanguage,\n ivLoadPolicy: this.options.ivLoadPolicy,\n loop: this.options.loop,\n modestBranding: this.options.modestBranding,\n origin: this.options.origin,\n playlist: this.options.playlist,\n progressBarColor: this.options.progressBarColor,\n rel: this.options.rel,\n },\n HTMLAttributes,\n ),\n ],\n ]\n },\n\n ...createAtomBlockMarkdownSpec({\n nodeName: 'youtube',\n allowedAttributes: ['src', 'width', 'height', 'start'],\n }),\n})\n","export const YOUTUBE_REGEX =\n /^((?:https?:)?\\/\\/)?((?:www|m|music)\\.)?((?:youtube\\.com|youtu\\.be|youtube-nocookie\\.com))(\\/(?:[\\w-]+\\?v=|embed\\/|v\\/)?)([\\w-]+)(\\S+)?$/\nexport const YOUTUBE_REGEX_GLOBAL =\n /^((?:https?:)?\\/\\/)?((?:www|m|music)\\.)?((?:youtube\\.com|youtu\\.be|youtube-nocookie\\.com))(\\/(?:[\\w-]+\\?v=|embed\\/|v\\/)?)([\\w-]+)(\\S+)?$/g\n\nexport const isValidYoutubeUrl = (url: string) => {\n return url.match(YOUTUBE_REGEX)\n}\n\nexport interface GetEmbedUrlOptions {\n url: string\n allowFullscreen?: boolean\n autoplay?: boolean\n ccLanguage?: string\n ccLoadPolicy?: boolean\n controls?: boolean\n disableKBcontrols?: boolean\n enableIFrameApi?: boolean\n endTime?: number\n interfaceLanguage?: string\n ivLoadPolicy?: number\n loop?: boolean\n modestBranding?: boolean\n nocookie?: boolean\n origin?: string\n playlist?: string\n progressBarColor?: string\n startAt?: number\n rel?: number\n}\n\nexport const getYoutubeEmbedUrl = (nocookie?: boolean, isPlaylist?: boolean) => {\n if (isPlaylist) {\n return 'https://www.youtube-nocookie.com/embed/videoseries?list='\n }\n return nocookie ? 'https://www.youtube-nocookie.com/embed/' : 'https://www.youtube.com/embed/'\n}\n\nexport const getEmbedUrlFromYoutubeUrl = (options: GetEmbedUrlOptions) => {\n const {\n url,\n allowFullscreen,\n autoplay,\n ccLanguage,\n ccLoadPolicy,\n controls,\n disableKBcontrols,\n enableIFrameApi,\n endTime,\n interfaceLanguage,\n ivLoadPolicy,\n loop,\n modestBranding,\n nocookie,\n origin,\n playlist,\n progressBarColor,\n startAt,\n rel,\n } = options\n\n if (!isValidYoutubeUrl(url)) {\n return null\n }\n\n // if is already an embed url, return it\n if (url.includes('/embed/')) {\n return url\n }\n\n // if is a youtu.be url, get the id after the /\n if (url.includes('youtu.be')) {\n const id = url.split('/').pop()\n\n if (!id) {\n return null\n }\n return `${getYoutubeEmbedUrl(nocookie)}${id}`\n }\n\n const videoIdRegex = /(?:(v|list)=|shorts\\/)([-\\w]+)/gm\n const matches = videoIdRegex.exec(url)\n\n if (!matches || !matches[2]) {\n return null\n }\n\n let outputUrl = `${getYoutubeEmbedUrl(nocookie, matches[1] === 'list')}${matches[2]}`\n\n const params = []\n\n if (allowFullscreen === false) {\n params.push('fs=0')\n }\n\n if (autoplay) {\n params.push('autoplay=1')\n }\n\n if (ccLanguage) {\n params.push(`cc_lang_pref=${ccLanguage}`)\n }\n\n if (ccLoadPolicy) {\n params.push('cc_load_policy=1')\n }\n\n if (!controls) {\n params.push('controls=0')\n }\n\n if (disableKBcontrols) {\n params.push('disablekb=1')\n }\n\n if (enableIFrameApi) {\n params.push('enablejsapi=1')\n }\n\n if (endTime) {\n params.push(`end=${endTime}`)\n }\n\n if (interfaceLanguage) {\n params.push(`hl=${interfaceLanguage}`)\n }\n\n if (ivLoadPolicy) {\n params.push(`iv_load_policy=${ivLoadPolicy}`)\n }\n\n if (loop) {\n params.push('loop=1')\n }\n\n if (modestBranding) {\n params.push('modestbranding=1')\n }\n\n if (origin) {\n params.push(`origin=${origin}`)\n }\n\n if (playlist) {\n params.push(`playlist=${playlist}`)\n }\n\n if (startAt) {\n params.push(`start=${startAt}`)\n }\n\n if (progressBarColor) {\n params.push(`color=${progressBarColor}`)\n }\n\n if (rel !== undefined) {\n params.push(`rel=${rel}`)\n }\n\n if (params.length) {\n outputUrl += `${matches[1] === 'list' ? '&' : '?'}${params.join('&')}`\n }\n\n return outputUrl\n}\n","import { Youtube } from './youtube.js'\n\nexport * from './youtube.js'\n\nexport default Youtube\n"],"mappings":";AAAA,SAAS,6BAA6B,iBAAiB,MAAM,qBAAqB;;;ACA3E,IAAM,gBACX;AACK,IAAM,uBACX;AAEK,IAAM,oBAAoB,CAAC,QAAgB;AAChD,SAAO,IAAI,MAAM,aAAa;AAChC;AAwBO,IAAM,qBAAqB,CAAC,UAAoB,eAAyB;AAC9E,MAAI,YAAY;AACd,WAAO;AAAA,EACT;AACA,SAAO,WAA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