payload-richtext-tiptap 0.0.135 → 0.0.136
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/body/ArticleBody.d.ts +2 -1
- package/dist/src/body/ArticleBody.d.ts.map +1 -1
- package/dist/src/body/ArticleBody.js +12 -11
- package/dist/src/body/ArticleBody.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/ImageBlock/components/ImageBlockViewClientside.d.ts +4 -0
- package/dist/src/fields/TiptapEditor/extensions/ImageBlock/components/ImageBlockViewClientside.d.ts.map +1 -0
- package/dist/src/fields/TiptapEditor/extensions/ImageBlock/components/ImageBlockViewClientside.js +28 -0
- package/dist/src/fields/TiptapEditor/extensions/ImageBlock/components/ImageBlockViewClientside.js.map +1 -0
- package/dist/src/fields/TiptapEditor/extensions/ImageUpload/getImageActualSize.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/ImageUpload/getImageActualSize.js +4 -0
- package/dist/src/fields/TiptapEditor/extensions/ImageUpload/getImageActualSize.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/LinkPreview/menus/linkPreviewMenu.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/LinkPreview/menus/linkPreviewMenu.js +0 -1
- package/dist/src/fields/TiptapEditor/extensions/LinkPreview/menus/linkPreviewMenu.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockViewClientside.d.ts +2 -5
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockViewClientside.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockViewClientside.js +24 -4
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockViewClientside.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/VideoPlayer.d.ts +4 -2
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/VideoPlayer.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/VideoPlayer.js +3 -2
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/VideoPlayer.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/serverside/EmbedContentInlineRenderer.d.ts +2 -1
- package/dist/src/fields/TiptapEditor/extensions/serverside/EmbedContentInlineRenderer.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/serverside/EmbedContentInlineRenderer.js +5 -4
- package/dist/src/fields/TiptapEditor/extensions/serverside/EmbedContentInlineRenderer.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/serverside/EmbedContentSideRenderer.d.ts +2 -1
- package/dist/src/fields/TiptapEditor/extensions/serverside/EmbedContentSideRenderer.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/serverside/EmbedContentSideRenderer.js +5 -4
- package/dist/src/fields/TiptapEditor/extensions/serverside/EmbedContentSideRenderer.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/serverside/EmbedContentSidebarRenderer.d.ts +2 -1
- package/dist/src/fields/TiptapEditor/extensions/serverside/EmbedContentSidebarRenderer.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/serverside/EmbedContentSidebarRenderer.js +2 -3
- package/dist/src/fields/TiptapEditor/extensions/serverside/EmbedContentSidebarRenderer.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/serverside/RenderEmbedClientSide.d.ts +1 -1
- package/dist/src/fields/TiptapEditor/extensions/serverside/RenderEmbedClientSide.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/serverside/RenderEmbedClientSide.js +7 -29
- package/dist/src/fields/TiptapEditor/extensions/serverside/RenderEmbedClientSide.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/serverside/getAssetsAspectRatio.d.ts +5 -0
- package/dist/src/fields/TiptapEditor/extensions/serverside/getAssetsAspectRatio.d.ts.map +1 -0
- package/dist/src/fields/TiptapEditor/extensions/serverside/getAssetsAspectRatio.js +31 -0
- package/dist/src/fields/TiptapEditor/extensions/serverside/getAssetsAspectRatio.js.map +1 -0
- package/dist/src/mobile.css +1 -1
- package/dist/src/styles.css +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- 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":"
|
|
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
|
-
|
|
1
|
+
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { memo } from
|
|
3
|
+
import { memo } from "react";
|
|
4
4
|
// import './article-custom.scss';
|
|
5
|
-
import { appendRequiredBlocksMarkerClient } from
|
|
6
|
-
import { ServersideTiptapBody } from
|
|
7
|
-
import { EmbedContentInlineRenderer } from
|
|
8
|
-
import { cn } from
|
|
9
|
-
const 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(
|
|
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(
|
|
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":["
|
|
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 @@
|
|
|
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"}
|
package/dist/src/fields/TiptapEditor/extensions/ImageBlock/components/ImageBlockViewClientside.js
ADDED
|
@@ -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;;;
|
|
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"}
|
|
@@ -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;
|
|
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,
|
|
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
|
|
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"}
|
package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockViewClientside.d.ts
CHANGED
|
@@ -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;
|
|
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,sBAuHrB,CAAC;AAEF,eAAe,wBAAwB,CAAC"}
|
package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockViewClientside.js
CHANGED
|
@@ -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
|
-
|
|
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,11 +52,25 @@ 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
|
]);
|
|
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
|
+
]);
|
|
57
74
|
return /*#__PURE__*/ _jsx(NodeViewWrapper, {
|
|
58
75
|
className: className,
|
|
59
76
|
children: /*#__PURE__*/ _jsx("div", {
|
|
@@ -63,6 +80,9 @@ export const VideoBlockViewClientside = ({ className, ...props })=>{
|
|
|
63
80
|
},
|
|
64
81
|
children: /*#__PURE__*/ _jsxs("div", {
|
|
65
82
|
ref: videoWrapperRef,
|
|
83
|
+
style: {
|
|
84
|
+
aspectRatio
|
|
85
|
+
},
|
|
66
86
|
children: [
|
|
67
87
|
error && /*#__PURE__*/ _jsx("div", {
|
|
68
88
|
children: error
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockViewClientside.tsx"],"sourcesContent":["import { Node } from \"@tiptap/pm/model\";\nimport {
|
|
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\n return (\n <NodeViewWrapper className={className}>\n <div className={wrapperClassName} style={{ width: node.attrs.width }}>\n <div ref={videoWrapperRef} style={{ aspectRatio }}>\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","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","div","style","ref","options","title"],"mappings":"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"}
|
package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/VideoPlayer.d.ts
CHANGED
|
@@ -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
|
package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/VideoPlayer.d.ts.map
CHANGED
|
@@ -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;
|
|
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"}
|
package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/VideoPlayer.js
CHANGED
|
@@ -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;
|
package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/VideoPlayer.js.map
CHANGED
|
@@ -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> = ({
|
|
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
|
package/dist/src/fields/TiptapEditor/extensions/serverside/EmbedContentInlineRenderer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmbedContentInlineRenderer.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/serverside/EmbedContentInlineRenderer.tsx"],"names":[],"mappings":"
|
|
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
|
});
|
package/dist/src/fields/TiptapEditor/extensions/serverside/EmbedContentInlineRenderer.js.map
CHANGED
|
@@ -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 ({
|
|
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"}
|
package/dist/src/fields/TiptapEditor/extensions/serverside/EmbedContentSideRenderer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmbedContentSideRenderer.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/serverside/EmbedContentSideRenderer.tsx"],"names":[],"mappings":"
|
|
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"}
|
|
@@ -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 EmbedContentSideRenderer({ body }) {
|
|
13
|
+
export function EmbedContentSideRenderer({ body, getVideoAspect }) {
|
|
14
14
|
const [mounted, setMounted] = useState(false);
|
|
15
15
|
useEffect(()=>{
|
|
16
16
|
setMounted(true);
|
|
@@ -20,7 +20,8 @@ export function EmbedContentSideRenderer({ body }) {
|
|
|
20
20
|
children: body.content.filter((content)=>content?.attrs?.["data-id"]).filter((content)=>content?.attrs?.side).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-side-${content.attrs["data-id"]}-${content.attrs.key}`);
|
|
25
26
|
})
|
|
26
27
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/serverside/EmbedContentSideRenderer.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 ({
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/serverside/EmbedContentSideRenderer.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 EmbedContentSideRenderer({\n body,\n getVideoAspect,\n}) {\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 .filter((content) => content?.attrs?.side)\n .map((content) => {\n return (\n <CustomPortal\n key={`embed-content-side-${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","EmbedContentSideRenderer","body","mounted","setMounted","filter","attrs","side","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,yBAAyB,EACvCC,IAAI,EACJH,cAAc,EACf;IACC,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/CD,MAAM,CAAC,CAACP,UAAYA,SAASQ,OAAOC,MACpCC,GAAG,CAAC,CAACV;YACJ,qBACE,KAACD;gBAECY,WAAWC,UAAUC,cACnB,CAAC,UAAU,EAAEb,QAAQQ,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC;gBAE3CR,SAASA;gBACTC,gBAAgBA;eALX,CAAC,mBAAmB,EAAED,QAAQQ,KAAK,CAAC,UAAU,CAAC,CAAC,EAAER,QAAQQ,KAAK,CAACM,GAAG,EAAE;QAQhF;;AAGR"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export declare function EmbedContentSidebarRenderer({ body, containerId }: {
|
|
1
|
+
export declare function EmbedContentSidebarRenderer({ body, containerId, getVideoAspect, }: {
|
|
2
2
|
body: any;
|
|
3
3
|
containerId: any;
|
|
4
|
+
getVideoAspect: any;
|
|
4
5
|
}): import("react").JSX.Element;
|
|
5
6
|
//# sourceMappingURL=EmbedContentSidebarRenderer.d.ts.map
|
package/dist/src/fields/TiptapEditor/extensions/serverside/EmbedContentSidebarRenderer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmbedContentSidebarRenderer.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/serverside/EmbedContentSidebarRenderer.tsx"],"names":[],"mappings":"AAWA,wBAAgB,2BAA2B,CAAC,
|
|
1
|
+
{"version":3,"file":"EmbedContentSidebarRenderer.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/serverside/EmbedContentSidebarRenderer.tsx"],"names":[],"mappings":"AAWA,wBAAgB,2BAA2B,CAAC,EAC1C,IAAI,EACJ,WAAW,EACX,cAAc,GACf;;;;CAAA,+BAgDA"}
|
|
@@ -7,7 +7,7 @@ function getContainerElement(containerId) {
|
|
|
7
7
|
if (typeof window === "undefined" || !containerId) return null;
|
|
8
8
|
return document.getElementById(containerId);
|
|
9
9
|
}
|
|
10
|
-
export function EmbedContentSidebarRenderer({ body, containerId }) {
|
|
10
|
+
export function EmbedContentSidebarRenderer({ body, containerId, getVideoAspect }) {
|
|
11
11
|
const [mounted, setMounted] = useState(false);
|
|
12
12
|
useEffect(()=>{
|
|
13
13
|
setTimeout(()=>{
|
|
@@ -28,13 +28,12 @@ export function EmbedContentSidebarRenderer({ body, containerId }) {
|
|
|
28
28
|
const tempBottomPixel = lastRenderedPixel;
|
|
29
29
|
const marginTop = Math.max(8, topPosition - tempBottomPixel - HEIGHT / 2);
|
|
30
30
|
lastRenderedPixel = topPosition + HEIGHT;
|
|
31
|
-
console.log(topPosition, tempBottomPixel, marginTop, window.innerHeight);
|
|
32
31
|
return /*#__PURE__*/ _jsx("div", {
|
|
33
32
|
className: "w-full",
|
|
34
33
|
style: {
|
|
35
34
|
marginTop
|
|
36
35
|
},
|
|
37
|
-
children: renderEmbedContent(content)
|
|
36
|
+
children: renderEmbedContent(content, getVideoAspect)
|
|
38
37
|
}, `embed-content-sidebar-${content.attrs["data-id"]}-${content.attrs.key}`);
|
|
39
38
|
})
|
|
40
39
|
});
|
package/dist/src/fields/TiptapEditor/extensions/serverside/EmbedContentSidebarRenderer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/serverside/EmbedContentSidebarRenderer.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef, useState } from \"react\";\nimport { renderEmbedContent } from \"./RenderEmbedClientSide.js\";\nconst HEIGHT = 320;\n\nfunction getContainerElement(containerId) {\n if (typeof window === \"undefined\" || !containerId) return null;\n return document.getElementById(containerId);\n}\n\nexport function EmbedContentSidebarRenderer({
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/serverside/EmbedContentSidebarRenderer.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef, useState } from \"react\";\nimport { renderEmbedContent } from \"./RenderEmbedClientSide.js\";\nconst HEIGHT = 320;\n\nfunction getContainerElement(containerId) {\n if (typeof window === \"undefined\" || !containerId) return null;\n return document.getElementById(containerId);\n}\n\nexport function EmbedContentSidebarRenderer({\n body,\n containerId,\n getVideoAspect,\n}) {\n const [mounted, setMounted] = useState(false);\n useEffect(() => {\n setTimeout(() => {\n setMounted(true);\n }, 200);\n }, []);\n const containerEl = useRef(getContainerElement(containerId));\n if (!mounted || typeof window === \"undefined\") return null;\n if (!containerEl.current) {\n containerEl.current = getContainerElement(containerId);\n }\n let lastRenderedPixel =\n containerEl.current?.getBoundingClientRect()?.top + window.scrollY ||\n window.innerHeight;\n\n return (\n <>\n {body.content\n .filter((content) => content?.attrs?.[\"data-id\"])\n .filter((content) => content?.attrs?.side)\n .map((content) => {\n const el = document?.querySelector(\n `[data-id='${content.attrs[\"data-id\"]}']`\n );\n const relativeTopPosition = el.getBoundingClientRect().top;\n const topPosition = relativeTopPosition + window.scrollY;\n\n const tempBottomPixel = lastRenderedPixel;\n\n const marginTop = Math.max(\n 8,\n topPosition - tempBottomPixel - HEIGHT / 2\n );\n lastRenderedPixel = topPosition + HEIGHT;\n\n return (\n <div\n key={`embed-content-sidebar-${content.attrs[\"data-id\"]}-${content.attrs.key}`}\n className=\"w-full\"\n style={{ marginTop }}\n >\n {renderEmbedContent(content, getVideoAspect)}\n </div>\n );\n })}\n </>\n );\n}\n"],"names":["useEffect","useRef","useState","renderEmbedContent","HEIGHT","getContainerElement","containerId","window","document","getElementById","EmbedContentSidebarRenderer","body","getVideoAspect","mounted","setMounted","setTimeout","containerEl","current","lastRenderedPixel","getBoundingClientRect","top","scrollY","innerHeight","content","filter","attrs","side","map","el","querySelector","relativeTopPosition","topPosition","tempBottomPixel","marginTop","Math","max","div","className","style","key"],"mappings":"AAAA;;AAEA,SAASA,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AACpD,SAASC,kBAAkB,QAAQ,6BAA6B;AAChE,MAAMC,SAAS;AAEf,SAASC,oBAAoBC,WAAW;IACtC,IAAI,OAAOC,WAAW,eAAe,CAACD,aAAa,OAAO;IAC1D,OAAOE,SAASC,cAAc,CAACH;AACjC;AAEA,OAAO,SAASI,4BAA4B,EAC1CC,IAAI,EACJL,WAAW,EACXM,cAAc,EACf;IACC,MAAM,CAACC,SAASC,WAAW,GAAGZ,SAAS;IACvCF,UAAU;QACRe,WAAW;YACTD,WAAW;QACb,GAAG;IACL,GAAG,EAAE;IACL,MAAME,cAAcf,OAAOI,oBAAoBC;IAC/C,IAAI,CAACO,WAAW,OAAON,WAAW,aAAa,OAAO;IACtD,IAAI,CAACS,YAAYC,OAAO,EAAE;QACxBD,YAAYC,OAAO,GAAGZ,oBAAoBC;IAC5C;IACA,IAAIY,oBACFF,YAAYC,OAAO,EAAEE,yBAAyBC,MAAMb,OAAOc,OAAO,IAClEd,OAAOe,WAAW;IAEpB,qBACE;kBACGX,KAAKY,OAAO,CACVC,MAAM,CAAC,CAACD,UAAYA,SAASE,OAAO,CAAC,UAAU,EAC/CD,MAAM,CAAC,CAACD,UAAYA,SAASE,OAAOC,MACpCC,GAAG,CAAC,CAACJ;YACJ,MAAMK,KAAKpB,UAAUqB,cACnB,CAAC,UAAU,EAAEN,QAAQE,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC;YAE3C,MAAMK,sBAAsBF,GAAGT,qBAAqB,GAAGC,GAAG;YAC1D,MAAMW,cAAcD,sBAAsBvB,OAAOc,OAAO;YAExD,MAAMW,kBAAkBd;YAExB,MAAMe,YAAYC,KAAKC,GAAG,CACxB,GACAJ,cAAcC,kBAAkB5B,SAAS;YAE3Cc,oBAAoBa,cAAc3B;YAElC,qBACE,KAACgC;gBAECC,WAAU;gBACVC,OAAO;oBAAEL;gBAAU;0BAElB9B,mBAAmBoB,SAASX;eAJxB,CAAC,sBAAsB,EAAEW,QAAQE,KAAK,CAAC,UAAU,CAAC,CAAC,EAAEF,QAAQE,KAAK,CAACc,GAAG,EAAE;QAOnF;;AAGR"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const renderEmbedContent: (content: any) => import("react").JSX.Element;
|
|
1
|
+
export declare const renderEmbedContent: (content: any, getVideoAspect: any) => import("react").JSX.Element;
|
|
2
2
|
//# sourceMappingURL=RenderEmbedClientSide.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RenderEmbedClientSide.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/serverside/RenderEmbedClientSide.tsx"],"names":[],"mappings":"AAiBA,eAAO,MAAM,kBAAkB
|
|
1
|
+
{"version":3,"file":"RenderEmbedClientSide.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/serverside/RenderEmbedClientSide.tsx"],"names":[],"mappings":"AAiBA,eAAO,MAAM,kBAAkB,oEAyF9B,CAAC"}
|