payload-richtext-tiptap 0.0.84 → 0.0.85

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.
@@ -1 +1 @@
1
- {"version":3,"file":"SocialMediaEmbedServerside.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/SocialMedia/SocialMediaEmbedServerside.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,0BAA0B,4BAA6B,GAAG,gCAetE,CAAC"}
1
+ {"version":3,"file":"SocialMediaEmbedServerside.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/SocialMedia/SocialMediaEmbedServerside.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,0BAA0B,4BAA6B,GAAG,gCActE,CAAC"}
@@ -1,11 +1,9 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { NodeViewContent, NodeViewWrapper } from "@tiptap/react";
3
2
  import { cn } from "../../lib/utils/index.js";
4
3
  export const SocialMediaEmbedServerside = ({ children, className })=>{
5
- return /*#__PURE__*/ _jsx(NodeViewWrapper, {
4
+ return /*#__PURE__*/ _jsx("div", {
6
5
  className: cn("react-component", className),
7
- children: /*#__PURE__*/ _jsx(NodeViewContent, {
8
- contentEditable: "false",
6
+ children: /*#__PURE__*/ _jsx("div", {
9
7
  className: "socialMediaContainer",
10
8
  children: /*#__PURE__*/ _jsx("div", {
11
9
  style: {
@@ -14,7 +12,6 @@ export const SocialMediaEmbedServerside = ({ children, className })=>{
14
12
  },
15
13
  draggable: "true",
16
14
  "data-drag-handle": "",
17
- contentEditable: "false",
18
15
  children: children
19
16
  })
20
17
  })
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/SocialMedia/SocialMediaEmbedServerside.tsx"],"sourcesContent":["import { NodeViewContent, NodeViewWrapper } from \"@tiptap/react\";\nimport { cn } from \"../../lib/utils/index.js\";\n\nexport const SocialMediaEmbedServerside = ({ children, className }: any) => {\n return (\n <NodeViewWrapper className={cn(\"react-component\", className)}>\n <NodeViewContent contentEditable=\"false\" className=\"socialMediaContainer\">\n <div\n style={{ display: \"flex\", justifyContent: \"center\" }}\n draggable=\"true\"\n data-drag-handle=\"\"\n contentEditable=\"false\"\n >\n {children}\n </div>\n </NodeViewContent>\n </NodeViewWrapper>\n );\n};\n"],"names":["NodeViewContent","NodeViewWrapper","cn","SocialMediaEmbedServerside","children","className","contentEditable","div","style","display","justifyContent","draggable","data-drag-handle"],"mappings":";AAAA,SAASA,eAAe,EAAEC,eAAe,QAAQ,gBAAgB;AACjE,SAASC,EAAE,QAAQ,2BAA2B;AAE9C,OAAO,MAAMC,6BAA6B,CAAC,EAAEC,QAAQ,EAAEC,SAAS,EAAO;IACrE,qBACE,KAACJ;QAAgBI,WAAWH,GAAG,mBAAmBG;kBAChD,cAAA,KAACL;YAAgBM,iBAAgB;YAAQD,WAAU;sBACjD,cAAA,KAACE;gBACCC,OAAO;oBAAEC,SAAS;oBAAQC,gBAAgB;gBAAS;gBACnDC,WAAU;gBACVC,oBAAiB;gBACjBN,iBAAgB;0BAEfF;;;;AAKX,EAAE"}
1
+ {"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/SocialMedia/SocialMediaEmbedServerside.tsx"],"sourcesContent":["import { cn } from \"../../lib/utils/index.js\";\n\nexport const SocialMediaEmbedServerside = ({ children, className }: any) => {\n return (\n <div className={cn(\"react-component\", className)}>\n <div className=\"socialMediaContainer\">\n <div\n style={{ display: \"flex\", justifyContent: \"center\" }}\n draggable=\"true\"\n data-drag-handle=\"\"\n >\n {children}\n </div>\n </div>\n </div>\n );\n};\n"],"names":["cn","SocialMediaEmbedServerside","children","className","div","style","display","justifyContent","draggable","data-drag-handle"],"mappings":";AAAA,SAASA,EAAE,QAAQ,2BAA2B;AAE9C,OAAO,MAAMC,6BAA6B,CAAC,EAAEC,QAAQ,EAAEC,SAAS,EAAO;IACrE,qBACE,KAACC;QAAID,WAAWH,GAAG,mBAAmBG;kBACpC,cAAA,KAACC;YAAID,WAAU;sBACb,cAAA,KAACC;gBACCC,OAAO;oBAAEC,SAAS;oBAAQC,gBAAgB;gBAAS;gBACnDC,WAAU;gBACVC,oBAAiB;0BAEhBP;;;;AAKX,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"file":"ContentEmbedSupport.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/serverside/ContentEmbedSupport.tsx"],"names":[],"mappings":"AAoBA,wBAAgB,mBAAmB,CAAC,EAAE,IAAI,EAAE;;CAAA,+BAuH3C"}
1
+ {"version":3,"file":"ContentEmbedSupport.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/serverside/ContentEmbedSupport.tsx"],"names":[],"mappings":"AAoBA,wBAAgB,mBAAmB,CAAC,EAAE,IAAI,EAAE;;CAAA,+BAyH3C"}
@@ -2,7 +2,7 @@
2
2
  import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { Portal } from "@radix-ui/react-portal";
4
4
  import Image from "next/image.js";
5
- import { useLayoutEffect, useState } from "react";
5
+ import { useEffect, useState } from "react";
6
6
  import { FacebookEmbed, InstagramEmbed, LinkedInEmbed, TikTokEmbed, XEmbed, YouTubeEmbed } from "react-social-media-embed";
7
7
  import { cn } from "../../lib/utils/index.js";
8
8
  import VideoBlockViewClientside from "../VideoBlock/components/VideoBlockViewClientside.js";
@@ -12,8 +12,10 @@ function checkIfValidLink(link) {
12
12
  }
13
13
  export function ContentEmbedSupport({ body }) {
14
14
  const [mounted, setMounted] = useState(false);
15
- useLayoutEffect(()=>{
16
- setMounted(true);
15
+ useEffect(()=>{
16
+ setTimeout(()=>{
17
+ setMounted(true);
18
+ }, 100);
17
19
  }, []);
18
20
  const renderContent = (content)=>{
19
21
  switch(content.type){
@@ -112,7 +114,7 @@ export function ContentEmbedSupport({ body }) {
112
114
  return /*#__PURE__*/ _jsx(Portal, {
113
115
  container: document?.querySelector(`[data-id='${content.attrs["data-id"]}']`),
114
116
  children: renderContent(content)
115
- }, `embed-content-${content.attrs["data-id"]}`);
117
+ }, `embed-content-${content.attrs["data-id"]}-${content.attrs.key}`);
116
118
  })
117
119
  });
118
120
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/serverside/ContentEmbedSupport.tsx"],"sourcesContent":["\"use client\";\n\nimport { Portal } from \"@radix-ui/react-portal\";\nimport Image from \"next/image.js\";\nimport { useLayoutEffect, useState } from \"react\";\nimport {\n FacebookEmbed,\n InstagramEmbed,\n LinkedInEmbed,\n TikTokEmbed,\n XEmbed,\n YouTubeEmbed,\n} from \"react-social-media-embed\";\nimport { cn } from \"../../lib/utils/index.js\";\nimport VideoBlockViewClientside from \"../VideoBlock/components/VideoBlockViewClientside.js\";\nimport { SocialMediaEmbedServerside } from \"../SocialMedia/SocialMediaEmbedServerside.js\";\n\nfunction checkIfValidLink(link: string) {\n return typeof link === \"string\";\n}\nexport function ContentEmbedSupport({ body }) {\n const [mounted, setMounted] = useState(false);\n useLayoutEffect(() => {\n setMounted(true);\n }, []);\n\n const renderContent = (content) => {\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 (\n <div\n className={cn(\"relative object-cover\", {\n \"aspect-video\": !content.attrs.height,\n })}\n style={{\n width: content.attrs.width || \"100%\",\n ...(content.attrs.height ? { height: content.attrs.height } : {}),\n }}\n >\n {/* @ts-ignore */}\n <Image\n src={content.attrs.src}\n alt={content.attrs.caption || \"\"}\n style={{ width: content.attrs.width }}\n fill\n />\n </div>\n );\n case \"videoBlock\":\n // @ts-ignore\n return <VideoBlockViewClientside node={content} />;\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\n default:\n return null;\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 <Portal\n key={`embed-content-${content.attrs[\"data-id\"]}`}\n container={document?.querySelector(\n `[data-id='${content.attrs[\"data-id\"]}']`\n )}\n >\n {renderContent(content)}\n </Portal>\n );\n })}\n </>\n );\n}\n"],"names":["Portal","Image","useLayoutEffect","useState","FacebookEmbed","InstagramEmbed","LinkedInEmbed","TikTokEmbed","XEmbed","YouTubeEmbed","cn","VideoBlockViewClientside","SocialMediaEmbedServerside","checkIfValidLink","link","ContentEmbedSupport","body","mounted","setMounted","renderContent","content","type","attrs","url","width","className","captioned","div","height","style","src","alt","caption","fill","node","filter","map","container","document","querySelector"],"mappings":"AAAA;;AAEA,SAASA,MAAM,QAAQ,yBAAyB;AAChD,OAAOC,WAAW,gBAAgB;AAClC,SAASC,eAAe,EAAEC,QAAQ,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AC,UAAU,EAAE;QAQtD;;AAGR"}
1
+ {"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/serverside/ContentEmbedSupport.tsx"],"sourcesContent":["\"use client\";\n\nimport { Portal } from \"@radix-ui/react-portal\";\nimport Image from \"next/image.js\";\nimport { useEffect, useState } from \"react\";\nimport {\n FacebookEmbed,\n InstagramEmbed,\n LinkedInEmbed,\n TikTokEmbed,\n XEmbed,\n YouTubeEmbed,\n} from \"react-social-media-embed\";\nimport { cn } from \"../../lib/utils/index.js\";\nimport VideoBlockViewClientside from \"../VideoBlock/components/VideoBlockViewClientside.js\";\nimport { SocialMediaEmbedServerside } from \"../SocialMedia/SocialMediaEmbedServerside.js\";\n\nfunction checkIfValidLink(link: string) {\n return typeof link === \"string\";\n}\nexport function ContentEmbedSupport({ body }) {\n const [mounted, setMounted] = useState(false);\n useEffect(() => {\n setTimeout(() => {\n setMounted(true);\n }, 100);\n }, []);\n\n const renderContent = (content) => {\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 (\n <div\n className={cn(\"relative object-cover\", {\n \"aspect-video\": !content.attrs.height,\n })}\n style={{\n width: content.attrs.width || \"100%\",\n ...(content.attrs.height ? { height: content.attrs.height } : {}),\n }}\n >\n {/* @ts-ignore */}\n <Image\n src={content.attrs.src}\n alt={content.attrs.caption || \"\"}\n style={{ width: content.attrs.width }}\n fill\n />\n </div>\n );\n case \"videoBlock\":\n // @ts-ignore\n return <VideoBlockViewClientside node={content} />;\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\n default:\n return null;\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 <Portal\n key={`embed-content-${content.attrs[\"data-id\"]}-${content.attrs.key}`}\n container={document?.querySelector(\n `[data-id='${content.attrs[\"data-id\"]}']`\n )}\n >\n {renderContent(content)}\n </Portal>\n );\n })}\n </>\n );\n}\n"],"names":["Portal","Image","useEffect","useState","FacebookEmbed","InstagramEmbed","LinkedInEmbed","TikTokEmbed","XEmbed","YouTubeEmbed","cn","VideoBlockViewClientside","SocialMediaEmbedServerside","checkIfValidLink","link","ContentEmbedSupport","body","mounted","setMounted","setTimeout","renderContent","content","type","attrs","url","width","className","captioned","div","height","style","src","alt","caption","fill","node","filter","map","container","document","querySelector","key"],"mappings":"AAAA;;AAEA,SAASA,MAAM,QAAQ,yBAAyB;AAChD,OAAOC,WAAW,gBAAgB;AAClC,SAASC,SAAS,EAAEC,QAAQ,QAAQ,QAAQ;AAC5C,SACEC,aAAa,EACbC,cAAc,EACdC,aAAa,EACbC,WAAW,EACXC,MAAM,EACNC,YAAY,QACP,2BAA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3E;;AAGR"}
@@ -1 +1 @@
1
- {"version":3,"file":"useAppendIdToClientsideBlocks.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/serverside/useAppendIdToClientsideBlocks.ts"],"names":[],"mappings":"AAYA,wBAAgB,0BAA0B,CAAC,IAAI,KAAA,OAY9C"}
1
+ {"version":3,"file":"useAppendIdToClientsideBlocks.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/serverside/useAppendIdToClientsideBlocks.ts"],"names":[],"mappings":"AAYA,wBAAgB,0BAA0B,CAAC,IAAI,KAAA,OAa9C"}
@@ -15,6 +15,7 @@ export function appendIdToClientsideBlocks(body) {
15
15
  content: body?.content?.map((c, index)=>{
16
16
  if (SOCIAL_MEDIA.includes(c.type)) {
17
17
  c.attrs["data-id"] = index;
18
+ c.key = Math.random();
18
19
  }
19
20
  return c;
20
21
  })
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/serverside/useAppendIdToClientsideBlocks.ts"],"sourcesContent":["import { useCallback } from \"react\";\n\nconst SOCIAL_MEDIA = [\n \"twitter\",\n \"youtube\",\n \"facebook\",\n \"instagram\",\n \"linkedin\",\n \"tiktok\",\n \"imageBlock\",\n \"videoBlock\",\n];\nexport function appendIdToClientsideBlocks(body) {\n if (!body) return body;\n return {\n ...body,\n content: body?.content?.map((c, index) => {\n if (SOCIAL_MEDIA.includes(c.type)) {\n c.attrs[\"data-id\"] = index;\n }\n\n return c;\n }),\n };\n}\n"],"names":["SOCIAL_MEDIA","appendIdToClientsideBlocks","body","content","map","c","index","includes","type","attrs"],"mappings":"AAEA,MAAMA,eAAe;IACnB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AACD,OAAO,SAASC,2BAA2BC,IAAI;IAC7C,IAAI,CAACA,MAAM,OAAOA;IAClB,OAAO;QACL,GAAGA,IAAI;QACPC,SAASD,MAAMC,SAASC,IAAI,CAACC,GAAGC;YAC9B,IAAIN,aAAaO,QAAQ,CAACF,EAAEG,IAAI,GAAG;gBACjCH,EAAEI,KAAK,CAAC,UAAU,GAAGH;YACvB;YAEA,OAAOD;QACT;IACF;AACF"}
1
+ {"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/serverside/useAppendIdToClientsideBlocks.ts"],"sourcesContent":["import { useCallback } from \"react\";\n\nconst SOCIAL_MEDIA = [\n \"twitter\",\n \"youtube\",\n \"facebook\",\n \"instagram\",\n \"linkedin\",\n \"tiktok\",\n \"imageBlock\",\n \"videoBlock\",\n];\nexport function appendIdToClientsideBlocks(body) {\n if (!body) return body;\n return {\n ...body,\n content: body?.content?.map((c, index) => {\n if (SOCIAL_MEDIA.includes(c.type)) {\n c.attrs[\"data-id\"] = index;\n c.key = Math.random();\n }\n\n return c;\n }),\n };\n}\n"],"names":["SOCIAL_MEDIA","appendIdToClientsideBlocks","body","content","map","c","index","includes","type","attrs","key","Math","random"],"mappings":"AAEA,MAAMA,eAAe;IACnB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AACD,OAAO,SAASC,2BAA2BC,IAAI;IAC7C,IAAI,CAACA,MAAM,OAAOA;IAClB,OAAO;QACL,GAAGA,IAAI;QACPC,SAASD,MAAMC,SAASC,IAAI,CAACC,GAAGC;YAC9B,IAAIN,aAAaO,QAAQ,CAACF,EAAEG,IAAI,GAAG;gBACjCH,EAAEI,KAAK,CAAC,UAAU,GAAGH;gBACrBD,EAAEK,GAAG,GAAGC,KAAKC,MAAM;YACrB;YAEA,OAAOP;QACT;IACF;AACF"}