payload-richtext-tiptap 0.0.134 → 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 +1 -1
- package/dist/src/fields/TiptapEditor/extensions/ImageUpload/getImageActualSize.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/ImageUpload/getImageActualSize.js +5 -1
- package/dist/src/fields/TiptapEditor/extensions/ImageUpload/getImageActualSize.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/ImageUpload/view/ImageUpload.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/ImageUpload/view/ImageUpload.js +6 -3
- package/dist/src/fields/TiptapEditor/extensions/ImageUpload/view/ImageUpload.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/VideoBlock.d.ts +4 -0
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/VideoBlock.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/VideoBlock.js +21 -3
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/VideoBlock.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/extension-kit.js +2 -2
- package/dist/src/fields/TiptapEditor/extensions/extension-kit.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
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"}
|
|
@@ -4,7 +4,7 @@ import History from "@tiptap/extension-history";
|
|
|
4
4
|
import { Markdown } from "tiptap-markdown";
|
|
5
5
|
import API from "../lib/api.js";
|
|
6
6
|
import i18next from "i18next";
|
|
7
|
-
import {
|
|
7
|
+
import { getAssetActualSize } from "./ImageUpload/getImageActualSize.js";
|
|
8
8
|
export const ExtensionKit = ({ dir = "ltr", openAssetHQHandler })=>[
|
|
9
9
|
Markdown,
|
|
10
10
|
Document,
|
|
@@ -67,7 +67,7 @@ export const ExtensionKit = ({ dir = "ltr", openAssetHQHandler })=>[
|
|
|
67
67
|
if (i18next.language !== "en" && !!asset.title_locale[i18next.language.toUpperCase()]) {
|
|
68
68
|
title = asset.title_locale[i18next.language.toUpperCase()];
|
|
69
69
|
}
|
|
70
|
-
const { actualHeight, actualWidth } =
|
|
70
|
+
const { actualHeight, actualWidth } = getAssetActualSize(asset);
|
|
71
71
|
currentEditor.chain().setImageBlockAt({
|
|
72
72
|
pos,
|
|
73
73
|
src: asset?.optimizedImageUrl || asset.fullUrl,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/fields/TiptapEditor/extensions/extension-kit.ts"],"sourcesContent":["import {\n AICommand,\n AudioBlock,\n BlockquoteFigure,\n CharacterCount,\n Color,\n Document,\n Dropcursor,\n Facebook,\n Figcaption,\n FileHandler,\n Focus,\n FontFamily,\n FontSize,\n Heading,\n Highlight,\n HorizontalRule,\n LinkPreview,\n ImageBlock,\n InsideLinks,\n Instagram,\n Link,\n Linkedin,\n Placeholder,\n Selection,\n SlashCommand,\n StarterKit,\n Subscript,\n Superscript,\n TaskItem,\n TaskList,\n TextAlign,\n TextStyle,\n Tiktok,\n TrailingNode,\n Twitter,\n Typography,\n Underline,\n VideoBlock,\n Youtube,\n Iframe,\n BulletList,\n} from \"./index.js\";\n\nimport { ImageUpload } from \"./ImageUpload/ImageUpload.js\";\n\nimport History from \"@tiptap/extension-history\";\nimport { Markdown } from \"tiptap-markdown\";\nimport API from \"../lib/api.js\";\nimport { openAssetHQType } from \"../types.js\";\nimport i18next from \"i18next\";\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../../src/fields/TiptapEditor/extensions/extension-kit.ts"],"sourcesContent":["import {\n AICommand,\n AudioBlock,\n BlockquoteFigure,\n CharacterCount,\n Color,\n Document,\n Dropcursor,\n Facebook,\n Figcaption,\n FileHandler,\n Focus,\n FontFamily,\n FontSize,\n Heading,\n Highlight,\n HorizontalRule,\n LinkPreview,\n ImageBlock,\n InsideLinks,\n Instagram,\n Link,\n Linkedin,\n Placeholder,\n Selection,\n SlashCommand,\n StarterKit,\n Subscript,\n Superscript,\n TaskItem,\n TaskList,\n TextAlign,\n TextStyle,\n Tiktok,\n TrailingNode,\n Twitter,\n Typography,\n Underline,\n VideoBlock,\n Youtube,\n Iframe,\n BulletList,\n} from \"./index.js\";\n\nimport { ImageUpload } from \"./ImageUpload/ImageUpload.js\";\n\nimport History from \"@tiptap/extension-history\";\nimport { Markdown } from \"tiptap-markdown\";\nimport API from \"../lib/api.js\";\nimport { openAssetHQType } from \"../types.js\";\nimport i18next from \"i18next\";\nimport { getAssetActualSize } from \"./ImageUpload/getImageActualSize.js\";\n\ninterface ExtensionKitProps {\n openAssetHQHandler: openAssetHQType;\n dir?: \"ltr\" | \"rtl\";\n}\n\nexport const ExtensionKit = ({\n dir = \"ltr\",\n openAssetHQHandler,\n}: ExtensionKitProps) => [\n Markdown,\n Document,\n TaskList,\n TaskItem.configure({\n nested: true,\n }),\n Selection,\n Heading.configure({\n levels: [1, 2, 3, 4, 5, 6],\n }),\n HorizontalRule,\n StarterKit.configure({\n document: false,\n dropcursor: false,\n heading: false,\n horizontalRule: false,\n blockquote: false,\n history: false,\n codeBlock: false,\n }),\n TextStyle,\n // FontSize,\n // FontFamily,\n // Color,\n TrailingNode,\n Link.configure({\n openOnClick: false,\n }),\n // Highlight.configure({ multicolor: true }),\n Underline,\n CharacterCount.configure({ limit: 50000 }),\n ImageUpload.configure({\n openAssetHQHandler,\n }),\n ImageBlock,\n VideoBlock,\n AudioBlock,\n FileHandler.configure({\n allowedMimeTypes: [\"image/png\", \"image/jpeg\", \"image/gif\", \"image/webp\"],\n onDrop: (currentEditor, files, pos) => {\n const file = files[0];\n (async () => {\n openAssetHQHandler(\n (asset) => {\n let title = asset.title;\n if (\n i18next.language !== \"en\" &&\n !!asset.title_locale[i18next.language.toUpperCase()]\n ) {\n title = asset.title_locale[i18next.language.toUpperCase()];\n }\n const { actualHeight, actualWidth } = getAssetActualSize(asset);\n currentEditor\n .chain()\n .setImageBlockAt({\n pos,\n src: asset?.optimizedImageUrl || asset.fullUrl,\n caption: title,\n actualHeight,\n actualWidth,\n })\n .focus()\n .run();\n },\n file,\n \"image\"\n );\n })();\n },\n onPaste: (currentEditor, files) => {\n files.forEach(async () => {\n const url = await API.uploadImage();\n\n return currentEditor\n .chain()\n .setImageBlockAt({\n pos: currentEditor.state.selection.anchor,\n src: url,\n })\n .focus()\n .run();\n });\n },\n }),\n // Emoji.configure({\n // enableEmoticons: true,\n // suggestion: emojiSuggestion,\n // }),\n TextAlign.extend({\n addKeyboardShortcuts() {\n return {};\n },\n }).configure({\n defaultAlignment: dir === \"rtl\" ? \"right\" : \"left\",\n types: [\"heading\", \"paragraph\"],\n }),\n Subscript,\n Superscript,\n Typography,\n Placeholder.configure({\n includeChildren: true,\n showOnlyCurrent: false,\n placeholder: () => \"\",\n }),\n SlashCommand,\n Focus,\n Figcaption,\n BlockquoteFigure,\n Dropcursor.configure({\n width: 2,\n class: \"ProseMirror-dropcursor border-black\",\n }),\n History,\n Twitter,\n Tiktok,\n Instagram,\n Facebook,\n Linkedin,\n Youtube,\n InsideLinks,\n Iframe,\n AICommand,\n LinkPreview,\n BulletList,\n];\n\nexport default ExtensionKit;\n"],"names":["AICommand","AudioBlock","BlockquoteFigure","CharacterCount","Document","Dropcursor","Facebook","Figcaption","FileHandler","Focus","Heading","HorizontalRule","LinkPreview","ImageBlock","InsideLinks","Instagram","Link","Linkedin","Placeholder","Selection","SlashCommand","StarterKit","Subscript","Superscript","TaskItem","TaskList","TextAlign","TextStyle","Tiktok","TrailingNode","Twitter","Typography","Underline","VideoBlock","Youtube","Iframe","BulletList","ImageUpload","History","Markdown","API","i18next","getAssetActualSize","ExtensionKit","dir","openAssetHQHandler","configure","nested","levels","document","dropcursor","heading","horizontalRule","blockquote","history","codeBlock","openOnClick","limit","allowedMimeTypes","onDrop","currentEditor","files","pos","file","asset","title","language","title_locale","toUpperCase","actualHeight","actualWidth","chain","setImageBlockAt","src","optimizedImageUrl","fullUrl","caption","focus","run","onPaste","forEach","url","uploadImage","state","selection","anchor","extend","addKeyboardShortcuts","defaultAlignment","types","includeChildren","showOnlyCurrent","placeholder","width","class"],"mappings":"AAAA,SACEA,SAAS,EACTC,UAAU,EACVC,gBAAgB,EAChBC,cAAc,EAEdC,QAAQ,EACRC,UAAU,EACVC,QAAQ,EACRC,UAAU,EACVC,WAAW,EACXC,KAAK,EAGLC,OAAO,EAEPC,cAAc,EACdC,WAAW,EACXC,UAAU,EACVC,WAAW,EACXC,SAAS,EACTC,IAAI,EACJC,QAAQ,EACRC,WAAW,EACXC,SAAS,EACTC,YAAY,EACZC,UAAU,EACVC,SAAS,EACTC,WAAW,EACXC,QAAQ,EACRC,QAAQ,EACRC,SAAS,EACTC,SAAS,EACTC,MAAM,EACNC,YAAY,EACZC,OAAO,EACPC,UAAU,EACVC,SAAS,EACTC,UAAU,EACVC,OAAO,EACPC,MAAM,EACNC,UAAU,QACL,aAAa;AAEpB,SAASC,WAAW,QAAQ,+BAA+B;AAE3D,OAAOC,aAAa,4BAA4B;AAChD,SAASC,QAAQ,QAAQ,kBAAkB;AAC3C,OAAOC,SAAS,gBAAgB;AAEhC,OAAOC,aAAa,UAAU;AAC9B,SAASC,kBAAkB,QAAQ,sCAAsC;AAOzE,OAAO,MAAMC,eAAe,CAAC,EAC3BC,MAAM,KAAK,EACXC,kBAAkB,EACA,GAAK;QACvBN;QACAnC;QACAqB;QACAD,SAASsB,SAAS,CAAC;YACjBC,QAAQ;QACV;QACA5B;QACAT,QAAQoC,SAAS,CAAC;YAChBE,QAAQ;gBAAC;gBAAG;gBAAG;gBAAG;gBAAG;gBAAG;aAAE;QAC5B;QACArC;QACAU,WAAWyB,SAAS,CAAC;YACnBG,UAAU;YACVC,YAAY;YACZC,SAAS;YACTC,gBAAgB;YAChBC,YAAY;YACZC,SAAS;YACTC,WAAW;QACb;QACA5B;QACA,YAAY;QACZ,cAAc;QACd,SAAS;QACTE;QACAb,KAAK8B,SAAS,CAAC;YACbU,aAAa;QACf;QACA,6CAA6C;QAC7CxB;QACA7B,eAAe2C,SAAS,CAAC;YAAEW,OAAO;QAAM;QACxCpB,YAAYS,SAAS,CAAC;YACpBD;QACF;QACAhC;QACAoB;QACAhC;QACAO,YAAYsC,SAAS,CAAC;YACpBY,kBAAkB;gBAAC;gBAAa;gBAAc;gBAAa;aAAa;YACxEC,QAAQ,CAACC,eAAeC,OAAOC;gBAC7B,MAAMC,OAAOF,KAAK,CAAC,EAAE;gBACpB,CAAA;oBACChB,mBACE,CAACmB;wBACC,IAAIC,QAAQD,MAAMC,KAAK;wBACvB,IACExB,QAAQyB,QAAQ,KAAK,QACrB,CAAC,CAACF,MAAMG,YAAY,CAAC1B,QAAQyB,QAAQ,CAACE,WAAW,GAAG,EACpD;4BACAH,QAAQD,MAAMG,YAAY,CAAC1B,QAAQyB,QAAQ,CAACE,WAAW,GAAG;wBAC5D;wBACA,MAAM,EAAEC,YAAY,EAAEC,WAAW,EAAE,GAAG5B,mBAAmBsB;wBACzDJ,cACGW,KAAK,GACLC,eAAe,CAAC;4BACfV;4BACAW,KAAKT,OAAOU,qBAAqBV,MAAMW,OAAO;4BAC9CC,SAASX;4BACTI;4BACAC;wBACF,GACCO,KAAK,GACLC,GAAG;oBACR,GACAf,MACA;gBAEJ,CAAA;YACF;YACAgB,SAAS,CAACnB,eAAeC;gBACvBA,MAAMmB,OAAO,CAAC;oBACZ,MAAMC,MAAM,MAAMzC,IAAI0C,WAAW;oBAEjC,OAAOtB,cACJW,KAAK,GACLC,eAAe,CAAC;wBACfV,KAAKF,cAAcuB,KAAK,CAACC,SAAS,CAACC,MAAM;wBACzCZ,KAAKQ;oBACP,GACCJ,KAAK,GACLC,GAAG;gBACR;YACF;QACF;QACA,oBAAoB;QACpB,2BAA2B;QAC3B,iCAAiC;QACjC,MAAM;QACNpD,UAAU4D,MAAM,CAAC;YACfC;gBACE,OAAO,CAAC;YACV;QACF,GAAGzC,SAAS,CAAC;YACX0C,kBAAkB5C,QAAQ,QAAQ,UAAU;YAC5C6C,OAAO;gBAAC;gBAAW;aAAY;QACjC;QACAnE;QACAC;QACAQ;QACAb,YAAY4B,SAAS,CAAC;YACpB4C,iBAAiB;YACjBC,iBAAiB;YACjBC,aAAa,IAAM;QACrB;QACAxE;QACAX;QACAF;QACAL;QACAG,WAAWyC,SAAS,CAAC;YACnB+C,OAAO;YACPC,OAAO;QACT;QACAxD;QACAR;QACAF;QACAb;QACAT;QACAW;QACAiB;QACApB;QACAqB;QACAnC;QACAY;QACAwB;KACD,CAAC;AAEF,eAAeO,aAAa"}
|
|
@@ -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"}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
2
|
-
import Image from "next/image.js";
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
2
|
import { FacebookEmbed, InstagramEmbed, LinkedInEmbed, TikTokEmbed, XEmbed, YouTubeEmbed } from "react-social-media-embed";
|
|
4
|
-
import { cn } from "../../lib/utils/index.js";
|
|
5
3
|
import VideoBlockViewClientside from "../VideoBlock/components/VideoBlockViewClientside.js";
|
|
6
4
|
import { SocialMediaEmbedServerside } from "../SocialMedia/SocialMediaEmbedServerside.js";
|
|
7
5
|
import InsideLinksComponent from "../InsideLinks/InsideLinksComponent.js";
|
|
6
|
+
import { ImageBlockViewClientside } from "../ImageBlock/components/ImageBlockViewClientside.js";
|
|
8
7
|
function checkIfValidLink(link) {
|
|
9
8
|
return typeof link === "string";
|
|
10
9
|
}
|
|
11
|
-
export const renderEmbedContent = (content)=>{
|
|
10
|
+
export const renderEmbedContent = (content, getVideoAspect)=>{
|
|
12
11
|
switch(content.type){
|
|
13
12
|
case "twitter":
|
|
14
13
|
if (!checkIfValidLink(content.attrs.url)) {
|
|
@@ -53,35 +52,14 @@ export const renderEmbedContent = (content)=>{
|
|
|
53
52
|
})
|
|
54
53
|
});
|
|
55
54
|
case "imageBlock":
|
|
56
|
-
return /*#__PURE__*/
|
|
57
|
-
|
|
58
|
-
/*#__PURE__*/ _jsx("div", {
|
|
59
|
-
className: cn("relative object-cover", {
|
|
60
|
-
"aspect-video": !content.attrs.height
|
|
61
|
-
}),
|
|
62
|
-
style: {
|
|
63
|
-
width: content.attrs.width || "100%",
|
|
64
|
-
...content.attrs.height ? {
|
|
65
|
-
height: content.attrs.height
|
|
66
|
-
} : {}
|
|
67
|
-
},
|
|
68
|
-
children: /*#__PURE__*/ _jsx(Image, {
|
|
69
|
-
className: "rounded object-cover",
|
|
70
|
-
src: content.attrs.src,
|
|
71
|
-
alt: content.attrs.alt || content.attrs.caption,
|
|
72
|
-
fill: true
|
|
73
|
-
})
|
|
74
|
-
}),
|
|
75
|
-
content.attrs?.caption ? /*#__PURE__*/ _jsx("p", {
|
|
76
|
-
className: cn("tiptap-image-caption", "pt-2 font-sf text-sm font-light text-grey-7 mx-6 sm:mx-0 line-clamp-2"),
|
|
77
|
-
children: content.attrs?.caption
|
|
78
|
-
}) : null
|
|
79
|
-
]
|
|
55
|
+
return /*#__PURE__*/ _jsx(ImageBlockViewClientside, {
|
|
56
|
+
content: content
|
|
80
57
|
});
|
|
81
58
|
case "videoBlock":
|
|
82
59
|
// @ts-ignore
|
|
83
60
|
return /*#__PURE__*/ _jsx(VideoBlockViewClientside, {
|
|
84
|
-
node: content
|
|
61
|
+
node: content,
|
|
62
|
+
getVideoAspect: getVideoAspect
|
|
85
63
|
});
|
|
86
64
|
case "facebook":
|
|
87
65
|
return /*#__PURE__*/ _jsx(SocialMediaEmbedServerside, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/serverside/RenderEmbedClientSide.tsx"],"sourcesContent":["import Image from \"next/image.js\";\nimport {\n FacebookEmbed,\n InstagramEmbed,\n LinkedInEmbed,\n TikTokEmbed,\n XEmbed,\n YouTubeEmbed,\n} from \"react-social-media-embed\";\nimport
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/serverside/RenderEmbedClientSide.tsx"],"sourcesContent":["import Image from \"next/image.js\";\nimport {\n FacebookEmbed,\n InstagramEmbed,\n LinkedInEmbed,\n TikTokEmbed,\n XEmbed,\n YouTubeEmbed,\n} from \"react-social-media-embed\";\nimport VideoBlockViewClientside from \"../VideoBlock/components/VideoBlockViewClientside.js\";\nimport { SocialMediaEmbedServerside } from \"../SocialMedia/SocialMediaEmbedServerside.js\";\nimport InsideLinksComponent from \"../InsideLinks/InsideLinksComponent.js\";\nimport { ImageBlockViewClientside } from \"../ImageBlock/components/ImageBlockViewClientside.js\";\n\nfunction checkIfValidLink(link: string) {\n return typeof link === \"string\";\n}\nexport const renderEmbedContent = (content, getVideoAspect) => {\n switch (content.type) {\n case \"twitter\":\n if (!checkIfValidLink(content.attrs.url)) {\n return null;\n }\n return (\n <SocialMediaEmbedServerside>\n <XEmbed url={content.attrs.url || \"\"} width={325} />\n </SocialMediaEmbedServerside>\n );\n case \"youtube\":\n if (!checkIfValidLink(content.attrs.url)) {\n return null;\n }\n return (\n <SocialMediaEmbedServerside>\n <YouTubeEmbed url={content.attrs.url || \"\"} />\n </SocialMediaEmbedServerside>\n );\n case \"instagram\":\n if (!checkIfValidLink(content.attrs.url)) {\n return null;\n }\n return (\n <SocialMediaEmbedServerside>\n <InstagramEmbed\n className=\"max-w-[328px]\"\n url={content.attrs.url || \"\"}\n width={328}\n captioned\n />\n </SocialMediaEmbedServerside>\n );\n case \"tiktok\":\n if (!checkIfValidLink(content.attrs.url)) {\n return null;\n }\n return (\n <SocialMediaEmbedServerside>\n <TikTokEmbed\n className=\"max-w-[328px]\"\n url={content.attrs.url || \"\"}\n width={328}\n />\n </SocialMediaEmbedServerside>\n );\n case \"imageBlock\":\n return <ImageBlockViewClientside content={content} />;\n case \"videoBlock\":\n // @ts-ignore\n return (\n <VideoBlockViewClientside\n node={content}\n getVideoAspect={getVideoAspect}\n />\n );\n case \"facebook\":\n return (\n <SocialMediaEmbedServerside>\n <FacebookEmbed url={content.attrs.url || \"\"} width={550} />\n </SocialMediaEmbedServerside>\n );\n case \"linkedin\":\n if (!checkIfValidLink(content.attrs.url)) {\n return null;\n }\n return (\n <SocialMediaEmbedServerside>\n <LinkedInEmbed\n url={content.attrs.url || \"\"}\n width={325}\n height={570}\n />\n </SocialMediaEmbedServerside>\n );\n case \"insideLinks\":\n return <InsideLinksComponent {...content} />;\n case \"iframe\":\n return (\n <SocialMediaEmbedServerside>\n <div className=\"iframe-wrapper\">\n <iframe src={content?.attrs?.src ?? \"\"} allowFullScreen={true} />\n </div>\n </SocialMediaEmbedServerside>\n );\n default:\n return null;\n }\n};\n"],"names":["FacebookEmbed","InstagramEmbed","LinkedInEmbed","TikTokEmbed","XEmbed","YouTubeEmbed","VideoBlockViewClientside","SocialMediaEmbedServerside","InsideLinksComponent","ImageBlockViewClientside","checkIfValidLink","link","renderEmbedContent","content","getVideoAspect","type","attrs","url","width","className","captioned","node","height","div","iframe","src","allowFullScreen"],"mappings":";AACA,SACEA,aAAa,EACbC,cAAc,EACdC,aAAa,EACbC,WAAW,EACXC,MAAM,EACNC,YAAY,QACP,2BAA2B;AAClC,OAAOC,8BAA8B,uDAAuD;AAC5F,SAASC,0BAA0B,QAAQ,+CAA+C;AAC1F,OAAOC,0BAA0B,yCAAyC;AAC1E,SAASC,wBAAwB,QAAQ,uDAAuD;AAEhG,SAASC,iBAAiBC,IAAY;IACpC,OAAO,OAAOA,SAAS;AACzB;AACA,OAAO,MAAMC,qBAAqB,CAACC,SAASC;IAC1C,OAAQD,QAAQE,IAAI;QAClB,KAAK;YACH,IAAI,CAACL,iBAAiBG,QAAQG,KAAK,CAACC,GAAG,GAAG;gBACxC,OAAO;YACT;YACA,qBACE,KAACV;0BACC,cAAA,KAACH;oBAAOa,KAAKJ,QAAQG,KAAK,CAACC,GAAG,IAAI;oBAAIC,OAAO;;;QAGnD,KAAK;YACH,IAAI,CAACR,iBAAiBG,QAAQG,KAAK,CAACC,GAAG,GAAG;gBACxC,OAAO;YACT;YACA,qBACE,KAACV;0BACC,cAAA,KAACF;oBAAaY,KAAKJ,QAAQG,KAAK,CAACC,GAAG,IAAI;;;QAG9C,KAAK;YACH,IAAI,CAACP,iBAAiBG,QAAQG,KAAK,CAACC,GAAG,GAAG;gBACxC,OAAO;YACT;YACA,qBACE,KAACV;0BACC,cAAA,KAACN;oBACCkB,WAAU;oBACVF,KAAKJ,QAAQG,KAAK,CAACC,GAAG,IAAI;oBAC1BC,OAAO;oBACPE,SAAS;;;QAIjB,KAAK;YACH,IAAI,CAACV,iBAAiBG,QAAQG,KAAK,CAACC,GAAG,GAAG;gBACxC,OAAO;YACT;YACA,qBACE,KAACV;0BACC,cAAA,KAACJ;oBACCgB,WAAU;oBACVF,KAAKJ,QAAQG,KAAK,CAACC,GAAG,IAAI;oBAC1BC,OAAO;;;QAIf,KAAK;YACH,qBAAO,KAACT;gBAAyBI,SAASA;;QAC5C,KAAK;YACH,aAAa;YACb,qBACE,KAACP;gBACCe,MAAMR;gBACNC,gBAAgBA;;QAGtB,KAAK;YACH,qBACE,KAACP;0BACC,cAAA,KAACP;oBAAciB,KAAKJ,QAAQG,KAAK,CAACC,GAAG,IAAI;oBAAIC,OAAO;;;QAG1D,KAAK;YACH,IAAI,CAACR,iBAAiBG,QAAQG,KAAK,CAACC,GAAG,GAAG;gBACxC,OAAO;YACT;YACA,qBACE,KAACV;0BACC,cAAA,KAACL;oBACCe,KAAKJ,QAAQG,KAAK,CAACC,GAAG,IAAI;oBAC1BC,OAAO;oBACPI,QAAQ;;;QAIhB,KAAK;YACH,qBAAO,KAACd;gBAAsB,GAAGK,OAAO;;QAC1C,KAAK;YACH,qBACE,KAACN;0BACC,cAAA,KAACgB;oBAAIJ,WAAU;8BACb,cAAA,KAACK;wBAAOC,KAAKZ,SAASG,OAAOS,OAAO;wBAAIC,iBAAiB;;;;QAIjE;YACE,OAAO;IACX;AACF,EAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getAssetsAspectRatio.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/serverside/getAssetsAspectRatio.ts"],"names":[],"mappings":"AAEA,wBAAgB,uBAAuB;;;EA6BtC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useCallback, useState } from "react";
|
|
2
|
+
export function useGetAssetsAspectRatio() {
|
|
3
|
+
const [aspectRatio, setAspectRatio] = useState("");
|
|
4
|
+
const [loading, setLoading] = useState(false);
|
|
5
|
+
const calculateAspectRatio = useCallback(async (attrs, type, getVideoAspect)=>{
|
|
6
|
+
if (loading) return;
|
|
7
|
+
setLoading(true);
|
|
8
|
+
const { src, actualWidth, actualHeight } = attrs;
|
|
9
|
+
if (actualWidth && actualHeight) {
|
|
10
|
+
setAspectRatio(`${actualWidth} / ${actualHeight}`);
|
|
11
|
+
setLoading(false);
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
if (type === "VIDEO" && getVideoAspect) {
|
|
15
|
+
const metadata = await getVideoAspect(src);
|
|
16
|
+
if (metadata.width && metadata.height) {
|
|
17
|
+
setAspectRatio(`${metadata.width} / ${metadata.height}`);
|
|
18
|
+
}
|
|
19
|
+
setLoading(false);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
}, [
|
|
23
|
+
loading
|
|
24
|
+
]);
|
|
25
|
+
return {
|
|
26
|
+
aspectRatio,
|
|
27
|
+
calculateAspectRatio
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=getAssetsAspectRatio.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/serverside/getAssetsAspectRatio.ts"],"sourcesContent":["import { useCallback, useEffect, useState } from \"react\";\n\nexport function useGetAssetsAspectRatio() {\n const [aspectRatio, setAspectRatio] = useState(\"\");\n const [loading, setLoading] = useState(false);\n const calculateAspectRatio = useCallback(\n async (attrs, type, getVideoAspect) => {\n if (loading) return;\n setLoading(true);\n\n const { src, actualWidth, actualHeight } = attrs;\n if (actualWidth && actualHeight) {\n setAspectRatio(`${actualWidth} / ${actualHeight}`);\n setLoading(false);\n return;\n }\n\n if (type === \"VIDEO\" && getVideoAspect) {\n const metadata = await getVideoAspect(src);\n\n if (metadata.width && metadata.height) {\n setAspectRatio(`${metadata.width} / ${metadata.height}`);\n }\n setLoading(false);\n return;\n }\n },\n [loading]\n );\n\n return { aspectRatio, calculateAspectRatio };\n}\n"],"names":["useCallback","useState","useGetAssetsAspectRatio","aspectRatio","setAspectRatio","loading","setLoading","calculateAspectRatio","attrs","type","getVideoAspect","src","actualWidth","actualHeight","metadata","width","height"],"mappings":"AAAA,SAASA,WAAW,EAAaC,QAAQ,QAAQ,QAAQ;AAEzD,OAAO,SAASC;IACd,MAAM,CAACC,aAAaC,eAAe,GAAGH,SAAS;IAC/C,MAAM,CAACI,SAASC,WAAW,GAAGL,SAAS;IACvC,MAAMM,uBAAuBP,YAC3B,OAAOQ,OAAOC,MAAMC;QAClB,IAAIL,SAAS;QACbC,WAAW;QAEX,MAAM,EAAEK,GAAG,EAAEC,WAAW,EAAEC,YAAY,EAAE,GAAGL;QAC3C,IAAII,eAAeC,cAAc;YAC/BT,eAAe,GAAGQ,YAAY,GAAG,EAAEC,cAAc;YACjDP,WAAW;YACX;QACF;QAEA,IAAIG,SAAS,WAAWC,gBAAgB;YACtC,MAAMI,WAAW,MAAMJ,eAAeC;YAEtC,IAAIG,SAASC,KAAK,IAAID,SAASE,MAAM,EAAE;gBACrCZ,eAAe,GAAGU,SAASC,KAAK,CAAC,GAAG,EAAED,SAASE,MAAM,EAAE;YACzD;YACAV,WAAW;YACX;QACF;IACF,GACA;QAACD;KAAQ;IAGX,OAAO;QAAEF;QAAaI;IAAqB;AAC7C"}
|