payload-richtext-tiptap 0.0.163 → 0.0.165

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.
Files changed (29) hide show
  1. package/dist/src/fields/TiptapEditor/extensions/ImageUpload/ImageUpload.d.ts.map +1 -1
  2. package/dist/src/fields/TiptapEditor/extensions/ImageUpload/ImageUpload.js +1 -0
  3. package/dist/src/fields/TiptapEditor/extensions/ImageUpload/ImageUpload.js.map +1 -1
  4. package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockV1.d.ts +33 -0
  5. package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockV1.d.ts.map +1 -0
  6. package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockV1.js +94 -0
  7. package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockV1.js.map +1 -0
  8. package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockV2.d.ts +19 -0
  9. package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockV2.d.ts.map +1 -0
  10. package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockV2.js +52 -0
  11. package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockV2.js.map +1 -0
  12. package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockView.d.ts.map +1 -1
  13. package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockView.js +11 -44
  14. package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockView.js.map +1 -1
  15. package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockViewClientside.d.ts +1 -1
  16. package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockViewClientside.d.ts.map +1 -1
  17. package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockViewClientside.js +12 -115
  18. package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockViewClientside.js.map +1 -1
  19. package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockViewClientsideV1.d.ts +31 -0
  20. package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockViewClientsideV1.d.ts.map +1 -0
  21. package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockViewClientsideV1.js +120 -0
  22. package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockViewClientsideV1.js.map +1 -0
  23. package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockViewClientsideV2.d.ts +31 -0
  24. package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockViewClientsideV2.d.ts.map +1 -0
  25. package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockViewClientsideV2.js +78 -0
  26. package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockViewClientsideV2.js.map +1 -0
  27. package/dist/src/fields/TiptapEditor/lib/tiptapSchema.d.ts +66 -66
  28. package/dist/tsconfig.tsbuildinfo +1 -1
  29. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ImageUpload.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/ImageUpload/ImageUpload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAyB,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAmB,MAAM,gBAAgB,CAAC;AAG5D,OAAO,QAAQ,cAAc,CAAC;IAC5B,UAAU,QAAQ,CAAC,UAAU;QAC3B,WAAW,EAAE;YACX,cAAc,EAAE,CAAC,IAAI,CAAC,EAAE,SAAS,KAAK,UAAU,CAAC;SAClD,CAAC;KACH;CACF;AAED,eAAO,MAAM,WAAW,gBAoDtB,CAAC;AAEH,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"ImageUpload.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/ImageUpload/ImageUpload.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAyB,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAmB,MAAM,gBAAgB,CAAC;AAG5D,OAAO,QAAQ,cAAc,CAAC;IAC5B,UAAU,QAAQ,CAAC,UAAU;QAC3B,WAAW,EAAE;YACX,cAAc,EAAE,CAAC,IAAI,CAAC,EAAE,SAAS,KAAK,UAAU,CAAC;SAClD,CAAC;KACH;CACF;AAED,eAAO,MAAM,WAAW,gBAoDtB,CAAC;AAEH,eAAe,WAAW,CAAC"}
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  import { Node, ReactNodeViewRenderer } from "@tiptap/react";
2
3
  import { ImageUploadBuilder } from "./view/ImageUpload.js";
3
4
  export const ImageUpload = Node.create({
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/ImageUpload/ImageUpload.ts"],"sourcesContent":["import { Node, ReactNodeViewRenderer } from \"@tiptap/react\";\nimport { AssetType, openAssetHQType } from \"../../types.js\";\nimport { ImageUploadBuilder } from \"./view/ImageUpload.js\";\n\ndeclare module \"@tiptap/core\" {\n interface Commands<ReturnType> {\n imageUpload: {\n setImageUpload: (type?: AssetType) => ReturnType;\n };\n }\n}\n\nexport const ImageUpload = Node.create({\n name: \"imageUpload\",\n\n isolating: true,\n\n defining: true,\n\n group: \"block\",\n\n draggable: true,\n\n selectable: true,\n\n inline: false,\n\n parseHTML() {\n return [\n {\n tag: `div[data-type=\"${this.name}\"]`,\n },\n ];\n },\n\n renderHTML() {\n return [\"div\", { \"data-type\": this.name }];\n },\n\n addAttributes() {\n return {\n type: { default: null },\n };\n },\n addCommands() {\n return {\n setImageUpload:\n (type?: AssetType) =>\n ({ commands }) => {\n return commands.insertContent({\n type: \"imageUpload\",\n attrs: {\n type,\n },\n });\n },\n };\n },\n\n addNodeView() {\n const openAssetHQHandler = this.options\n .openAssetHQHandler as openAssetHQType;\n return ReactNodeViewRenderer(ImageUploadBuilder(openAssetHQHandler));\n },\n});\n\nexport default ImageUpload;\n"],"names":["Node","ReactNodeViewRenderer","ImageUploadBuilder","ImageUpload","create","name","isolating","defining","group","draggable","selectable","inline","parseHTML","tag","renderHTML","addAttributes","type","default","addCommands","setImageUpload","commands","insertContent","attrs","addNodeView","openAssetHQHandler","options"],"mappings":"AAAA,SAASA,IAAI,EAAEC,qBAAqB,QAAQ,gBAAgB;AAE5D,SAASC,kBAAkB,QAAQ,wBAAwB;AAU3D,OAAO,MAAMC,cAAcH,KAAKI,MAAM,CAAC;IACrCC,MAAM;IAENC,WAAW;IAEXC,UAAU;IAEVC,OAAO;IAEPC,WAAW;IAEXC,YAAY;IAEZC,QAAQ;IAERC;QACE,OAAO;YACL;gBACEC,KAAK,CAAC,eAAe,EAAE,IAAI,CAACR,IAAI,CAAC,EAAE,CAAC;YACtC;SACD;IACH;IAEAS;QACE,OAAO;YAAC;YAAO;gBAAE,aAAa,IAAI,CAACT,IAAI;YAAC;SAAE;IAC5C;IAEAU;QACE,OAAO;YACLC,MAAM;gBAAEC,SAAS;YAAK;QACxB;IACF;IACAC;QACE,OAAO;YACLC,gBACE,CAACH,OACD,CAAC,EAAEI,QAAQ,EAAE;oBACX,OAAOA,SAASC,aAAa,CAAC;wBAC5BL,MAAM;wBACNM,OAAO;4BACLN;wBACF;oBACF;gBACF;QACJ;IACF;IAEAO;QACE,MAAMC,qBAAqB,IAAI,CAACC,OAAO,CACpCD,kBAAkB;QACrB,OAAOvB,sBAAsBC,mBAAmBsB;IAClD;AACF,GAAG;AAEH,eAAerB,YAAY"}
1
+ {"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/ImageUpload/ImageUpload.ts"],"sourcesContent":["'use client';\nimport { Node, ReactNodeViewRenderer } from \"@tiptap/react\";\nimport { AssetType, openAssetHQType } from \"../../types.js\";\nimport { ImageUploadBuilder } from \"./view/ImageUpload.js\";\n\ndeclare module \"@tiptap/core\" {\n interface Commands<ReturnType> {\n imageUpload: {\n setImageUpload: (type?: AssetType) => ReturnType;\n };\n }\n}\n\nexport const ImageUpload = Node.create({\n name: \"imageUpload\",\n\n isolating: true,\n\n defining: true,\n\n group: \"block\",\n\n draggable: true,\n\n selectable: true,\n\n inline: false,\n\n parseHTML() {\n return [\n {\n tag: `div[data-type=\"${this.name}\"]`,\n },\n ];\n },\n\n renderHTML() {\n return [\"div\", { \"data-type\": this.name }];\n },\n\n addAttributes() {\n return {\n type: { default: null },\n };\n },\n addCommands() {\n return {\n setImageUpload:\n (type?: AssetType) =>\n ({ commands }) => {\n return commands.insertContent({\n type: \"imageUpload\",\n attrs: {\n type,\n },\n });\n },\n };\n },\n\n addNodeView() {\n const openAssetHQHandler = this.options\n .openAssetHQHandler as openAssetHQType;\n return ReactNodeViewRenderer(ImageUploadBuilder(openAssetHQHandler));\n },\n});\n\nexport default ImageUpload;\n"],"names":["Node","ReactNodeViewRenderer","ImageUploadBuilder","ImageUpload","create","name","isolating","defining","group","draggable","selectable","inline","parseHTML","tag","renderHTML","addAttributes","type","default","addCommands","setImageUpload","commands","insertContent","attrs","addNodeView","openAssetHQHandler","options"],"mappings":"AAAA;AACA,SAASA,IAAI,EAAEC,qBAAqB,QAAQ,gBAAgB;AAE5D,SAASC,kBAAkB,QAAQ,wBAAwB;AAU3D,OAAO,MAAMC,cAAcH,KAAKI,MAAM,CAAC;IACrCC,MAAM;IAENC,WAAW;IAEXC,UAAU;IAEVC,OAAO;IAEPC,WAAW;IAEXC,YAAY;IAEZC,QAAQ;IAERC;QACE,OAAO;YACL;gBACEC,KAAK,CAAC,eAAe,EAAE,IAAI,CAACR,IAAI,CAAC,EAAE,CAAC;YACtC;SACD;IACH;IAEAS;QACE,OAAO;YAAC;YAAO;gBAAE,aAAa,IAAI,CAACT,IAAI;YAAC;SAAE;IAC5C;IAEAU;QACE,OAAO;YACLC,MAAM;gBAAEC,SAAS;YAAK;QACxB;IACF;IACAC;QACE,OAAO;YACLC,gBACE,CAACH,OACD,CAAC,EAAEI,QAAQ,EAAE;oBACX,OAAOA,SAASC,aAAa,CAAC;wBAC5BL,MAAM;wBACNM,OAAO;4BACLN;wBACF;oBACF;gBACF;QACJ;IACF;IAEAO;QACE,MAAMC,qBAAqB,IAAI,CAACC,OAAO,CACpCD,kBAAkB;QACrB,OAAOvB,sBAAsBC,mBAAmBsB;IAClD;AACF,GAAG;AAEH,eAAerB,YAAY"}
@@ -0,0 +1,33 @@
1
+ import { Node } from "@tiptap/pm/model";
2
+ import { Editor } from "@tiptap/react";
3
+ import React from "react";
4
+ interface VideoBlockViewProps {
5
+ editor: Editor;
6
+ getPos: () => number;
7
+ node: Node & {
8
+ attrs: {
9
+ src: string;
10
+ poster: string;
11
+ assetId: string;
12
+ playlistUrl?: string;
13
+ };
14
+ };
15
+ updateAttributes: (attrs: Record<string, string>) => void;
16
+ }
17
+ export type Playlist = {
18
+ id: string;
19
+ title: string;
20
+ description: string;
21
+ poster: string;
22
+ items: Item[];
23
+ };
24
+ export type Item = {
25
+ src: string;
26
+ type: string;
27
+ label: string;
28
+ width: number;
29
+ height: number;
30
+ };
31
+ export declare const VideoBlockViewV1: (props: VideoBlockViewProps) => React.JSX.Element;
32
+ export default VideoBlockViewV1;
33
+ //# sourceMappingURL=VideoBlockV1.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VideoBlockV1.d.ts","sourceRoot":"","sources":["../../../../../../../src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockV1.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,MAAM,EAAmB,MAAM,eAAe,CAAC;AACxD,OAAO,KAAkD,MAAM,OAAO,CAAC;AAIvE,UAAU,mBAAmB;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,MAAM,CAAC;IACrB,IAAI,EAAE,IAAI,GAAG;QACX,KAAK,EAAE;YACL,GAAG,EAAE,MAAM,CAAC;YACZ,MAAM,EAAE,MAAM,CAAC;YACf,OAAO,EAAE,MAAM,CAAC;YAChB,WAAW,CAAC,EAAE,MAAM,CAAC;SACtB,CAAC;KACH,CAAC;IACF,gBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;CAC3D;AAED,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,IAAI,EAAE,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,IAAI,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,gBAAgB,UAAW,mBAAmB,sBAwG1D,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,94 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { NodeViewWrapper } from "@tiptap/react";
3
+ import React, { useCallback, useEffect, useMemo, useRef } from "react";
4
+ import { cn } from "../../../lib/utils/index.js";
5
+ import VideoPlayer from "./videojs/VideoPlayer.js";
6
+ export const VideoBlockViewV1 = (props)=>{
7
+ const { editor, getPos, node } = props;
8
+ const videoWrapperRef = useRef(null);
9
+ const { src, poster, playlistUrl, caption, title } = node.attrs;
10
+ const [playlistContent, setPlaylistContent] = React.useState();
11
+ const [error, setError] = React.useState("");
12
+ useEffect(()=>{
13
+ async function getPlaylistContent() {
14
+ try {
15
+ const res = await fetch(playlistUrl, {
16
+ cache: "no-cache"
17
+ });
18
+ return await res.json();
19
+ } catch {
20
+ setError("Issue with getting asset info");
21
+ return undefined;
22
+ }
23
+ }
24
+ if (playlistUrl) {
25
+ try {
26
+ getPlaylistContent().then((data)=>{
27
+ setPlaylistContent(data);
28
+ }).catch((err)=>{
29
+ setError(err);
30
+ });
31
+ } catch (error) {
32
+ setError(error);
33
+ }
34
+ }
35
+ }, [
36
+ playlistUrl
37
+ ]);
38
+ const wrapperClassName = cn(node.attrs.align === "left" ? "ml-0" : "ml-auto", node.attrs.align === "right" ? "mr-0" : "mr-auto", node.attrs.align === "center" && "mx-auto");
39
+ const onClick = useCallback(()=>{
40
+ editor.commands.setNodeSelection(getPos());
41
+ }, [
42
+ getPos,
43
+ editor.commands
44
+ ]);
45
+ const videoJsOptions = useMemo(()=>{
46
+ if (playlistContent == undefined) return {};
47
+ if (playlistContent.items.some((item)=>item.type === "application/x-mpegURL" || item.type === "application/vnd.apple.mpegurl")) {
48
+ return {
49
+ sources: playlistContent.items.filter((item)=>item.type === "application/x-mpegURL" || item.type === "application/vnd.apple.mpegurl").map((item)=>({
50
+ src: item.src,
51
+ type: item.type,
52
+ label: item.label
53
+ })),
54
+ poster: playlistContent.poster
55
+ };
56
+ }
57
+ return {
58
+ sources: playlistContent.items.map((item)=>({
59
+ src: item.src,
60
+ type: item.type,
61
+ label: item.label
62
+ })),
63
+ poster: playlistContent.poster
64
+ };
65
+ }, [
66
+ playlistContent
67
+ ]);
68
+ return /*#__PURE__*/ _jsx(NodeViewWrapper, {
69
+ children: /*#__PURE__*/ _jsx("div", {
70
+ className: wrapperClassName,
71
+ style: {
72
+ width: node.attrs.width
73
+ },
74
+ children: /*#__PURE__*/ _jsxs("div", {
75
+ ref: videoWrapperRef,
76
+ children: [
77
+ error && /*#__PURE__*/ _jsx("div", {
78
+ children: error
79
+ }),
80
+ playlistContent && /*#__PURE__*/ _jsx(VideoPlayer, {
81
+ options: videoJsOptions
82
+ }),
83
+ caption && playlistContent?.title && /*#__PURE__*/ _jsx("caption", {
84
+ className: "text-center block text-sm text-gray-500",
85
+ children: title || playlistContent?.title
86
+ })
87
+ ]
88
+ })
89
+ })
90
+ });
91
+ };
92
+ export default VideoBlockViewV1;
93
+
94
+ //# sourceMappingURL=VideoBlockV1.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockV1.tsx"],"sourcesContent":["import { Node } from \"@tiptap/pm/model\";\nimport { Editor, NodeViewWrapper } from \"@tiptap/react\";\nimport React, { useCallback, useEffect, useMemo, useRef } from \"react\";\nimport { cn } from \"../../../lib/utils/index.js\";\nimport VideoPlayer from \"./videojs/VideoPlayer.js\";\n\ninterface VideoBlockViewProps {\n editor: Editor;\n getPos: () => number;\n node: Node & {\n attrs: {\n src: string;\n poster: string;\n assetId: string;\n playlistUrl?: string;\n };\n };\n updateAttributes: (attrs: Record<string, string>) => void;\n}\n\nexport type Playlist = {\n id: string;\n title: string;\n description: string;\n poster: string;\n items: Item[];\n};\n\nexport type Item = {\n src: string;\n type: string;\n label: string;\n width: number;\n height: number;\n};\n\nexport const VideoBlockViewV1 = (props: VideoBlockViewProps) => {\n const { editor, getPos, node } = props;\n const videoWrapperRef = useRef<HTMLDivElement>(null);\n const { src, poster, playlistUrl, caption, title } = node.attrs;\n const [playlistContent, setPlaylistContent] = React.useState<\n Playlist | undefined\n >();\n const [error, setError] = React.useState(\"\");\n\n useEffect(() => {\n async function getPlaylistContent() {\n try {\n const res = await fetch(playlistUrl, {\n cache: \"no-cache\",\n });\n return await res.json();\n } catch {\n setError(\"Issue with getting asset info\");\n return undefined;\n }\n }\n\n if (playlistUrl) {\n try {\n getPlaylistContent()\n .then((data) => {\n setPlaylistContent(data);\n })\n .catch((err) => {\n setError(err);\n });\n } catch (error) {\n setError(error);\n }\n }\n }, [playlistUrl]);\n\n const wrapperClassName = cn(\n node.attrs.align === \"left\" ? \"ml-0\" : \"ml-auto\",\n node.attrs.align === \"right\" ? \"mr-0\" : \"mr-auto\",\n node.attrs.align === \"center\" && \"mx-auto\"\n );\n\n const onClick = useCallback(() => {\n editor.commands.setNodeSelection(getPos());\n }, [getPos, editor.commands]);\n\n const videoJsOptions = useMemo(() => {\n if (playlistContent == undefined) return {};\n\n if (\n playlistContent.items.some(\n (item) =>\n item.type === \"application/x-mpegURL\" ||\n item.type === \"application/vnd.apple.mpegurl\"\n )\n ) {\n return {\n sources: playlistContent.items\n .filter(\n (item) =>\n item.type === \"application/x-mpegURL\" ||\n item.type === \"application/vnd.apple.mpegurl\"\n )\n .map((item) => ({\n src: item.src,\n type: item.type,\n label: item.label,\n })),\n poster: playlistContent.poster,\n };\n }\n return {\n sources: playlistContent.items.map((item) => ({\n src: item.src,\n type: item.type,\n label: item.label,\n })),\n poster: playlistContent.poster,\n };\n }, [playlistContent]);\n return (\n <NodeViewWrapper>\n <div className={wrapperClassName} style={{ width: node.attrs.width }}>\n <div ref={videoWrapperRef}>\n {error && <div>{error}</div>}\n {/* <video\n controls\n className=\"block\"\n src={src}\n poster={poster}\n title=\"\"\n onClick={onClick}\n /> */}\n {playlistContent && <VideoPlayer options={videoJsOptions} />}\n {caption && playlistContent?.title && (\n <caption className=\"text-center block text-sm text-gray-500\">\n {title || playlistContent?.title}\n </caption>\n )}\n </div>\n </div>\n </NodeViewWrapper>\n );\n};\n\nexport default VideoBlockViewV1;\n"],"names":["NodeViewWrapper","React","useCallback","useEffect","useMemo","useRef","cn","VideoPlayer","VideoBlockViewV1","props","editor","getPos","node","videoWrapperRef","src","poster","playlistUrl","caption","title","attrs","playlistContent","setPlaylistContent","useState","error","setError","getPlaylistContent","res","fetch","cache","json","undefined","then","data","catch","err","wrapperClassName","align","onClick","commands","setNodeSelection","videoJsOptions","items","some","item","type","sources","filter","map","label","div","className","style","width","ref","options"],"mappings":"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"}
@@ -0,0 +1,19 @@
1
+ import { Node } from '@tiptap/pm/model';
2
+ import { Editor } from '@tiptap/react';
3
+ import React from 'react';
4
+ interface VideoBlockViewProps {
5
+ editor: Editor;
6
+ getPos: () => number;
7
+ node: Node & {
8
+ attrs: {
9
+ src: string;
10
+ poster: string;
11
+ assetId: string;
12
+ playlistUrl?: string;
13
+ };
14
+ };
15
+ updateAttributes: (attrs: Record<string, string>) => void;
16
+ }
17
+ export declare const NewVideoBlockView: (props: VideoBlockViewProps) => React.JSX.Element;
18
+ export default NewVideoBlockView;
19
+ //# sourceMappingURL=VideoBlockV2.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VideoBlockV2.d.ts","sourceRoot":"","sources":["../../../../../../../src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockV2.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AACvC,OAAO,EAAE,MAAM,EAAmB,MAAM,eAAe,CAAA;AACvD,OAAO,KAAkD,MAAM,OAAO,CAAA;AAItE,UAAU,mBAAmB;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,MAAM,CAAA;IACpB,IAAI,EAAE,IAAI,GAAG;QACX,KAAK,EAAE;YACL,GAAG,EAAE,MAAM,CAAA;YACX,MAAM,EAAE,MAAM,CAAA;YACd,OAAO,EAAE,MAAM,CAAA;YACf,WAAW,CAAC,EAAE,MAAM,CAAA;SACrB,CAAA;KACF,CAAA;IACD,gBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,CAAA;CAC1D;AAED,eAAO,MAAM,iBAAiB,UAAW,mBAAmB,sBA8C3D,CAAA;AAED,eAAe,iBAAiB,CAAA"}
@@ -0,0 +1,52 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { NodeViewWrapper } from '@tiptap/react';
3
+ import React, { useCallback, useMemo, useRef } from 'react';
4
+ import { cn } from '../../../lib/utils/index.js';
5
+ import VideoPlayer from './videojs/VideoPlayer.js';
6
+ export const NewVideoBlockView = (props)=>{
7
+ const { editor, getPos, node } = props;
8
+ const videoWrapperRef = useRef(null);
9
+ const { src, poster, optimizedImageUrl, playlistUrl, caption, title } = node.attrs;
10
+ const [error, setError] = React.useState('');
11
+ const wrapperClassName = cn(node.attrs.align === 'left' ? 'ml-0' : 'ml-auto', node.attrs.align === 'right' ? 'mr-0' : 'mr-auto', node.attrs.align === 'center' && 'mx-auto');
12
+ const onClick = useCallback(()=>{
13
+ editor.commands.setNodeSelection(getPos());
14
+ }, [
15
+ getPos,
16
+ editor.commands
17
+ ]);
18
+ const videoJsOptions = useMemo(()=>{
19
+ return {
20
+ sources: playlistUrl,
21
+ ...(poster || optimizedImageUrl) && {
22
+ poster: poster || optimizedImageUrl
23
+ }
24
+ };
25
+ }, []);
26
+ return /*#__PURE__*/ _jsx(NodeViewWrapper, {
27
+ children: /*#__PURE__*/ _jsx("div", {
28
+ className: wrapperClassName,
29
+ style: {
30
+ width: node.attrs.width
31
+ },
32
+ children: /*#__PURE__*/ _jsxs("div", {
33
+ ref: videoWrapperRef,
34
+ children: [
35
+ error && /*#__PURE__*/ _jsx("div", {
36
+ children: error
37
+ }),
38
+ playlistUrl && /*#__PURE__*/ _jsx(VideoPlayer, {
39
+ options: videoJsOptions
40
+ }),
41
+ caption && /*#__PURE__*/ _jsx("caption", {
42
+ className: "text-center block text-sm text-gray-500",
43
+ children: title || caption
44
+ })
45
+ ]
46
+ })
47
+ })
48
+ });
49
+ };
50
+ export default NewVideoBlockView;
51
+
52
+ //# sourceMappingURL=VideoBlockV2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockV2.tsx"],"sourcesContent":["import { Node } from '@tiptap/pm/model'\nimport { Editor, NodeViewWrapper } from '@tiptap/react'\nimport React, { useCallback, useEffect, useMemo, useRef } from 'react'\nimport { cn } from '../../../lib/utils/index.js'\nimport VideoPlayer from './videojs/VideoPlayer.js'\n\ninterface VideoBlockViewProps {\n editor: Editor\n getPos: () => number\n node: Node & {\n attrs: {\n src: string\n poster: string\n assetId: string\n playlistUrl?: string\n }\n }\n updateAttributes: (attrs: Record<string, string>) => void\n}\n\nexport const NewVideoBlockView = (props: VideoBlockViewProps) => {\n const { editor, getPos, node } = props\n const videoWrapperRef = useRef<HTMLDivElement>(null)\n const { src, poster, optimizedImageUrl, playlistUrl, caption, title } = node.attrs\n\n const [error, setError] = React.useState('')\n\n const wrapperClassName = cn(\n node.attrs.align === 'left' ? 'ml-0' : 'ml-auto',\n node.attrs.align === 'right' ? 'mr-0' : 'mr-auto',\n node.attrs.align === 'center' && 'mx-auto',\n )\n\n const onClick = useCallback(() => {\n editor.commands.setNodeSelection(getPos())\n }, [getPos, editor.commands])\n\n const videoJsOptions = useMemo(() => {\n return {\n sources: playlistUrl,\n ...((poster || optimizedImageUrl) && { poster: poster || optimizedImageUrl }),\n }\n }, [])\n return (\n <NodeViewWrapper>\n <div className={wrapperClassName} style={{ width: node.attrs.width }}>\n <div ref={videoWrapperRef}>\n {error && <div>{error}</div>}\n {/* <video\n controls\n className=\"block\"\n src={src}\n poster={poster}\n title=\"\"\n onClick={onClick}\n /> */}\n {playlistUrl && <VideoPlayer options={videoJsOptions} />}\n {caption && (\n <caption className=\"text-center block text-sm text-gray-500\">\n {title || caption}\n </caption>\n )}\n </div>\n </div>\n </NodeViewWrapper>\n )\n}\n\nexport default NewVideoBlockView\n"],"names":["NodeViewWrapper","React","useCallback","useMemo","useRef","cn","VideoPlayer","NewVideoBlockView","props","editor","getPos","node","videoWrapperRef","src","poster","optimizedImageUrl","playlistUrl","caption","title","attrs","error","setError","useState","wrapperClassName","align","onClick","commands","setNodeSelection","videoJsOptions","sources","div","className","style","width","ref","options"],"mappings":";AACA,SAAiBA,eAAe,QAAQ,gBAAe;AACvD,OAAOC,SAASC,WAAW,EAAaC,OAAO,EAAEC,MAAM,QAAQ,QAAO;AACtE,SAASC,EAAE,QAAQ,8BAA6B;AAChD,OAAOC,iBAAiB,2BAA0B;AAgBlD,OAAO,MAAMC,oBAAoB,CAACC;IAChC,MAAM,EAAEC,MAAM,EAAEC,MAAM,EAAEC,IAAI,EAAE,GAAGH;IACjC,MAAMI,kBAAkBR,OAAuB;IAC/C,MAAM,EAAES,GAAG,EAAEC,MAAM,EAAEC,iBAAiB,EAAEC,WAAW,EAAEC,OAAO,EAAEC,KAAK,EAAE,GAAGP,KAAKQ,KAAK;IAElF,MAAM,CAACC,OAAOC,SAAS,GAAGpB,MAAMqB,QAAQ,CAAC;IAEzC,MAAMC,mBAAmBlB,GACvBM,KAAKQ,KAAK,CAACK,KAAK,KAAK,SAAS,SAAS,WACvCb,KAAKQ,KAAK,CAACK,KAAK,KAAK,UAAU,SAAS,WACxCb,KAAKQ,KAAK,CAACK,KAAK,KAAK,YAAY;IAGnC,MAAMC,UAAUvB,YAAY;QAC1BO,OAAOiB,QAAQ,CAACC,gBAAgB,CAACjB;IACnC,GAAG;QAACA;QAAQD,OAAOiB,QAAQ;KAAC;IAE5B,MAAME,iBAAiBzB,QAAQ;QAC7B,OAAO;YACL0B,SAASb;YACT,GAAI,AAACF,CAAAA,UAAUC,iBAAgB,KAAM;gBAAED,QAAQA,UAAUC;YAAkB,CAAC;QAC9E;IACF,GAAG,EAAE;IACL,qBACE,KAACf;kBACC,cAAA,KAAC8B;YAAIC,WAAWR;YAAkBS,OAAO;gBAAEC,OAAOtB,KAAKQ,KAAK,CAACc,KAAK;YAAC;sBACjE,cAAA,MAACH;gBAAII,KAAKtB;;oBACPQ,uBAAS,KAACU;kCAAKV;;oBASfJ,6BAAe,KAACV;wBAAY6B,SAASP;;oBACrCX,yBACC,KAACA;wBAAQc,WAAU;kCAChBb,SAASD;;;;;;AAOxB,EAAC;AAED,eAAeV,kBAAiB"}
@@ -1 +1 @@
1
- {"version":3,"file":"VideoBlockView.d.ts","sourceRoot":"","sources":["../../../../../../../src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AACvC,OAAO,EAAE,MAAM,EAAmB,MAAM,eAAe,CAAA;AACvD,OAAO,KAAkD,MAAM,OAAO,CAAA;AAItE,UAAU,mBAAmB;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,MAAM,CAAA;IACpB,IAAI,EAAE,IAAI,GAAG;QACX,KAAK,EAAE;YACL,GAAG,EAAE,MAAM,CAAA;YACX,MAAM,EAAE,MAAM,CAAA;YACd,OAAO,EAAE,MAAM,CAAA;YACf,WAAW,CAAC,EAAE,MAAM,CAAA;SACrB,CAAA;KACF,CAAA;IACD,gBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,CAAA;CAC1D;AAED,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,IAAI,EAAE,CAAA;CACd,CAAA;AAED,MAAM,MAAM,IAAI,GAAG;IACjB,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,eAAO,MAAM,cAAc,UAAW,mBAAmB,sBA8CxD,CAAA;AAED,eAAe,cAAc,CAAA"}
1
+ {"version":3,"file":"VideoBlockView.d.ts","sourceRoot":"","sources":["../../../../../../../src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACtC,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,UAAU,mBAAmB;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,MAAM,CAAA;IACpB,IAAI,EAAE,IAAI,GAAG;QACX,KAAK,EAAE;YACL,GAAG,EAAE,MAAM,CAAA;YACX,MAAM,EAAE,MAAM,CAAA;YACd,OAAO,EAAE,MAAM,CAAA;YACf,WAAW,CAAC,EAAE,MAAM,CAAA;SACrB,CAAA;KACF,CAAA;IACD,gBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,CAAA;CAC1D;AAED,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,IAAI,EAAE,CAAA;CACd,CAAA;AAED,MAAM,MAAM,IAAI,GAAG;IACjB,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,eAAO,MAAM,cAAc,UAAW,mBAAmB,sBAKxD,CAAA;AAED,eAAe,cAAc,CAAA"}
@@ -1,48 +1,15 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { NodeViewWrapper } from '@tiptap/react';
3
- import React, { useCallback, useMemo, useRef } from 'react';
4
- import { cn } from '../../../lib/utils/index.js';
5
- import VideoPlayer from './videojs/VideoPlayer.js';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import NewVideoBlockView from './VideoBlockV2.js';
4
+ import VideoBlockViewV1 from './VideoBlockV1.js';
6
5
  export const VideoBlockView = (props)=>{
7
- const { editor, getPos, node } = props;
8
- const videoWrapperRef = useRef(null);
9
- const { src, optimizedImageUrl, playlistUrl, caption, title } = node.attrs;
10
- const [error, setError] = React.useState('');
11
- const wrapperClassName = cn(node.attrs.align === 'left' ? 'ml-0' : 'ml-auto', node.attrs.align === 'right' ? 'mr-0' : 'mr-auto', node.attrs.align === 'center' && 'mx-auto');
12
- const onClick = useCallback(()=>{
13
- editor.commands.setNodeSelection(getPos());
14
- }, [
15
- getPos,
16
- editor.commands
17
- ]);
18
- const videoJsOptions = useMemo(()=>{
19
- return {
20
- sources: playlistUrl,
21
- poster: optimizedImageUrl
22
- };
23
- }, []);
24
- return /*#__PURE__*/ _jsx(NodeViewWrapper, {
25
- children: /*#__PURE__*/ _jsx("div", {
26
- className: wrapperClassName,
27
- style: {
28
- width: node.attrs.width
29
- },
30
- children: /*#__PURE__*/ _jsxs("div", {
31
- ref: videoWrapperRef,
32
- children: [
33
- error && /*#__PURE__*/ _jsx("div", {
34
- children: error
35
- }),
36
- playlistUrl && /*#__PURE__*/ _jsx(VideoPlayer, {
37
- options: videoJsOptions
38
- }),
39
- caption && /*#__PURE__*/ _jsx("caption", {
40
- className: "text-center block text-sm text-gray-500",
41
- children: title || caption
42
- })
43
- ]
44
- })
45
- })
6
+ if (props.node.attrs.playlistUrl.includes('.json')) {
7
+ return /*#__PURE__*/ _jsx(VideoBlockViewV1, {
8
+ ...props
9
+ });
10
+ }
11
+ return /*#__PURE__*/ _jsx(NewVideoBlockView, {
12
+ ...props
46
13
  });
47
14
  };
48
15
  export default VideoBlockView;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockView.tsx"],"sourcesContent":["import { Node } from '@tiptap/pm/model'\nimport { Editor, NodeViewWrapper } from '@tiptap/react'\nimport React, { useCallback, useEffect, useMemo, useRef } from 'react'\nimport { cn } from '../../../lib/utils/index.js'\nimport VideoPlayer from './videojs/VideoPlayer.js'\n\ninterface VideoBlockViewProps {\n editor: Editor\n getPos: () => number\n node: Node & {\n attrs: {\n src: string\n poster: string\n assetId: string\n playlistUrl?: string\n }\n }\n updateAttributes: (attrs: Record<string, string>) => void\n}\n\nexport type Playlist = {\n id: string\n title: string\n description: string\n poster: string\n items: Item[]\n}\n\nexport type Item = {\n src: string\n type: string\n label: string\n width: number\n height: number\n}\n\nexport const VideoBlockView = (props: VideoBlockViewProps) => {\n const { editor, getPos, node } = props\n const videoWrapperRef = useRef<HTMLDivElement>(null)\n const { src, optimizedImageUrl, playlistUrl, caption, title } = node.attrs\n\n const [error, setError] = React.useState('')\n\n const wrapperClassName = cn(\n node.attrs.align === 'left' ? 'ml-0' : 'ml-auto',\n node.attrs.align === 'right' ? 'mr-0' : 'mr-auto',\n node.attrs.align === 'center' && 'mx-auto',\n )\n\n const onClick = useCallback(() => {\n editor.commands.setNodeSelection(getPos())\n }, [getPos, editor.commands])\n\n const videoJsOptions = useMemo(() => {\n return {\n sources: playlistUrl,\n poster: optimizedImageUrl,\n }\n }, [])\n return (\n <NodeViewWrapper>\n <div className={wrapperClassName} style={{ width: node.attrs.width }}>\n <div ref={videoWrapperRef}>\n {error && <div>{error}</div>}\n {/* <video\n controls\n className=\"block\"\n src={src}\n poster={poster}\n title=\"\"\n onClick={onClick}\n /> */}\n {playlistUrl && <VideoPlayer options={videoJsOptions} />}\n {caption && (\n <caption className=\"text-center block text-sm text-gray-500\">\n {title || caption}\n </caption>\n )}\n </div>\n </div>\n </NodeViewWrapper>\n )\n}\n\nexport default VideoBlockView\n"],"names":["NodeViewWrapper","React","useCallback","useMemo","useRef","cn","VideoPlayer","VideoBlockView","props","editor","getPos","node","videoWrapperRef","src","optimizedImageUrl","playlistUrl","caption","title","attrs","error","setError","useState","wrapperClassName","align","onClick","commands","setNodeSelection","videoJsOptions","sources","poster","div","className","style","width","ref","options"],"mappings":";AACA,SAAiBA,eAAe,QAAQ,gBAAe;AACvD,OAAOC,SAASC,WAAW,EAAaC,OAAO,EAAEC,MAAM,QAAQ,QAAO;AACtE,SAASC,EAAE,QAAQ,8BAA6B;AAChD,OAAOC,iBAAiB,2BAA0B;AAgClD,OAAO,MAAMC,iBAAiB,CAACC;IAC7B,MAAM,EAAEC,MAAM,EAAEC,MAAM,EAAEC,IAAI,EAAE,GAAGH;IACjC,MAAMI,kBAAkBR,OAAuB;IAC/C,MAAM,EAAES,GAAG,EAAEC,iBAAiB,EAAEC,WAAW,EAAEC,OAAO,EAAEC,KAAK,EAAE,GAAGN,KAAKO,KAAK;IAE1E,MAAM,CAACC,OAAOC,SAAS,GAAGnB,MAAMoB,QAAQ,CAAC;IAEzC,MAAMC,mBAAmBjB,GACvBM,KAAKO,KAAK,CAACK,KAAK,KAAK,SAAS,SAAS,WACvCZ,KAAKO,KAAK,CAACK,KAAK,KAAK,UAAU,SAAS,WACxCZ,KAAKO,KAAK,CAACK,KAAK,KAAK,YAAY;IAGnC,MAAMC,UAAUtB,YAAY;QAC1BO,OAAOgB,QAAQ,CAACC,gBAAgB,CAAChB;IACnC,GAAG;QAACA;QAAQD,OAAOgB,QAAQ;KAAC;IAE5B,MAAME,iBAAiBxB,QAAQ;QAC7B,OAAO;YACLyB,SAASb;YACTc,QAAQf;QACV;IACF,GAAG,EAAE;IACL,qBACE,KAACd;kBACC,cAAA,KAAC8B;YAAIC,WAAWT;YAAkBU,OAAO;gBAAEC,OAAOtB,KAAKO,KAAK,CAACe,KAAK;YAAC;sBACjE,cAAA,MAACH;gBAAII,KAAKtB;;oBACPO,uBAAS,KAACW;kCAAKX;;oBASfJ,6BAAe,KAACT;wBAAY6B,SAASR;;oBACrCX,yBACC,KAACA;wBAAQe,WAAU;kCAChBd,SAASD;;;;;;AAOxB,EAAC;AAED,eAAeT,eAAc"}
1
+ {"version":3,"sources":["../../../../../../../src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockView.tsx"],"sourcesContent":["import { Node } from '@tiptap/pm/model'\nimport { Editor } from '@tiptap/react'\nimport React from 'react'\nimport NewVideoBlockView from './VideoBlockV2.js'\nimport VideoBlockViewV1 from './VideoBlockV1.js'\n\ninterface VideoBlockViewProps {\n editor: Editor\n getPos: () => number\n node: Node & {\n attrs: {\n src: string\n poster: string\n assetId: string\n playlistUrl?: string\n }\n }\n updateAttributes: (attrs: Record<string, string>) => void\n}\n\nexport type Playlist = {\n id: string\n title: string\n description: string\n poster: string\n items: Item[]\n}\n\nexport type Item = {\n src: string\n type: string\n label: string\n width: number\n height: number\n}\n\nexport const VideoBlockView = (props: VideoBlockViewProps) => {\n if (props.node.attrs.playlistUrl.includes('.json')) {\n return <VideoBlockViewV1 {...props}/>\n }\n return <NewVideoBlockView {...props}/>\n}\n\nexport default VideoBlockView\n"],"names":["React","NewVideoBlockView","VideoBlockViewV1","VideoBlockView","props","node","attrs","playlistUrl","includes"],"mappings":";AAEA,OAAOA,WAAW,QAAO;AACzB,OAAOC,uBAAuB,oBAAmB;AACjD,OAAOC,sBAAsB,oBAAmB;AAgChD,OAAO,MAAMC,iBAAiB,CAACC;IAC7B,IAAIA,MAAMC,IAAI,CAACC,KAAK,CAACC,WAAW,CAACC,QAAQ,CAAC,UAAU;QAClD,qBAAO,KAACN;YAAkB,GAAGE,KAAK;;IACpC;IACA,qBAAO,KAACH;QAAmB,GAAGG,KAAK;;AACrC,EAAC;AAED,eAAeD,eAAc"}
@@ -26,6 +26,6 @@ export type Item = {
26
26
  width: number;
27
27
  height: number;
28
28
  };
29
- export declare const VideoBlockViewClientside: ({ className, getVideoAspect, ...props }: VideoBlockViewProps) => React.JSX.Element;
29
+ export declare const VideoBlockViewClientside: (props: VideoBlockViewProps) => React.JSX.Element;
30
30
  export default VideoBlockViewClientside;
31
31
  //# sourceMappingURL=VideoBlockViewClientside.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"VideoBlockViewClientside.d.ts","sourceRoot":"","sources":["../../../../../../../src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockViewClientside.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,OAAO,KAAqC,MAAM,OAAO,CAAC;AAK1D,UAAU,mBAAmB;IAC3B,IAAI,EAAE,IAAI,GAAG;QACX,KAAK,EAAE;YACL,GAAG,EAAE,MAAM,CAAC;YACZ,MAAM,EAAE,MAAM,CAAC;YACf,OAAO,EAAE,MAAM,CAAC;YAChB,WAAW,CAAC,EAAE,MAAM,CAAC;SACtB,CAAC;KACH,CAAC;IACF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;CAC7B;AAED,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,IAAI,EAAE,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,IAAI,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,wBAAwB,4CAIlC,mBAAmB,sBAmIrB,CAAC;AAEF,eAAe,wBAAwB,CAAC"}
1
+ {"version":3,"file":"VideoBlockViewClientside.d.ts","sourceRoot":"","sources":["../../../../../../../src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockViewClientside.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,UAAU,mBAAmB;IAC3B,IAAI,EAAE,IAAI,GAAG;QACX,KAAK,EAAE;YACL,GAAG,EAAE,MAAM,CAAC;YACZ,MAAM,EAAE,MAAM,CAAC;YACf,OAAO,EAAE,MAAM,CAAC;YAChB,WAAW,CAAC,EAAE,MAAM,CAAC;SACtB,CAAC;KACH,CAAC;IACF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;CAC7B;AAED,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,IAAI,EAAE,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,IAAI,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,wBAAwB,UAAW,mBAAmB,sBAKlE,CAAC;AAEF,eAAe,wBAAwB,CAAC"}
@@ -1,118 +1,15 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { NodeViewWrapper } from "@tiptap/react";
3
- import React, { useEffect, useMemo, useRef } from "react";
4
- import { cn } from "../../../lib/utils/index.js";
5
- import VideoPlayer from "./videojs/VideoPlayer.js";
6
- import { useGetAssetsAspectRatio } from "../../serverside/getAssetsAspectRatio.js";
7
- export const VideoBlockViewClientside = ({ className, getVideoAspect, ...props })=>{
8
- const { node } = props;
9
- const videoWrapperRef = useRef(null);
10
- const { src, poster, playlistUrl, caption, actualWidth, actualHeight } = node.attrs;
11
- const { aspectRatio, calculateAspectRatio, isVertical } = useGetAssetsAspectRatio();
12
- const [playlistContent, setPlaylistContent] = React.useState();
13
- const [error, setError] = React.useState();
14
- useEffect(()=>{
15
- async function getPlaylistContent() {
16
- const res = await fetch(playlistUrl, {
17
- cache: "no-cache"
18
- });
19
- return await res.json();
20
- }
21
- if (playlistUrl) {
22
- try {
23
- getPlaylistContent().then((data)=>{
24
- setPlaylistContent(data);
25
- }).catch((err)=>{
26
- setError(err);
27
- });
28
- } catch (error) {
29
- setError(error);
30
- }
31
- }
32
- }, [
33
- playlistUrl
34
- ]);
35
- const wrapperClassName = cn(node.attrs.align === "left" ? "ml-0" : "ml-auto", node.attrs.align === "right" ? "mr-0" : "mr-auto", node.attrs.align === "center" && "mx-auto");
36
- const videoJsOptions = useMemo(()=>{
37
- if (playlistContent == undefined) return {};
38
- if (playlistContent.items.some((item)=>item.type === "application/x-mpegURL" || item.type === "application/vnd.apple.mpegurl")) {
39
- return {
40
- sources: playlistContent.items.filter((item)=>item.type === "application/x-mpegURL" || item.type === "application/vnd.apple.mpegurl").map((item)=>({
41
- src: item.src,
42
- type: item.type,
43
- label: item.label
44
- })),
45
- poster: playlistContent.poster,
46
- preload: "auto"
47
- };
48
- }
49
- return {
50
- sources: playlistContent.items.map((item)=>({
51
- src: item.src,
52
- type: item.type,
53
- label: item.label
54
- })),
55
- poster: playlistContent.poster,
56
- preload: "auto"
57
- };
58
- }, [
59
- playlistContent
60
- ]);
61
- useEffect(()=>{
62
- if (!playlistContent?.items?.length) {
63
- return;
64
- }
65
- const source = playlistContent.items.find((item)=>item.src);
66
- if (!aspectRatio && source?.src) {
67
- calculateAspectRatio({
68
- src: source.src,
69
- actualWidth: actualWidth || source?.width,
70
- actualHeight: actualHeight || source?.height
71
- }, "VIDEO", getVideoAspect);
72
- }
73
- }, [
74
- playlistContent
75
- ]);
76
- const style = useMemo(()=>{
77
- if (aspectRatio) {
78
- return {
79
- aspectRatio,
80
- width: node.attrs.width
81
- };
82
- }
83
- return {
84
- width: node.attrs.width
85
- };
86
- }, [
87
- aspectRatio
88
- ]);
89
- return /*#__PURE__*/ _jsxs(NodeViewWrapper, {
90
- className: className,
91
- children: [
92
- /*#__PURE__*/ _jsxs("div", {
93
- className: cn(wrapperClassName, "main-videojs-wrapper aspect-square h-full"),
94
- ...isVertical && {
95
- "data-vertical": isVertical
96
- },
97
- ref: videoWrapperRef,
98
- style: style,
99
- children: [
100
- error && /*#__PURE__*/ _jsx("div", {
101
- children: error
102
- }),
103
- playlistContent && /*#__PURE__*/ _jsx(VideoPlayer, {
104
- options: videoJsOptions
105
- })
106
- ]
107
- }),
108
- caption && playlistContent?.title && /*#__PURE__*/ _jsx("div", {
109
- className: "block mx-auto text-sm text-gray-500 text-center mt-1",
110
- style: {
111
- width: node.attrs.width
112
- },
113
- children: playlistContent?.title
114
- })
115
- ]
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from "react";
3
+ import VideoBlockViewClientsideV1 from "./VideoBlockViewClientsideV1.js";
4
+ import VideoBlockViewClientsideV2 from "./VideoBlockViewClientsideV2.js";
5
+ export const VideoBlockViewClientside = (props)=>{
6
+ if (props.node.attrs.playlistUrl.includes('.json')) {
7
+ return /*#__PURE__*/ _jsx(VideoBlockViewClientsideV1, {
8
+ ...props
9
+ });
10
+ }
11
+ return /*#__PURE__*/ _jsx(VideoBlockViewClientsideV2, {
12
+ ...props
116
13
  });
117
14
  };
118
15
  export default VideoBlockViewClientside;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockViewClientside.tsx"],"sourcesContent":["import { Node } from \"@tiptap/pm/model\";\nimport { NodeViewWrapper } from \"@tiptap/react\";\nimport React, { useEffect, useMemo, useRef } from \"react\";\nimport { cn } from \"../../../lib/utils/index.js\";\nimport VideoPlayer from \"./videojs/VideoPlayer.js\";\nimport { useGetAssetsAspectRatio } from \"../../serverside/getAssetsAspectRatio.js\";\n\ninterface VideoBlockViewProps {\n node: Node & {\n attrs: {\n src: string;\n poster: string;\n assetId: string;\n playlistUrl?: string;\n };\n };\n className?: string;\n getVideoAspect?: () => void;\n}\n\nexport type Playlist = {\n id: string;\n title: string;\n description: string;\n poster: string;\n items: Item[];\n};\n\nexport type Item = {\n src: string;\n type: string;\n label: string;\n width: number;\n height: number;\n};\n\nexport const VideoBlockViewClientside = ({\n className,\n getVideoAspect,\n ...props\n}: VideoBlockViewProps) => {\n const { node } = props;\n const videoWrapperRef = useRef<HTMLDivElement>(null);\n const { src, poster, playlistUrl, caption, actualWidth, actualHeight } =\n node.attrs;\n const { aspectRatio, calculateAspectRatio, isVertical } =\n useGetAssetsAspectRatio();\n const [playlistContent, setPlaylistContent] = React.useState<\n Playlist | undefined\n >();\n const [error, setError] = React.useState();\n\n useEffect(() => {\n async function getPlaylistContent() {\n const res = await fetch(playlistUrl, {\n cache: \"no-cache\",\n });\n return await res.json();\n }\n\n if (playlistUrl) {\n try {\n getPlaylistContent()\n .then((data) => {\n setPlaylistContent(data);\n })\n .catch((err) => {\n setError(err);\n });\n } catch (error) {\n setError(error);\n }\n }\n }, [playlistUrl]);\n\n const wrapperClassName = cn(\n node.attrs.align === \"left\" ? \"ml-0\" : \"ml-auto\",\n node.attrs.align === \"right\" ? \"mr-0\" : \"mr-auto\",\n node.attrs.align === \"center\" && \"mx-auto\"\n );\n\n const videoJsOptions = useMemo(() => {\n if (playlistContent == undefined) return {};\n\n if (\n playlistContent.items.some(\n (item) =>\n item.type === \"application/x-mpegURL\" ||\n item.type === \"application/vnd.apple.mpegurl\"\n )\n ) {\n return {\n sources: playlistContent.items\n .filter(\n (item) =>\n item.type === \"application/x-mpegURL\" ||\n item.type === \"application/vnd.apple.mpegurl\"\n )\n .map((item) => ({\n src: item.src,\n type: item.type,\n label: item.label,\n })),\n poster: playlistContent.poster,\n preload: \"auto\",\n };\n }\n return {\n sources: playlistContent.items.map((item) => ({\n src: item.src,\n type: item.type,\n label: item.label,\n })),\n poster: playlistContent.poster,\n preload: \"auto\",\n };\n }, [playlistContent]);\n\n useEffect(() => {\n if (!playlistContent?.items?.length) {\n return;\n }\n const source = playlistContent.items.find((item) => item.src);\n if (!aspectRatio && source?.src) {\n calculateAspectRatio(\n {\n src: source.src,\n actualWidth: actualWidth || source?.width,\n actualHeight: actualHeight || source?.height,\n },\n \"VIDEO\",\n getVideoAspect\n );\n }\n }, [playlistContent]);\n const style = useMemo(() => {\n if (aspectRatio) {\n return {\n aspectRatio,\n width: node.attrs.width,\n };\n }\n return {\n width: node.attrs.width,\n };\n }, [aspectRatio]);\n return (\n <NodeViewWrapper className={className}>\n <div\n className={cn(\n wrapperClassName,\n \"main-videojs-wrapper aspect-square h-full\"\n )}\n {...(isVertical && { \"data-vertical\": isVertical })}\n ref={videoWrapperRef}\n style={style}\n >\n {error && <div>{error}</div>}\n\n {playlistContent && <VideoPlayer options={videoJsOptions} />}\n </div>\n {caption && playlistContent?.title && (\n <div\n className=\"block mx-auto text-sm text-gray-500 text-center mt-1\"\n style={{ width: node.attrs.width }}\n >\n {playlistContent?.title}\n </div>\n )}\n </NodeViewWrapper>\n );\n};\n\nexport default VideoBlockViewClientside;\n"],"names":["NodeViewWrapper","React","useEffect","useMemo","useRef","cn","VideoPlayer","useGetAssetsAspectRatio","VideoBlockViewClientside","className","getVideoAspect","props","node","videoWrapperRef","src","poster","playlistUrl","caption","actualWidth","actualHeight","attrs","aspectRatio","calculateAspectRatio","isVertical","playlistContent","setPlaylistContent","useState","error","setError","getPlaylistContent","res","fetch","cache","json","then","data","catch","err","wrapperClassName","align","videoJsOptions","undefined","items","some","item","type","sources","filter","map","label","preload","length","source","find","width","height","style","div","ref","options","title"],"mappings":"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"}
1
+ {"version":3,"sources":["../../../../../../../src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockViewClientside.tsx"],"sourcesContent":["import { Node } from \"@tiptap/pm/model\";\nimport React from \"react\";\nimport VideoBlockViewClientsideV1 from \"./VideoBlockViewClientsideV1.js\";\nimport VideoBlockViewClientsideV2 from \"./VideoBlockViewClientsideV2.js\";\n\ninterface VideoBlockViewProps {\n node: Node & {\n attrs: {\n src: string;\n poster: string;\n assetId: string;\n playlistUrl?: string;\n };\n };\n className?: string;\n getVideoAspect?: () => void;\n}\n\nexport type Playlist = {\n id: string;\n title: string;\n description: string;\n poster: string;\n items: Item[];\n};\n\nexport type Item = {\n src: string;\n type: string;\n label: string;\n width: number;\n height: number;\n};\n\nexport const VideoBlockViewClientside = (props: VideoBlockViewProps) => {\n if (props.node.attrs.playlistUrl.includes('.json')) {\n return <VideoBlockViewClientsideV1 {...props}/>\n }\n return <VideoBlockViewClientsideV2 {...props}/>\n};\n\nexport default VideoBlockViewClientside;\n"],"names":["React","VideoBlockViewClientsideV1","VideoBlockViewClientsideV2","VideoBlockViewClientside","props","node","attrs","playlistUrl","includes"],"mappings":";AACA,OAAOA,WAAW,QAAQ;AAC1B,OAAOC,gCAAgC,kCAAkC;AACzE,OAAOC,gCAAgC,kCAAkC;AA+BzE,OAAO,MAAMC,2BAA2B,CAACC;IACvC,IAAIA,MAAMC,IAAI,CAACC,KAAK,CAACC,WAAW,CAACC,QAAQ,CAAC,UAAU;QACjD,qBAAO,KAACP;YAA4B,GAAGG,KAAK;;IAC9C;IACA,qBAAO,KAACF;QAA4B,GAAGE,KAAK;;AAC/C,EAAE;AAEF,eAAeD,yBAAyB"}
@@ -0,0 +1,31 @@
1
+ import { Node } from "@tiptap/pm/model";
2
+ import React from "react";
3
+ interface VideoBlockViewProps {
4
+ node: Node & {
5
+ attrs: {
6
+ src: string;
7
+ poster: string;
8
+ assetId: string;
9
+ playlistUrl?: string;
10
+ };
11
+ };
12
+ className?: string;
13
+ getVideoAspect?: () => void;
14
+ }
15
+ export type Playlist = {
16
+ id: string;
17
+ title: string;
18
+ description: string;
19
+ poster: string;
20
+ items: Item[];
21
+ };
22
+ export type Item = {
23
+ src: string;
24
+ type: string;
25
+ label: string;
26
+ width: number;
27
+ height: number;
28
+ };
29
+ export declare const VideoBlockViewClientsideV1: ({ className, getVideoAspect, ...props }: VideoBlockViewProps) => React.JSX.Element;
30
+ export default VideoBlockViewClientsideV1;
31
+ //# sourceMappingURL=VideoBlockViewClientsideV1.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VideoBlockViewClientsideV1.d.ts","sourceRoot":"","sources":["../../../../../../../src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockViewClientsideV1.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,OAAO,KAAqC,MAAM,OAAO,CAAC;AAK1D,UAAU,mBAAmB;IAC3B,IAAI,EAAE,IAAI,GAAG;QACX,KAAK,EAAE;YACL,GAAG,EAAE,MAAM,CAAC;YACZ,MAAM,EAAE,MAAM,CAAC;YACf,OAAO,EAAE,MAAM,CAAC;YAChB,WAAW,CAAC,EAAE,MAAM,CAAC;SACtB,CAAC;KACH,CAAC;IACF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;CAC7B;AAED,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,IAAI,EAAE,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,IAAI,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,0BAA0B,4CAIpC,mBAAmB,sBAmIrB,CAAC;AAEF,eAAe,0BAA0B,CAAC"}