payload-richtext-tiptap 0.0.135 → 0.0.137

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 (49) hide show
  1. package/dist/src/body/ArticleBody.d.ts +2 -1
  2. package/dist/src/body/ArticleBody.d.ts.map +1 -1
  3. package/dist/src/body/ArticleBody.js +12 -11
  4. package/dist/src/body/ArticleBody.js.map +1 -1
  5. package/dist/src/fields/TiptapEditor/extensions/ImageBlock/components/ImageBlockViewClientside.d.ts +4 -0
  6. package/dist/src/fields/TiptapEditor/extensions/ImageBlock/components/ImageBlockViewClientside.d.ts.map +1 -0
  7. package/dist/src/fields/TiptapEditor/extensions/ImageBlock/components/ImageBlockViewClientside.js +28 -0
  8. package/dist/src/fields/TiptapEditor/extensions/ImageBlock/components/ImageBlockViewClientside.js.map +1 -0
  9. package/dist/src/fields/TiptapEditor/extensions/ImageUpload/getImageActualSize.d.ts.map +1 -1
  10. package/dist/src/fields/TiptapEditor/extensions/ImageUpload/getImageActualSize.js +4 -0
  11. package/dist/src/fields/TiptapEditor/extensions/ImageUpload/getImageActualSize.js.map +1 -1
  12. package/dist/src/fields/TiptapEditor/extensions/LinkPreview/menus/linkPreviewMenu.d.ts.map +1 -1
  13. package/dist/src/fields/TiptapEditor/extensions/LinkPreview/menus/linkPreviewMenu.js +0 -1
  14. package/dist/src/fields/TiptapEditor/extensions/LinkPreview/menus/linkPreviewMenu.js.map +1 -1
  15. package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockView.d.ts.map +1 -1
  16. package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockView.js +10 -5
  17. package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockView.js.map +1 -1
  18. package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockViewClientside.d.ts +2 -5
  19. package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockViewClientside.d.ts.map +1 -1
  20. package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockViewClientside.js +48 -16
  21. package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockViewClientside.js.map +1 -1
  22. package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/VideoPlayer.d.ts +4 -2
  23. package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/VideoPlayer.d.ts.map +1 -1
  24. package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/VideoPlayer.js +3 -2
  25. package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/VideoPlayer.js.map +1 -1
  26. package/dist/src/fields/TiptapEditor/extensions/serverside/EmbedContentInlineRenderer.d.ts +2 -1
  27. package/dist/src/fields/TiptapEditor/extensions/serverside/EmbedContentInlineRenderer.d.ts.map +1 -1
  28. package/dist/src/fields/TiptapEditor/extensions/serverside/EmbedContentInlineRenderer.js +5 -4
  29. package/dist/src/fields/TiptapEditor/extensions/serverside/EmbedContentInlineRenderer.js.map +1 -1
  30. package/dist/src/fields/TiptapEditor/extensions/serverside/EmbedContentSideRenderer.d.ts +2 -1
  31. package/dist/src/fields/TiptapEditor/extensions/serverside/EmbedContentSideRenderer.d.ts.map +1 -1
  32. package/dist/src/fields/TiptapEditor/extensions/serverside/EmbedContentSideRenderer.js +5 -4
  33. package/dist/src/fields/TiptapEditor/extensions/serverside/EmbedContentSideRenderer.js.map +1 -1
  34. package/dist/src/fields/TiptapEditor/extensions/serverside/EmbedContentSidebarRenderer.d.ts +2 -1
  35. package/dist/src/fields/TiptapEditor/extensions/serverside/EmbedContentSidebarRenderer.d.ts.map +1 -1
  36. package/dist/src/fields/TiptapEditor/extensions/serverside/EmbedContentSidebarRenderer.js +2 -3
  37. package/dist/src/fields/TiptapEditor/extensions/serverside/EmbedContentSidebarRenderer.js.map +1 -1
  38. package/dist/src/fields/TiptapEditor/extensions/serverside/RenderEmbedClientSide.d.ts +1 -1
  39. package/dist/src/fields/TiptapEditor/extensions/serverside/RenderEmbedClientSide.d.ts.map +1 -1
  40. package/dist/src/fields/TiptapEditor/extensions/serverside/RenderEmbedClientSide.js +7 -29
  41. package/dist/src/fields/TiptapEditor/extensions/serverside/RenderEmbedClientSide.js.map +1 -1
  42. package/dist/src/fields/TiptapEditor/extensions/serverside/getAssetsAspectRatio.d.ts +5 -0
  43. package/dist/src/fields/TiptapEditor/extensions/serverside/getAssetsAspectRatio.d.ts.map +1 -0
  44. package/dist/src/fields/TiptapEditor/extensions/serverside/getAssetsAspectRatio.js +31 -0
  45. package/dist/src/fields/TiptapEditor/extensions/serverside/getAssetsAspectRatio.js.map +1 -0
  46. package/dist/src/mobile.css +1 -1
  47. package/dist/src/styles.css +1 -1
  48. package/dist/tsconfig.tsbuildinfo +1 -1
  49. package/package.json +1 -1
@@ -2,7 +2,8 @@ type Props = {
2
2
  body: any;
3
3
  wrapperClassName?: string;
4
4
  articleClassName?: string;
5
+ getVideoAspect?: () => void;
5
6
  };
6
- export declare const ArticleBody: import("react").MemoExoticComponent<({ body, wrapperClassName, articleClassName }: Props) => import("react").JSX.Element>;
7
+ export declare const ArticleBody: import("react").MemoExoticComponent<({ body, wrapperClassName, articleClassName, getVideoAspect, }: Props) => import("react").JSX.Element>;
7
8
  export {};
8
9
  //# sourceMappingURL=ArticleBody.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ArticleBody.d.ts","sourceRoot":"","sources":["../../../src/body/ArticleBody.tsx"],"names":[],"mappings":"AAaA,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,GAAG,CAAC;IACV,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AACF,eAAO,MAAM,WAAW,qFACyB,KAAK,iCA2BrD,CAAC"}
1
+ {"version":3,"file":"ArticleBody.d.ts","sourceRoot":"","sources":["../../../src/body/ArticleBody.tsx"],"names":[],"mappings":"AAYA,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,GAAG,CAAC;IACV,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;CAC7B,CAAC;AACF,eAAO,MAAM,WAAW,sGAMnB,KAAK,iCA6BT,CAAC"}
@@ -1,31 +1,32 @@
1
- 'use client';
1
+ "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { memo } from 'react';
3
+ import { memo } from "react";
4
4
  // import './article-custom.scss';
5
- import { appendRequiredBlocksMarkerClient } from '../fields/TiptapEditor/extensions/serverside/useAppendRequiredBlocksMarkerClient.js';
6
- import { ServersideTiptapBody } from '../fields/TiptapEditor/extensions/serverside/ServersideTiptapBody.js';
7
- import { EmbedContentInlineRenderer } from '../fields/TiptapEditor/extensions/serverside/EmbedContentInlineRenderer.js';
8
- import { cn } from '../fields/TiptapEditor/lib/utils/index.js';
9
- const TRT_ARTICLE_BODY_ID = 'TRT-ARTICLE-BODY-ID';
10
- export const ArticleBody = /*#__PURE__*/ memo(({ body, wrapperClassName, articleClassName })=>{
5
+ import { appendRequiredBlocksMarkerClient } from "../fields/TiptapEditor/extensions/serverside/useAppendRequiredBlocksMarkerClient.js";
6
+ import { ServersideTiptapBody } from "../fields/TiptapEditor/extensions/serverside/ServersideTiptapBody.js";
7
+ import { EmbedContentInlineRenderer } from "../fields/TiptapEditor/extensions/serverside/EmbedContentInlineRenderer.js";
8
+ import { cn } from "../fields/TiptapEditor/lib/utils/index.js";
9
+ const TRT_ARTICLE_BODY_ID = "TRT-ARTICLE-BODY-ID";
10
+ export const ArticleBody = /*#__PURE__*/ memo(({ body, wrapperClassName, articleClassName, getVideoAspect })=>{
11
11
  const json = appendRequiredBlocksMarkerClient(body);
12
12
  if (!json) return null;
13
13
  return /*#__PURE__*/ _jsxs("div", {
14
- className: cn('text-grey-12 lg:grid trt-article-body-wrapper trt-article-page-wrapper w-full', wrapperClassName),
14
+ className: cn("text-grey-12 lg:grid trt-article-body-wrapper trt-article-page-wrapper w-full", wrapperClassName),
15
15
  children: [
16
16
  /*#__PURE__*/ _jsx("div", {}),
17
17
  /*#__PURE__*/ _jsx("div", {
18
18
  id: TRT_ARTICLE_BODY_ID,
19
19
  className: "w-full flex flex-col",
20
20
  children: /*#__PURE__*/ _jsx("div", {
21
- className: cn('!selection:text-purple-900 font-notosans lg:text-xl lg:leading-8 md:text-lg md:leading-[30px] text-base', articleClassName),
21
+ className: cn("!selection:text-purple-900 font-notosans lg:text-xl lg:leading-8 md:text-lg md:leading-[30px] text-base", articleClassName),
22
22
  children: /*#__PURE__*/ _jsx(ServersideTiptapBody, {
23
23
  body: json
24
24
  })
25
25
  })
26
26
  }),
27
27
  /*#__PURE__*/ _jsx(EmbedContentInlineRenderer, {
28
- body: json
28
+ body: json,
29
+ getVideoAspect: getVideoAspect
29
30
  })
30
31
  ]
31
32
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/body/ArticleBody.tsx"],"sourcesContent":["'use client'\r\n\r\nimport { memo } from 'react';\r\n// import './article-custom.scss';\r\n\r\n\r\nimport { appendRequiredBlocksMarkerClient } from '../fields/TiptapEditor/extensions/serverside/useAppendRequiredBlocksMarkerClient.js';\r\nimport { ServersideTiptapBody } from '../fields/TiptapEditor/extensions/serverside/ServersideTiptapBody.js';\r\nimport { EmbedContentInlineRenderer } from '../fields/TiptapEditor/extensions/serverside/EmbedContentInlineRenderer.js';\r\nimport { cn } from '../fields/TiptapEditor/lib/utils/index.js';\r\n\r\nconst TRT_ARTICLE_BODY_ID = 'TRT-ARTICLE-BODY-ID';\r\n\r\ntype Props = {\r\n body: any;\r\n wrapperClassName?: string;\r\n articleClassName?: string;\r\n};\r\nexport const ArticleBody = memo(\r\n ({ body, wrapperClassName, articleClassName }: Props) => {\r\n const json = appendRequiredBlocksMarkerClient(body);\r\n if (!json) return null;\r\n return (\r\n <div\r\n className={cn(\r\n 'text-grey-12 lg:grid trt-article-body-wrapper trt-article-page-wrapper w-full',\r\n wrapperClassName,\r\n )}\r\n >\r\n <div />\r\n <div id={TRT_ARTICLE_BODY_ID} className=\"w-full flex flex-col\">\r\n\r\n <div\r\n className={cn(\r\n '!selection:text-purple-900 font-notosans lg:text-xl lg:leading-8 md:text-lg md:leading-[30px] text-base',\r\n articleClassName,\r\n )}\r\n >\r\n <ServersideTiptapBody body={json} />\r\n </div>\r\n </div>\r\n <EmbedContentInlineRenderer body={json} />\r\n </div>\r\n );\r\n },\r\n (prev, next) => prev.body?.content?.length === next.body?.content?.length,\r\n);\r\n"],"names":["memo","appendRequiredBlocksMarkerClient","ServersideTiptapBody","EmbedContentInlineRenderer","cn","TRT_ARTICLE_BODY_ID","ArticleBody","body","wrapperClassName","articleClassName","json","div","className","id","prev","next","content","length"],"mappings":"AAAA;;AAEA,SAASA,IAAI,QAAQ,QAAQ;AAC7B,kCAAkC;AAGlC,SAASC,gCAAgC,QAAQ,sFAAsF;AACvI,SAASC,oBAAoB,QAAQ,uEAAuE;AAC5G,SAASC,0BAA0B,QAAQ,6EAA6E;AACxH,SAASC,EAAE,QAAQ,4CAA4C;AAE/D,MAAMC,sBAAsB;AAO5B,OAAO,MAAMC,4BAAcN,KACzB,CAAC,EAAEO,IAAI,EAAEC,gBAAgB,EAAEC,gBAAgB,EAAS;IAClD,MAAMC,OAAOT,iCAAiCM;IAC9C,IAAI,CAACG,MAAM,OAAO;IAClB,qBACE,MAACC;QACCC,WAAWR,GACT,iFACAI;;0BAGF,KAACG;0BACD,KAACA;gBAAIE,IAAIR;gBAAqBO,WAAU;0BAEtC,cAAA,KAACD;oBACCC,WAAWR,GACT,2GACAK;8BAGF,cAAA,KAACP;wBAAqBK,MAAMG;;;;0BAGhC,KAACP;gBAA2BI,MAAMG;;;;AAGxC,GACA,CAACI,MAAMC,OAASD,KAAKP,IAAI,EAAES,SAASC,WAAWF,KAAKR,IAAI,EAAES,SAASC,QACnE"}
1
+ {"version":3,"sources":["../../../src/body/ArticleBody.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport { memo } from \"react\";\r\n// import './article-custom.scss';\r\n\r\nimport { appendRequiredBlocksMarkerClient } from \"../fields/TiptapEditor/extensions/serverside/useAppendRequiredBlocksMarkerClient.js\";\r\nimport { ServersideTiptapBody } from \"../fields/TiptapEditor/extensions/serverside/ServersideTiptapBody.js\";\r\nimport { EmbedContentInlineRenderer } from \"../fields/TiptapEditor/extensions/serverside/EmbedContentInlineRenderer.js\";\r\nimport { cn } from \"../fields/TiptapEditor/lib/utils/index.js\";\r\n\r\nconst TRT_ARTICLE_BODY_ID = \"TRT-ARTICLE-BODY-ID\";\r\n\r\ntype Props = {\r\n body: any;\r\n wrapperClassName?: string;\r\n articleClassName?: string;\r\n getVideoAspect?: () => void;\r\n};\r\nexport const ArticleBody = memo(\r\n ({\r\n body,\r\n wrapperClassName,\r\n articleClassName,\r\n getVideoAspect,\r\n }: Props) => {\r\n const json = appendRequiredBlocksMarkerClient(body);\r\n if (!json) return null;\r\n return (\r\n <div\r\n className={cn(\r\n \"text-grey-12 lg:grid trt-article-body-wrapper trt-article-page-wrapper w-full\",\r\n wrapperClassName\r\n )}\r\n >\r\n <div />\r\n <div id={TRT_ARTICLE_BODY_ID} className=\"w-full flex flex-col\">\r\n <div\r\n className={cn(\r\n \"!selection:text-purple-900 font-notosans lg:text-xl lg:leading-8 md:text-lg md:leading-[30px] text-base\",\r\n articleClassName\r\n )}\r\n >\r\n <ServersideTiptapBody body={json} />\r\n </div>\r\n </div>\r\n <EmbedContentInlineRenderer\r\n body={json}\r\n getVideoAspect={getVideoAspect}\r\n />\r\n </div>\r\n );\r\n },\r\n (prev, next) => prev.body?.content?.length === next.body?.content?.length\r\n);\r\n"],"names":["memo","appendRequiredBlocksMarkerClient","ServersideTiptapBody","EmbedContentInlineRenderer","cn","TRT_ARTICLE_BODY_ID","ArticleBody","body","wrapperClassName","articleClassName","getVideoAspect","json","div","className","id","prev","next","content","length"],"mappings":"AAAA;;AAEA,SAASA,IAAI,QAAQ,QAAQ;AAC7B,kCAAkC;AAElC,SAASC,gCAAgC,QAAQ,sFAAsF;AACvI,SAASC,oBAAoB,QAAQ,uEAAuE;AAC5G,SAASC,0BAA0B,QAAQ,6EAA6E;AACxH,SAASC,EAAE,QAAQ,4CAA4C;AAE/D,MAAMC,sBAAsB;AAQ5B,OAAO,MAAMC,4BAAcN,KACzB,CAAC,EACCO,IAAI,EACJC,gBAAgB,EAChBC,gBAAgB,EAChBC,cAAc,EACR;IACN,MAAMC,OAAOV,iCAAiCM;IAC9C,IAAI,CAACI,MAAM,OAAO;IAClB,qBACE,MAACC;QACCC,WAAWT,GACT,iFACAI;;0BAGF,KAACI;0BACD,KAACA;gBAAIE,IAAIT;gBAAqBQ,WAAU;0BACtC,cAAA,KAACD;oBACCC,WAAWT,GACT,2GACAK;8BAGF,cAAA,KAACP;wBAAqBK,MAAMI;;;;0BAGhC,KAACR;gBACCI,MAAMI;gBACND,gBAAgBA;;;;AAIxB,GACA,CAACK,MAAMC,OAASD,KAAKR,IAAI,EAAEU,SAASC,WAAWF,KAAKT,IAAI,EAAEU,SAASC,QACnE"}
@@ -0,0 +1,4 @@
1
+ export declare const ImageBlockViewClientside: ({ content }: {
2
+ content: any;
3
+ }) => import("react").JSX.Element;
4
+ //# sourceMappingURL=ImageBlockViewClientside.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ImageBlockViewClientside.d.ts","sourceRoot":"","sources":["../../../../../../../src/fields/TiptapEditor/extensions/ImageBlock/components/ImageBlockViewClientside.tsx"],"names":[],"mappings":"AAKA,eAAO,MAAM,wBAAwB;;iCA+BpC,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { cn } from "../../../lib/utils/index.js";
3
+ import Image from "next/image.js";
4
+ export const ImageBlockViewClientside = ({ content })=>{
5
+ return /*#__PURE__*/ _jsxs(_Fragment, {
6
+ children: [
7
+ /*#__PURE__*/ _jsx("div", {
8
+ className: cn("relative object-cover", {}),
9
+ style: {
10
+ width: content.attrs.width || "100%"
11
+ },
12
+ children: /*#__PURE__*/ _jsx(Image, {
13
+ className: "rounded object-cover",
14
+ src: content.attrs.src,
15
+ alt: content.attrs.alt || content.attrs.caption,
16
+ width: 800,
17
+ height: 600
18
+ })
19
+ }),
20
+ content.attrs?.caption ? /*#__PURE__*/ _jsx("p", {
21
+ className: cn("tiptap-image-caption", "pt-2 font-sf text-sm font-light text-grey-7 mx-6 sm:mx-0 line-clamp-2"),
22
+ children: content.attrs?.caption
23
+ }) : null
24
+ ]
25
+ });
26
+ };
27
+
28
+ //# sourceMappingURL=ImageBlockViewClientside.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../src/fields/TiptapEditor/extensions/ImageBlock/components/ImageBlockViewClientside.tsx"],"sourcesContent":["import { cn } from \"../../../lib/utils/index.js\";\nimport { useGetAssetsAspectRatio } from \"../../serverside/getAssetsAspectRatio.js\";\nimport { useEffect } from \"react\";\nimport Image from \"next/image.js\";\n\nexport const ImageBlockViewClientside = ({ content }) => {\n return (\n <>\n <div\n className={cn(\"relative object-cover\", {\n })}\n style={{\n width: content.attrs.width || \"100%\",\n }}\n >\n {/* @ts-ignore */}\n <Image\n className=\"rounded object-cover\"\n src={content.attrs.src}\n alt={content.attrs.alt || content.attrs.caption}\n width={800}\n height={600}\n />\n </div>\n {content.attrs?.caption ? (\n <p\n className={cn(\n \"tiptap-image-caption\",\n \"pt-2 font-sf text-sm font-light text-grey-7 mx-6 sm:mx-0 line-clamp-2\"\n )}\n >\n {content.attrs?.caption}\n </p>\n ) : null}\n </>\n );\n};\n"],"names":["cn","Image","ImageBlockViewClientside","content","div","className","style","width","attrs","src","alt","caption","height","p"],"mappings":";AAAA,SAASA,EAAE,QAAQ,8BAA8B;AAGjD,OAAOC,WAAW,gBAAgB;AAElC,OAAO,MAAMC,2BAA2B,CAAC,EAAEC,OAAO,EAAE;IAClD,qBACE;;0BACE,KAACC;gBACCC,WAAWL,GAAG,yBAAyB,CACvC;gBACAM,OAAO;oBACLC,OAAOJ,QAAQK,KAAK,CAACD,KAAK,IAAI;gBAChC;0BAGA,cAAA,KAACN;oBACCI,WAAU;oBACVI,KAAKN,QAAQK,KAAK,CAACC,GAAG;oBACtBC,KAAKP,QAAQK,KAAK,CAACE,GAAG,IAAIP,QAAQK,KAAK,CAACG,OAAO;oBAC/CJ,OAAO;oBACPK,QAAQ;;;YAGXT,QAAQK,KAAK,EAAEG,wBACd,KAACE;gBACCR,WAAWL,GACT,wBACA;0BAGDG,QAAQK,KAAK,EAAEG;iBAEhB;;;AAGV,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"file":"getImageActualSize.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/ImageUpload/getImageActualSize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,eAAe;;;EAOxD"}
1
+ {"version":3,"file":"getImageActualSize.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/ImageUpload/getImageActualSize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,eAAe;;;EAQxD"}
@@ -5,6 +5,10 @@ export function getAssetActualSize(asset) {
5
5
  actualHeight: asset.height
6
6
  };
7
7
  }
8
+ return {
9
+ actualWidth: 0,
10
+ actualHeight: 0
11
+ };
8
12
  }
9
13
 
10
14
  //# sourceMappingURL=getImageActualSize.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/ImageUpload/getImageActualSize.ts"],"sourcesContent":["import { AssetReturnType } from \"../../types.js\";\n\nexport function getAssetActualSize(asset: AssetReturnType) {\n if (asset.width && asset.height) {\n return {\n actualWidth: asset.width,\n actualHeight: asset.height,\n };\n }\n}\n"],"names":["getAssetActualSize","asset","width","height","actualWidth","actualHeight"],"mappings":"AAEA,OAAO,SAASA,mBAAmBC,KAAsB;IACvD,IAAIA,MAAMC,KAAK,IAAID,MAAME,MAAM,EAAE;QAC/B,OAAO;YACLC,aAAaH,MAAMC,KAAK;YACxBG,cAAcJ,MAAME,MAAM;QAC5B;IACF;AACF"}
1
+ {"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/ImageUpload/getImageActualSize.ts"],"sourcesContent":["import { AssetReturnType } from \"../../types.js\";\n\nexport function getAssetActualSize(asset: AssetReturnType) {\n if (asset.width && asset.height) {\n return {\n actualWidth: asset.width,\n actualHeight: asset.height,\n };\n }\n return { actualWidth: 0, actualHeight: 0 };\n}\n"],"names":["getAssetActualSize","asset","width","height","actualWidth","actualHeight"],"mappings":"AAEA,OAAO,SAASA,mBAAmBC,KAAsB;IACvD,IAAIA,MAAMC,KAAK,IAAID,MAAME,MAAM,EAAE;QAC/B,OAAO;YACLC,aAAaH,MAAMC,KAAK;YACxBG,cAAcJ,MAAME,MAAM;QAC5B;IACF;IACA,OAAO;QAAEC,aAAa;QAAGC,cAAc;IAAE;AAC3C"}
@@ -1 +1 @@
1
- {"version":3,"file":"linkPreviewMenu.d.ts","sourceRoot":"","sources":["../../../../../../../src/fields/TiptapEditor/extensions/LinkPreview/menus/linkPreviewMenu.tsx"],"names":[],"mappings":"AACA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAI3C,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAI7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,wDAAwD,CAAC;AAE/F,eAAO,MAAM,gBAAgB,6CAI1B,SAAS,GAAG;IAAE,iBAAiB,EAAE,qBAAqB,CAAA;CAAE,sBAmC1D,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"linkPreviewMenu.d.ts","sourceRoot":"","sources":["../../../../../../../src/fields/TiptapEditor/extensions/LinkPreview/menus/linkPreviewMenu.tsx"],"names":[],"mappings":"AACA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAI3C,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAI7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,wDAAwD,CAAC;AAE/F,eAAO,MAAM,gBAAgB,6CAI1B,SAAS,GAAG;IAAE,iBAAiB,EAAE,qBAAqB,CAAA;CAAE,sBAkC1D,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -13,7 +13,6 @@ export const ILinkPreviewMenu = ({ editor, appendTo, fetchSiteMetadata })=>{
13
13
  const onSetLink = useCallback(async (src)=>{
14
14
  if (fetchSiteMetadata) {
15
15
  const metadata = await fetchSiteMetadata(src);
16
- console.log(src, metadata);
17
16
  editor.chain().focus().setLinkPreview(src, metadata).run();
18
17
  }
19
18
  }, [
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../src/fields/TiptapEditor/extensions/LinkPreview/menus/linkPreviewMenu.tsx"],"sourcesContent":["import { BubbleMenu as BaseBubbleMenu } from \"@tiptap/react\";\nimport React, { useCallback } from \"react\";\nimport { sticky } from \"tippy.js\";\nimport { v4 as uuid } from \"uuid\";\n\nimport { MenuProps } from \"../../../features/menus/types.js\";\nimport { Toolbar } from \"../../../features/ui/Toolbar.js\";\nimport i18next from \"i18next\";\nimport { LinkPreviewEditorPanel } from \"../LinkPreviewEditorPanel.js\";\nimport { FetchSiteMetadataType } from \"src/fields/TiptapEditor/features/BlockEditor/types.jsx\";\n\nexport const ILinkPreviewMenu = ({\n editor,\n appendTo,\n fetchSiteMetadata,\n}: MenuProps & { fetchSiteMetadata: FetchSiteMetadataType }) => {\n const shouldShow = useCallback(() => {\n const isLinkPreview = editor.isActive(\"linkPreview\");\n return isLinkPreview;\n }, [editor]);\n\n const onSetLink = useCallback(\n async (src: string) => {\n if (fetchSiteMetadata) {\n const metadata = await fetchSiteMetadata(src);\n console.log(src, metadata);\n editor.chain().focus().setLinkPreview(src, metadata).run();\n }\n },\n [editor]\n );\n return (\n <BaseBubbleMenu\n editor={editor}\n pluginKey=\"linkPreview\"\n shouldShow={shouldShow}\n tippyOptions={{ popperOptions: { placement: \"top-start\" } }}\n updateDelay={100}\n >\n <Toolbar.Button type=\"button\">\n <LinkPreviewEditorPanel\n onSetLink={onSetLink}\n // @ts-ignore\n initialSrcLink={\n editor?.getAttributes(\"linkPreview\")?.editorValue ?? \"\"\n }\n />\n </Toolbar.Button>\n </BaseBubbleMenu>\n );\n};\n\nexport default ILinkPreviewMenu;\n"],"names":["BubbleMenu","BaseBubbleMenu","React","useCallback","Toolbar","LinkPreviewEditorPanel","ILinkPreviewMenu","editor","appendTo","fetchSiteMetadata","shouldShow","isLinkPreview","isActive","onSetLink","src","metadata","console","log","chain","focus","setLinkPreview","run","pluginKey","tippyOptions","popperOptions","placement","updateDelay","Button","type","initialSrcLink","getAttributes","editorValue"],"mappings":";AAAA,SAASA,cAAcC,cAAc,QAAQ,gBAAgB;AAC7D,OAAOC,SAASC,WAAW,QAAQ,QAAQ;AAK3C,SAASC,OAAO,QAAQ,kCAAkC;AAE1D,SAASC,sBAAsB,QAAQ,+BAA+B;AAGtE,OAAO,MAAMC,mBAAmB,CAAC,EAC/BC,MAAM,EACNC,QAAQ,EACRC,iBAAiB,EACwC;IACzD,MAAMC,aAAaP,YAAY;QAC7B,MAAMQ,gBAAgBJ,OAAOK,QAAQ,CAAC;QACtC,OAAOD;IACT,GAAG;QAACJ;KAAO;IAEX,MAAMM,YAAYV,YAChB,OAAOW;QACL,IAAIL,mBAAmB;YACrB,MAAMM,WAAW,MAAMN,kBAAkBK;YACzCE,QAAQC,GAAG,CAACH,KAAKC;YACjBR,OAAOW,KAAK,GAAGC,KAAK,GAAGC,cAAc,CAACN,KAAKC,UAAUM,GAAG;QAC1D;IACF,GACA;QAACd;KAAO;IAEV,qBACE,KAACN;QACCM,QAAQA;QACRe,WAAU;QACVZ,YAAYA;QACZa,cAAc;YAAEC,eAAe;gBAAEC,WAAW;YAAY;QAAE;QAC1DC,aAAa;kBAEb,cAAA,KAACtB,QAAQuB,MAAM;YAACC,MAAK;sBACnB,cAAA,KAACvB;gBACCQ,WAAWA;gBACX,aAAa;gBACbgB,gBACEtB,QAAQuB,cAAc,gBAAgBC,eAAe;;;;AAMjE,EAAE;AAEF,eAAezB,iBAAiB"}
1
+ {"version":3,"sources":["../../../../../../../src/fields/TiptapEditor/extensions/LinkPreview/menus/linkPreviewMenu.tsx"],"sourcesContent":["import { BubbleMenu as BaseBubbleMenu } from \"@tiptap/react\";\nimport React, { useCallback } from \"react\";\nimport { sticky } from \"tippy.js\";\nimport { v4 as uuid } from \"uuid\";\n\nimport { MenuProps } from \"../../../features/menus/types.js\";\nimport { Toolbar } from \"../../../features/ui/Toolbar.js\";\nimport i18next from \"i18next\";\nimport { LinkPreviewEditorPanel } from \"../LinkPreviewEditorPanel.js\";\nimport { FetchSiteMetadataType } from \"src/fields/TiptapEditor/features/BlockEditor/types.jsx\";\n\nexport const ILinkPreviewMenu = ({\n editor,\n appendTo,\n fetchSiteMetadata,\n}: MenuProps & { fetchSiteMetadata: FetchSiteMetadataType }) => {\n const shouldShow = useCallback(() => {\n const isLinkPreview = editor.isActive(\"linkPreview\");\n return isLinkPreview;\n }, [editor]);\n\n const onSetLink = useCallback(\n async (src: string) => {\n if (fetchSiteMetadata) {\n const metadata = await fetchSiteMetadata(src);\n editor.chain().focus().setLinkPreview(src, metadata).run();\n }\n },\n [editor]\n );\n return (\n <BaseBubbleMenu\n editor={editor}\n pluginKey=\"linkPreview\"\n shouldShow={shouldShow}\n tippyOptions={{ popperOptions: { placement: \"top-start\" } }}\n updateDelay={100}\n >\n <Toolbar.Button type=\"button\">\n <LinkPreviewEditorPanel\n onSetLink={onSetLink}\n // @ts-ignore\n initialSrcLink={\n editor?.getAttributes(\"linkPreview\")?.editorValue ?? \"\"\n }\n />\n </Toolbar.Button>\n </BaseBubbleMenu>\n );\n};\n\nexport default ILinkPreviewMenu;\n"],"names":["BubbleMenu","BaseBubbleMenu","React","useCallback","Toolbar","LinkPreviewEditorPanel","ILinkPreviewMenu","editor","appendTo","fetchSiteMetadata","shouldShow","isLinkPreview","isActive","onSetLink","src","metadata","chain","focus","setLinkPreview","run","pluginKey","tippyOptions","popperOptions","placement","updateDelay","Button","type","initialSrcLink","getAttributes","editorValue"],"mappings":";AAAA,SAASA,cAAcC,cAAc,QAAQ,gBAAgB;AAC7D,OAAOC,SAASC,WAAW,QAAQ,QAAQ;AAK3C,SAASC,OAAO,QAAQ,kCAAkC;AAE1D,SAASC,sBAAsB,QAAQ,+BAA+B;AAGtE,OAAO,MAAMC,mBAAmB,CAAC,EAC/BC,MAAM,EACNC,QAAQ,EACRC,iBAAiB,EACwC;IACzD,MAAMC,aAAaP,YAAY;QAC7B,MAAMQ,gBAAgBJ,OAAOK,QAAQ,CAAC;QACtC,OAAOD;IACT,GAAG;QAACJ;KAAO;IAEX,MAAMM,YAAYV,YAChB,OAAOW;QACL,IAAIL,mBAAmB;YACrB,MAAMM,WAAW,MAAMN,kBAAkBK;YACzCP,OAAOS,KAAK,GAAGC,KAAK,GAAGC,cAAc,CAACJ,KAAKC,UAAUI,GAAG;QAC1D;IACF,GACA;QAACZ;KAAO;IAEV,qBACE,KAACN;QACCM,QAAQA;QACRa,WAAU;QACVV,YAAYA;QACZW,cAAc;YAAEC,eAAe;gBAAEC,WAAW;YAAY;QAAE;QAC1DC,aAAa;kBAEb,cAAA,KAACpB,QAAQqB,MAAM;YAACC,MAAK;sBACnB,cAAA,KAACrB;gBACCQ,WAAWA;gBACX,aAAa;gBACbc,gBACEpB,QAAQqB,cAAc,gBAAgBC,eAAe;;;;AAMjE,EAAE;AAEF,eAAevB,iBAAiB"}
@@ -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,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,cAAc,UAAW,mBAAmB,sBAmGxD,CAAC;AAEF,eAAe,cAAc,CAAC"}
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,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,cAAc,UAAW,mBAAmB,sBAwGxD,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -8,13 +8,18 @@ export const VideoBlockView = (props)=>{
8
8
  const videoWrapperRef = useRef(null);
9
9
  const { src, poster, playlistUrl, caption, title } = node.attrs;
10
10
  const [playlistContent, setPlaylistContent] = React.useState();
11
- const [error, setError] = React.useState();
11
+ const [error, setError] = React.useState("");
12
12
  useEffect(()=>{
13
13
  async function getPlaylistContent() {
14
- const res = await fetch(playlistUrl, {
15
- cache: "no-cache"
16
- });
17
- return await res.json();
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
+ }
18
23
  }
19
24
  if (playlistUrl) {
20
25
  try {
@@ -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, 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 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 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 VideoBlockView;\n"],"names":["NodeViewWrapper","React","useCallback","useEffect","useMemo","useRef","cn","VideoPlayer","VideoBlockView","props","editor","getPos","node","videoWrapperRef","src","poster","playlistUrl","caption","title","attrs","playlistContent","setPlaylistContent","useState","error","setError","getPlaylistContent","res","fetch","cache","json","then","data","catch","err","wrapperClassName","align","onClick","commands","setNodeSelection","videoJsOptions","undefined","items","some","item","type","sources","filter","map","label","div","className","style","width","ref","options"],"mappings":";AACA,SAAiBA,eAAe,QAAQ,gBAAgB;AACxD,OAAOC,SAASC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,QAAQ;AACvE,SAASC,EAAE,QAAQ,8BAA8B;AACjD,OAAOC,iBAAiB,2BAA2B;AAgCnD,OAAO,MAAMC,iBAAiB,CAACC;IAC7B,MAAM,EAAEC,MAAM,EAAEC,MAAM,EAAEC,IAAI,E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,CAAA;wBACd7B,KAAK6B,KAAK7B,GAAG;wBACb8B,MAAMD,KAAKC,IAAI;wBACfI,OAAOL,KAAKK,KAAK;oBACnB,CAAA;gBACFjC,QAAQK,gBAAgBL,MAAM;YAChC;QACF;QACA,OAAO;YACL8B,SAASzB,gBAAgBqB,KAAK,CAACM,GAAG,CAAC,CAACJ,OAAU,CAAA;oBAC5C7B,KAAK6B,KAAK7B,GAAG;oBACb8B,MAAMD,KAAKC,IAAI;oBACfI,OAAOL,KAAKK,KAAK;gBACnB,CAAA;YACAjC,QAAQK,gBAAgBL,MAAM;QAChC;IACF,GAAG;QAACK;KAAgB;IACpB,qBACE,KAACpB;kBACC,cAAA,KAACiD;YAAIC,WAAWhB;YAAkBiB,OAAO;gBAAEC,OAAOxC,KAAKO,KAAK,CAACiC,KAAK;YAAC;sBACjE,cAAA,MAACH;gBAAII,KAAKxC;;oBACPU,uBAAS,KAAC0B;kCAAK1B;;oBASfH,iCAAmB,KAACb;wBAAY+C,SAASf;;oBACzCtB,WAAWG,iBAAiBF,uBAC3B,KAACD;wBAAQiC,WAAU;kCAChBhC,SAASE,iBAAiBF;;;;;;AAOzC,EAAE;AAEF,eAAeV,eAAe"}
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, 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 VideoBlockView;\n"],"names":["NodeViewWrapper","React","useCallback","useEffect","useMemo","useRef","cn","VideoPlayer","VideoBlockView","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":";AACA,SAAiBA,eAAe,QAAQ,gBAAgB;AACxD,OAAOC,SAASC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,QAAQ;AACvE,SAASC,EAAE,QAAQ,8BAA8B;AACjD,OAAOC,iBAAiB,2BAA2B;AAgCnD,OAAO,MAAMC,iBAAiB,CAACC;IAC7B,MAAM,EAAEC,MAAM,EAAEC,MAAM,EAAEC,IAAI,EAAE,GAAGH;IACjC,MAAMI,kBAAkBR,OAAuB;IAC/C,MAAM,EAAES,GAAG,EAAEC,MAAM,EAAEC,WAAW,EAAEC,OAAO,EAAEC,KAAK,EAAE,GAAGN,KAAKO,KAAK;IAC/D,MAAM,CAACC,iBAAiBC,mBAAmB,GAAGpB,MAAMqB,QAAQ;IAG5D,MAAM,CAACC,OAAOC,SAAS,GAAGvB,MAAMqB,QAAQ,CAAC;IAEzCnB,UAAU;QACR,eAAesB;YACb,IAAI;gBACF,MAAMC,MAAM,MAAMC,MAAMX,aAAa;oBACnCY,OAAO;gBACT;gBACA,OAAO,MAAMF,IAAIG,IAAI;YACvB,EAAE,OAAM;gBACNL,SAAS;gBACT,OAAOM;YACT;QACF;QAEA,IAAId,aAAa;YACf,IAAI;gBACFS,qBACGM,IAAI,CAAC,CAACC;oB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B,OAAO;gBAAEC,OAAOxC,KAAKO,KAAK,CAACiC,KAAK;YAAC;sBACjE,cAAA,MAACH;gBAAII,KAAKxC;;oBACPU,uBAAS,KAAC0B;kCAAK1B;;oBASfH,iCAAmB,KAACb;wBAAY+C,SAASd;;oBACzCvB,WAAWG,iBAAiBF,uBAC3B,KAACD;wBAAQiC,WAAU;kCAChBhC,SAASE,iBAAiBF;;;;;;AAOzC,EAAE;AAEF,eAAeV,eAAe"}
@@ -1,9 +1,6 @@
1
1
  import { Node } from "@tiptap/pm/model";
2
- import { Editor } from "@tiptap/react";
3
2
  import React from "react";
4
3
  interface VideoBlockViewProps {
5
- editor: Editor;
6
- getPos: () => number;
7
4
  node: Node & {
8
5
  attrs: {
9
6
  src: string;
@@ -12,8 +9,8 @@ interface VideoBlockViewProps {
12
9
  playlistUrl?: string;
13
10
  };
14
11
  };
15
- updateAttributes: (attrs: Record<string, string>) => void;
16
12
  className?: string;
13
+ getVideoAspect?: () => void;
17
14
  }
18
15
  export type Playlist = {
19
16
  id: string;
@@ -29,6 +26,6 @@ export type Item = {
29
26
  width: number;
30
27
  height: number;
31
28
  };
32
- export declare const VideoBlockViewClientside: ({ className, ...props }: VideoBlockViewProps) => React.JSX.Element;
29
+ export declare const VideoBlockViewClientside: ({ className, getVideoAspect, ...props }: VideoBlockViewProps) => React.JSX.Element;
33
30
  export default VideoBlockViewClientside;
34
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;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;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;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,4BAGlC,mBAAmB,sBA+FrB,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;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,sBAuIrB,CAAC;AAEF,eAAe,wBAAwB,CAAC"}
@@ -3,10 +3,12 @@ import { NodeViewWrapper } from "@tiptap/react";
3
3
  import React, { useEffect, useMemo, useRef } from "react";
4
4
  import { cn } from "../../../lib/utils/index.js";
5
5
  import VideoPlayer from "./videojs/VideoPlayer.js";
6
- export const VideoBlockViewClientside = ({ className, ...props })=>{
6
+ import { useGetAssetsAspectRatio } from "../../serverside/getAssetsAspectRatio.js";
7
+ export const VideoBlockViewClientside = ({ className, getVideoAspect, ...props })=>{
7
8
  const { node } = props;
8
9
  const videoWrapperRef = useRef(null);
9
- const { src, poster, playlistUrl, caption } = node.attrs;
10
+ const { src, poster, playlistUrl, caption, actualWidth, actualHeight } = node.attrs;
11
+ const { aspectRatio, calculateAspectRatio } = useGetAssetsAspectRatio();
10
12
  const [playlistContent, setPlaylistContent] = React.useState();
11
13
  const [error, setError] = React.useState();
12
14
  useEffect(()=>{
@@ -40,7 +42,8 @@ export const VideoBlockViewClientside = ({ className, ...props })=>{
40
42
  type: item.type,
41
43
  label: item.label
42
44
  })),
43
- poster: playlistContent.poster
45
+ poster: playlistContent.poster,
46
+ preload: "auto"
44
47
  };
45
48
  }
46
49
  return {
@@ -49,34 +52,63 @@ export const VideoBlockViewClientside = ({ className, ...props })=>{
49
52
  type: item.type,
50
53
  label: item.label
51
54
  })),
52
- poster: playlistContent.poster
55
+ poster: playlistContent.poster,
56
+ preload: "auto"
53
57
  };
54
58
  }, [
55
59
  playlistContent
56
60
  ]);
57
- return /*#__PURE__*/ _jsx(NodeViewWrapper, {
58
- className: className,
59
- children: /*#__PURE__*/ _jsx("div", {
60
- className: wrapperClassName,
61
- style: {
61
+ useEffect(()=>{
62
+ const anySrc = playlistContent?.items?.some((item)=>item.src);
63
+ if (!aspectRatio && anySrc) {
64
+ const source = playlistContent.items.find((item)=>item.src && item.width && item.height);
65
+ calculateAspectRatio({
66
+ src,
67
+ actualWidth: actualWidth || source?.width,
68
+ actualHeight: actualHeight || source?.height
69
+ }, "VIDEO", getVideoAspect);
70
+ }
71
+ }, [
72
+ playlistContent
73
+ ]);
74
+ const style = useMemo(()=>{
75
+ if (aspectRatio) {
76
+ return {
77
+ aspectRatio,
78
+ maxHeight: "80vh",
62
79
  width: node.attrs.width
63
- },
64
- children: /*#__PURE__*/ _jsxs("div", {
80
+ };
81
+ }
82
+ return {
83
+ width: node.attrs.width
84
+ };
85
+ }, [
86
+ aspectRatio
87
+ ]);
88
+ return /*#__PURE__*/ _jsxs(NodeViewWrapper, {
89
+ className: className,
90
+ children: [
91
+ /*#__PURE__*/ _jsxs("div", {
92
+ className: cn(wrapperClassName, "main-videojs-wrapper"),
65
93
  ref: videoWrapperRef,
94
+ style: style,
66
95
  children: [
67
96
  error && /*#__PURE__*/ _jsx("div", {
68
97
  children: error
69
98
  }),
70
99
  playlistContent && /*#__PURE__*/ _jsx(VideoPlayer, {
71
100
  options: videoJsOptions
72
- }),
73
- caption && playlistContent?.title && /*#__PURE__*/ _jsx("div", {
74
- className: "text-center block text-sm text-gray-500",
75
- children: playlistContent?.title
76
101
  })
77
102
  ]
103
+ }),
104
+ caption && playlistContent?.title && /*#__PURE__*/ _jsx("div", {
105
+ className: "block mx-auto text-sm text-gray-500",
106
+ style: {
107
+ width: node.attrs.width
108
+ },
109
+ children: playlistContent?.title
78
110
  })
79
- })
111
+ ]
80
112
  });
81
113
  };
82
114
  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 { 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 className?: string;\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 ...props\n}: VideoBlockViewProps) => {\n const { node } = props;\n const videoWrapperRef = useRef<HTMLDivElement>(null);\n const { src, poster, playlistUrl, caption } = 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 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 };\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 className={className}>\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 <div className=\"text-center block text-sm text-gray-500\">\n {playlistContent?.title}\n </div>\n )}\n </div>\n </div>\n </NodeViewWrapper>\n );\n};\n\nexport default VideoBlockViewClientside;\n"],"names":["NodeViewWrapper","React","useEffect","useMemo","useRef","cn","VideoPlayer","VideoBlockViewClientside","className","props","node","videoWrapperRef","src","poster","playlistUrl","caption","attrs","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","div","style","width","ref","options","title"],"mappings":";AACA,SAAiBA,eAAe,QAAQ,gBAAgB;AACxD,OAAOC,SAAsBC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,QAAQ;AACvE,SAASC,EAAE,QAAQ,8BAA8B;AACjD,OAAOC,iBAAiB,2BAA2B;AAiCnD,OAAO,MAAMC,2BAA2B,CAAC,EACvCC,SAAS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,KAAK;oBACnB,CAAA;gBACF7B,QAAQI,gBAAgBJ,MAAM;YAChC;QACF;QACA,OAAO;YACL0B,SAAStB,gBAAgBkB,KAAK,CAACM,GAAG,CAAC,CAACJ,OAAU,CAAA;oBAC5CzB,KAAKyB,KAAKzB,GAAG;oBACb0B,MAAMD,KAAKC,IAAI;oBACfI,OAAOL,KAAKK,KAAK;gBACnB,CAAA;YACA7B,QAAQI,gBAAgBJ,MAAM;QAChC;IACF,GAAG;QAACI;KAAgB;IACpB,qBACE,KAACjB;QAAgBQ,WAAWA;kBAC1B,cAAA,KAACmC;YAAInC,WAAWuB;YAAkBa,OAAO;gBAAEC,OAAOnC,KAAKM,KAAK,CAAC6B,KAAK;YAAC;sBACjE,cAAA,MAACF;gBAAIG,KAAKnC;;oBACPS,uBAAS,KAACuB;kCAAKvB;;oBASfH,iCAAmB,KAACX;wBAAYyC,SAASd;;oBACzClB,WAAWE,iBAAiB+B,uBAC3B,KAACL;wBAAInC,WAAU;kCACZS,iBAAiB+B;;;;;;AAOhC,EAAE;AAEF,eAAezC,yBAAyB"}
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 } = 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 const anySrc = playlistContent?.items?.some((item) => item.src);\n\n if (!aspectRatio && anySrc) {\n const source = playlistContent.items.find(\n (item) => item.src && item.width && item.height\n );\n calculateAspectRatio(\n {\n 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 maxHeight: \"80vh\",\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(wrapperClassName, \"main-videojs-wrapper\")}\n ref={videoWrapperRef}\n style={style}\n >\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 </div>\n {caption && playlistContent?.title && (\n <div\n className=\"block mx-auto text-sm text-gray-500\"\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","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","anySrc","source","find","width","height","style","maxHeight","div","ref","options","title"],"mappings":";AACA,SAASA,eAAe,QAAQ,gBAAgB;AAChD,OAAOC,SAASC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,QAAQ;AAC1D,SAASC,EAAE,QAAQ,8BAA8B;AACjD,OAAOC,iBAAiB,2BAA2B;AACnD,SAASC,uBAAuB,QAAQ,2CAA2C;AA+BnF,OAAO,MAAMC,2BAA2B,CAAC,EACvCC,SAAS,EACTC,cAAc,EACd,GAAGC,OACiB;IACpB,MAAM,EAAEC,IAAI,EAAE,GAAGD;IACjB,MAAME,kBAAkBT,OAAuB;IAC/C,MAAM,EAAEU,GAAG,EAAEC,MAAM,EAAEC,WA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BqC;;;;AAK5B,EAAE;AAEF,eAAepD,yBAAyB"}
@@ -1,10 +1,12 @@
1
- import React from "react";
1
+ import React, { CSSProperties } from "react";
2
2
  import { VideoJsPlayerOptions } from "video.js/dist/video.js";
3
3
  import "video.js/dist/video-js.css";
4
4
  import "video.js/dist/video-js.css";
5
5
  interface IVideoPlayerProps {
6
6
  options: VideoJsPlayerOptions;
7
7
  }
8
- declare const VideoPlayer: React.FC<IVideoPlayerProps>;
8
+ declare const VideoPlayer: React.FC<IVideoPlayerProps & {
9
+ style?: CSSProperties;
10
+ }>;
9
11
  export default VideoPlayer;
10
12
  //# sourceMappingURL=VideoPlayer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"VideoPlayer.d.ts","sourceRoot":"","sources":["../../../../../../../../src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/VideoPlayer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAgB,EAEd,oBAAoB,EACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,4BAA4B,CAAC;AAGpC,OAAO,4BAA4B,CAAC;AAIpC,UAAU,iBAAiB;IACzB,OAAO,EAAE,oBAAoB,CAAC;CAC/B;AAYD,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA2B5C,CAAC;AAEF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"VideoPlayer.d.ts","sourceRoot":"","sources":["../../../../../../../../src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/VideoPlayer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAgB,EAEd,oBAAoB,EACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,4BAA4B,CAAC;AAGpC,OAAO,4BAA4B,CAAC;AAIpC,UAAU,iBAAiB;IACzB,OAAO,EAAE,oBAAoB,CAAC;CAC/B;AAYD,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,GAAG;IAAE,KAAK,CAAC,EAAE,aAAa,CAAA;CAAE,CA8BxE,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -14,7 +14,7 @@ const initialOptions = {
14
14
  }
15
15
  }
16
16
  };
17
- const VideoPlayer = ({ options })=>{
17
+ const VideoPlayer = ({ options, style })=>{
18
18
  const videoNode = React.useRef(null);
19
19
  const player = React.useRef(null);
20
20
  React.useEffect(()=>{
@@ -37,7 +37,8 @@ const VideoPlayer = ({ options })=>{
37
37
  ]);
38
38
  return /*#__PURE__*/ _jsx("video", {
39
39
  ref: videoNode,
40
- className: "video-js"
40
+ className: "video-js",
41
+ style: style
41
42
  });
42
43
  };
43
44
  export default VideoPlayer;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/VideoPlayer.tsx"],"sourcesContent":["import React from \"react\";\nimport videojs, {\n VideoJsPlayer,\n VideoJsPlayerOptions,\n} from \"video.js/dist/video.js\";\nimport \"video.js/dist/video-js.css\";\n\n// Styles\nimport \"video.js/dist/video-js.css\";\n\nimport { QualitySelector } from \"./quality-selector/index.js\";\n\ninterface IVideoPlayerProps {\n options: VideoJsPlayerOptions;\n}\n\nconst initialOptions: VideoJsPlayerOptions = {\n controls: true,\n fluid: true,\n controlBar: {\n volumePanel: {\n inline: false,\n },\n },\n};\n\nconst VideoPlayer: React.FC<IVideoPlayerProps> = ({ options }) => {\n const videoNode = React.useRef<HTMLVideoElement>(null);\n const player = React.useRef<videojs.Player>(null);\n\n React.useEffect(() => {\n QualitySelector(videojs);\n\n player.current = videojs(videoNode.current, {\n ...initialOptions,\n ...options,\n }).ready(function () {\n if (\n !this.controlBar\n .children()\n .some((c: { name_: string }) => c.name_ === \"QualitySelector\")\n ) {\n this.controlBar.addChild(\"QualitySelector\");\n }\n });\n return () => {\n if (player.current) {\n player.current.dispose();\n }\n };\n }, [options]);\n\n return <video ref={videoNode} className=\"video-js\" />;\n};\n\nexport default VideoPlayer;\n"],"names":["React","videojs","QualitySelector","initialOptions","controls","fluid","controlBar","volumePanel","inline","VideoPlayer","options","videoNode","useRef","player","useEffect","current","ready","children","some","c","name_","addChild","dispose","video","ref","className"],"mappings":";AAAA,OAAOA,WAAW,QAAQ;AAC1B,OAAOC,aAGA,yBAAyB;AAChC,OAAO,6BAA6B;AAEpC,SAAS;AACT,OAAO,6BAA6B;AAEpC,SAASC,eAAe,QAAQ,8BAA8B;AAM9D,MAAMC,iBAAuC;IAC3CC,UAAU;IACVC,OAAO;IACPC,YAAY;QACVC,aAAa;YACXC,QAAQ;QACV;IACF;AACF;AAEA,MAAMC,cAA2C,CAAC,EAAEC,OAAO,EAAE;IAC3D,MAAMC,YAAYX,MAAMY,MAAM,CAAmB;IACjD,MAAMC,SAASb,MAAMY,MAAM,CAAiB;IAE5CZ,MAAMc,SAAS,CAAC;QACdZ,gBAAgBD;QAEhBY,OAAOE,OAAO,GAAGd,QAAQU,UAAUI,OAAO,EAAE;YAC1C,GAAGZ,cAAc;YACjB,GAAGO,OAAO;QACZ,GAAGM,KAAK,CAAC;YACP,IACE,CAAC,IAAI,CAACV,UAAU,CACbW,QAAQ,GACRC,IAAI,CAAC,CAACC,IAAyBA,EAAEC,KAAK,KAAK,oBAC9C;gBACA,IAAI,CAACd,UAAU,CAACe,QAAQ,CAAC;YAC3B;QACF;QACA,OAAO;YACL,IAAIR,OAAOE,OAAO,EAAE;gBAClBF,OAAOE,OAAO,CAACO,OAAO;YACxB;QACF;IACF,GAAG;QAACZ;KAAQ;IAEZ,qBAAO,KAACa;QAAMC,KAAKb;QAAWc,WAAU;;AAC1C;AAEA,eAAehB,YAAY"}
1
+ {"version":3,"sources":["../../../../../../../../src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/VideoPlayer.tsx"],"sourcesContent":["import React, { CSSProperties } from \"react\";\nimport videojs, {\n VideoJsPlayer,\n VideoJsPlayerOptions,\n} from \"video.js/dist/video.js\";\nimport \"video.js/dist/video-js.css\";\n\n// Styles\nimport \"video.js/dist/video-js.css\";\n\nimport { QualitySelector } from \"./quality-selector/index.js\";\n\ninterface IVideoPlayerProps {\n options: VideoJsPlayerOptions;\n}\n\nconst initialOptions: VideoJsPlayerOptions = {\n controls: true,\n fluid: true,\n controlBar: {\n volumePanel: {\n inline: false,\n },\n },\n};\n\nconst VideoPlayer: React.FC<IVideoPlayerProps & { style?: CSSProperties }> = ({\n options,\n style,\n}) => {\n const videoNode = React.useRef<HTMLVideoElement>(null);\n const player = React.useRef<videojs.Player>(null);\n\n React.useEffect(() => {\n QualitySelector(videojs);\n\n player.current = videojs(videoNode.current, {\n ...initialOptions,\n ...options,\n }).ready(function () {\n if (\n !this.controlBar\n .children()\n .some((c: { name_: string }) => c.name_ === \"QualitySelector\")\n ) {\n this.controlBar.addChild(\"QualitySelector\");\n }\n });\n return () => {\n if (player.current) {\n player.current.dispose();\n }\n };\n }, [options]);\n\n return <video ref={videoNode} className=\"video-js\" style={style} />;\n};\n\nexport default VideoPlayer;\n"],"names":["React","videojs","QualitySelector","initialOptions","controls","fluid","controlBar","volumePanel","inline","VideoPlayer","options","style","videoNode","useRef","player","useEffect","current","ready","children","some","c","name_","addChild","dispose","video","ref","className"],"mappings":";AAAA,OAAOA,WAA8B,QAAQ;AAC7C,OAAOC,aAGA,yBAAyB;AAChC,OAAO,6BAA6B;AAEpC,SAAS;AACT,OAAO,6BAA6B;AAEpC,SAASC,eAAe,QAAQ,8BAA8B;AAM9D,MAAMC,iBAAuC;IAC3CC,UAAU;IACVC,OAAO;IACPC,YAAY;QACVC,aAAa;YACXC,QAAQ;QACV;IACF;AACF;AAEA,MAAMC,cAAuE,CAAC,EAC5EC,OAAO,EACPC,KAAK,EACN;IACC,MAAMC,YAAYZ,MAAMa,MAAM,CAAmB;IACjD,MAAMC,SAASd,MAAMa,MAAM,CAAiB;IAE5Cb,MAAMe,SAAS,CAAC;QACdb,gBAAgBD;QAEhBa,OAAOE,OAAO,GAAGf,QAAQW,UAAUI,OAAO,EAAE;YAC1C,GAAGb,cAAc;YACjB,GAAGO,OAAO;QACZ,GAAGO,KAAK,CAAC;YACP,IACE,CAAC,IAAI,CAACX,UAAU,CACbY,QAAQ,GACRC,IAAI,CAAC,CAACC,IAAyBA,EAAEC,KAAK,KAAK,oBAC9C;gBACA,IAAI,CAACf,UAAU,CAACgB,QAAQ,CAAC;YAC3B;QACF;QACA,OAAO;YACL,IAAIR,OAAOE,OAAO,EAAE;gBAClBF,OAAOE,OAAO,CAACO,OAAO;YACxB;QACF;IACF,GAAG;QAACb;KAAQ;IAEZ,qBAAO,KAACc;QAAMC,KAAKb;QAAWc,WAAU;QAAWf,OAAOA;;AAC5D;AAEA,eAAeF,YAAY"}
@@ -1,4 +1,5 @@
1
- export declare function EmbedContentInlineRenderer({ body }: {
1
+ export declare function EmbedContentInlineRenderer({ body, getVideoAspect }: {
2
2
  body: any;
3
+ getVideoAspect: any;
3
4
  }): import("react").JSX.Element;
4
5
  //# sourceMappingURL=EmbedContentInlineRenderer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EmbedContentInlineRenderer.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/serverside/EmbedContentInlineRenderer.tsx"],"names":[],"mappings":"AAcA,wBAAgB,0BAA0B,CAAC,EAAE,IAAI,EAAE;;CAAA,+BAwBlD"}
1
+ {"version":3,"file":"EmbedContentInlineRenderer.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/serverside/EmbedContentInlineRenderer.tsx"],"names":[],"mappings":"AAoBA,wBAAgB,0BAA0B,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE;;;CAAA,+BAyBlE"}
@@ -3,14 +3,14 @@ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { Portal } from "@radix-ui/react-portal";
4
4
  import { memo, useEffect, useState } from "react";
5
5
  import { renderEmbedContent } from "./RenderEmbedClientSide.js";
6
- const CustomPortal = /*#__PURE__*/ memo(({ content, ...props })=>{
6
+ const CustomPortal = /*#__PURE__*/ memo(({ content, getVideoAspect, ...props })=>{
7
7
  useEffect(()=>{}, []);
8
8
  return /*#__PURE__*/ _jsx(Portal, {
9
9
  ...props,
10
- children: renderEmbedContent(content)
10
+ children: renderEmbedContent(content, getVideoAspect)
11
11
  });
12
12
  });
13
- export function EmbedContentInlineRenderer({ body }) {
13
+ export function EmbedContentInlineRenderer({ body, getVideoAspect }) {
14
14
  const [mounted, setMounted] = useState(false);
15
15
  useEffect(()=>{
16
16
  setMounted(true);
@@ -20,7 +20,8 @@ export function EmbedContentInlineRenderer({ body }) {
20
20
  children: body.content.filter((content)=>content?.attrs?.["data-id"]).map((content)=>{
21
21
  return /*#__PURE__*/ _jsx(CustomPortal, {
22
22
  container: document?.querySelector(`[data-id='${content.attrs["data-id"]}']`),
23
- content: content
23
+ content: content,
24
+ getVideoAspect: getVideoAspect
24
25
  }, `embed-content-inline-${content.attrs["data-id"]}-${content.attrs.key}`);
25
26
  })
26
27
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/serverside/EmbedContentInlineRenderer.tsx"],"sourcesContent":["\"use client\";\n\nimport { Portal } from \"@radix-ui/react-portal\";\nimport { ComponentProps, memo, useEffect, useState } from \"react\";\n\nimport { renderEmbedContent } from \"./RenderEmbedClientSide.js\";\n\nconst CustomPortal = memo(\n ({ content, ...props }: ComponentProps<typeof Portal>) => {\n useEffect(() => {}, []);\n return <Portal {...props}>{renderEmbedContent(content)}</Portal>;\n }\n);\n\nexport function EmbedContentInlineRenderer({ body }) {\n const [mounted, setMounted] = useState(false);\n useEffect(() => {\n setMounted(true);\n }, []);\n\n if (!mounted) return null;\n return (\n <>\n {body.content\n .filter((content) => content?.attrs?.[\"data-id\"])\n .map((content) => {\n return (\n <CustomPortal\n key={`embed-content-inline-${content.attrs[\"data-id\"]}-${content.attrs.key}`}\n container={document?.querySelector(\n `[data-id='${content.attrs[\"data-id\"]}']`\n )}\n content={content}\n />\n );\n })}\n </>\n );\n}\n"],"names":["Portal","memo","useEffect","useState","renderEmbedContent","CustomPortal","content","props","EmbedContentInlineRenderer","body","mounted","setMounted","filter","attrs","map","container","document","querySelector","key"],"mappings":"AAAA;;AAEA,SAASA,MAAM,QAAQ,yBAAyB;AAChD,SAAyBC,IAAI,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,QAAQ;AAElE,SAASC,kBAAkB,QAAQ,6BAA6B;AAEhE,MAAMC,6BAAeJ,KACnB,CAAC,EAAEK,OAAO,EAAE,GAAGC,OAAsC;IACnDL,UAAU,KAAO,GAAG,EAAE;IACtB,qBAAO,KAACF;QAAQ,GAAGO,KAAK;kBAAGH,mBAAmBE;;AAChD;AAGF,OAAO,SAASE,2BAA2B,EAAEC,IAAI,EAAE;IACjD,MAAM,CAACC,SAASC,WAAW,GAAGR,SAAS;IACvCD,UAAU;QACRS,WAAW;IACb,GAAG,EAAE;IAEL,IAAI,CAACD,SAAS,OAAO;IACrB,qBACE;kBACGD,KAAKH,OAAO,CACVM,MAAM,CAAC,CAACN,UAAYA,SAASO,OAAO,CAAC,UAAU,EAC/CC,GAAG,CAAC,CAACR;YACJ,qBACE,KAACD;gBAECU,WAAWC,UAAUC,cACnB,CAAC,UAAU,EAAEX,QAAQO,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC;gBAE3CP,SAASA;eAJJ,CAAC,qBAAqB,EAAEA,QAAQO,KAAK,CAAC,UAAU,CAAC,CAAC,EAAEP,QAAQO,KAAK,CAACK,GAAG,EAAE;QAOlF;;AAGR"}
1
+ {"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/serverside/EmbedContentInlineRenderer.tsx"],"sourcesContent":["\"use client\";\n\nimport { Portal } from \"@radix-ui/react-portal\";\nimport { ComponentProps, memo, useEffect, useState } from \"react\";\n\nimport { renderEmbedContent } from \"./RenderEmbedClientSide.js\";\n\nconst CustomPortal = memo(\n ({\n content,\n getVideoAspect,\n ...props\n }: ComponentProps<typeof Portal> & { getVideoAspect }) => {\n useEffect(() => {}, []);\n return (\n <Portal {...props}>{renderEmbedContent(content, getVideoAspect)}</Portal>\n );\n }\n);\n\nexport function EmbedContentInlineRenderer({ body, getVideoAspect }) {\n const [mounted, setMounted] = useState(false);\n useEffect(() => {\n setMounted(true);\n }, []);\n\n if (!mounted) return null;\n return (\n <>\n {body.content\n .filter((content) => content?.attrs?.[\"data-id\"])\n .map((content) => {\n return (\n <CustomPortal\n key={`embed-content-inline-${content.attrs[\"data-id\"]}-${content.attrs.key}`}\n container={document?.querySelector(\n `[data-id='${content.attrs[\"data-id\"]}']`\n )}\n content={content}\n getVideoAspect={getVideoAspect}\n />\n );\n })}\n </>\n );\n}\n"],"names":["Portal","memo","useEffect","useState","renderEmbedContent","CustomPortal","content","getVideoAspect","props","EmbedContentInlineRenderer","body","mounted","setMounted","filter","attrs","map","container","document","querySelector","key"],"mappings":"AAAA;;AAEA,SAASA,MAAM,QAAQ,yBAAyB;AAChD,SAAyBC,IAAI,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,QAAQ;AAElE,SAASC,kBAAkB,QAAQ,6BAA6B;AAEhE,MAAMC,6BAAeJ,KACnB,CAAC,EACCK,OAAO,EACPC,cAAc,EACd,GAAGC,OACgD;IACnDN,UAAU,KAAO,GAAG,EAAE;IACtB,qBACE,KAACF;QAAQ,GAAGQ,KAAK;kBAAGJ,mBAAmBE,SAASC;;AAEpD;AAGF,OAAO,SAASE,2BAA2B,EAAEC,IAAI,EAAEH,cAAc,EAAE;IACjE,MAAM,CAACI,SAASC,WAAW,GAAGT,SAAS;IACvCD,UAAU;QACRU,WAAW;IACb,GAAG,EAAE;IAEL,IAAI,CAACD,SAAS,OAAO;IACrB,qBACE;kBACGD,KAAKJ,OAAO,CACVO,MAAM,CAAC,CAACP,UAAYA,SAASQ,OAAO,CAAC,UAAU,EAC/CC,GAAG,CAAC,CAACT;YACJ,qBACE,KAACD;gBAECW,WAAWC,UAAUC,cACnB,CAAC,UAAU,EAAEZ,QAAQQ,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC;gBAE3CR,SAASA;gBACTC,gBAAgBA;eALX,CAAC,qBAAqB,EAAED,QAAQQ,KAAK,CAAC,UAAU,CAAC,CAAC,EAAER,QAAQQ,KAAK,CAACK,GAAG,EAAE;QAQlF;;AAGR"}
@@ -1,4 +1,5 @@
1
- export declare function EmbedContentSideRenderer({ body }: {
1
+ export declare function EmbedContentSideRenderer({ body, getVideoAspect, }: {
2
2
  body: any;
3
+ getVideoAspect: any;
3
4
  }): import("react").JSX.Element;
4
5
  //# sourceMappingURL=EmbedContentSideRenderer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EmbedContentSideRenderer.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/serverside/EmbedContentSideRenderer.tsx"],"names":[],"mappings":"AAcA,wBAAgB,wBAAwB,CAAC,EAAE,IAAI,EAAE;;CAAA,+BAyBhD"}
1
+ {"version":3,"file":"EmbedContentSideRenderer.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/serverside/EmbedContentSideRenderer.tsx"],"names":[],"mappings":"AAoBA,wBAAgB,wBAAwB,CAAC,EACvC,IAAI,EACJ,cAAc,GACf;;;CAAA,+BA0BA"}