payload-richtext-tiptap 0.0.81 → 0.0.82

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":"ContentEmbedSupport.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/serverside/ContentEmbedSupport.tsx"],"names":[],"mappings":"AAiBA,wBAAgB,mBAAmB,CAAC,EAAE,IAAI,EAAE;;CAAA,+BA2G3C"}
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"}
@@ -7,28 +7,39 @@ import { FacebookEmbed, InstagramEmbed, LinkedInEmbed, TikTokEmbed, XEmbed, YouT
7
7
  import { cn } from "../../lib/utils/index.js";
8
8
  import VideoBlockViewClientside from "../VideoBlock/components/VideoBlockViewClientside.js";
9
9
  import { SocialMediaEmbedServerside } from "../SocialMedia/SocialMediaEmbedServerside.js";
10
+ function checkIfValidLink(link) {
11
+ return link?.startsWith("http");
12
+ }
10
13
  export function ContentEmbedSupport({ body }) {
11
14
  const [mounted, setMounted] = useState(false);
12
15
  useLayoutEffect(()=>{
13
16
  setMounted(true);
14
17
  }, []);
15
18
  const renderContent = (content)=>{
16
- // if (!content.attrs.url) return null;
17
19
  switch(content.type){
18
20
  case "twitter":
21
+ if (!checkIfValidLink(content.attrs.url)) {
22
+ return null;
23
+ }
19
24
  return /*#__PURE__*/ _jsx(SocialMediaEmbedServerside, {
20
25
  children: /*#__PURE__*/ _jsx(XEmbed, {
21
- url: content.attrs.url,
26
+ url: content.attrs.url || "",
22
27
  width: 325
23
28
  })
24
29
  });
25
30
  case "youtube":
31
+ if (!checkIfValidLink(content.attrs.url)) {
32
+ return null;
33
+ }
26
34
  return /*#__PURE__*/ _jsx(SocialMediaEmbedServerside, {
27
35
  children: /*#__PURE__*/ _jsx(YouTubeEmbed, {
28
- url: content.attrs.url
36
+ url: content.attrs.url || ""
29
37
  })
30
38
  });
31
39
  case "instagram":
40
+ if (!checkIfValidLink(content.attrs.url)) {
41
+ return null;
42
+ }
32
43
  return /*#__PURE__*/ _jsx(SocialMediaEmbedServerside, {
33
44
  children: /*#__PURE__*/ _jsx(InstagramEmbed, {
34
45
  className: "max-w-[328px]",
@@ -38,6 +49,9 @@ export function ContentEmbedSupport({ body }) {
38
49
  })
39
50
  });
40
51
  case "tiktok":
52
+ if (!checkIfValidLink(content.attrs.url)) {
53
+ return null;
54
+ }
41
55
  return /*#__PURE__*/ _jsx(SocialMediaEmbedServerside, {
42
56
  children: /*#__PURE__*/ _jsx(TikTokEmbed, {
43
57
  className: "max-w-[328px]",
@@ -78,10 +92,12 @@ export function ContentEmbedSupport({ body }) {
78
92
  })
79
93
  });
80
94
  case "linkedin":
95
+ if (!checkIfValidLink(content.attrs.url)) {
96
+ return null;
97
+ }
81
98
  return /*#__PURE__*/ _jsx(SocialMediaEmbedServerside, {
82
99
  children: /*#__PURE__*/ _jsx(LinkedInEmbed, {
83
- url: content.attrs.url,
84
- // postUrl="https://www.linkedin.com/posts/peterdiamandis_5-discoveries-the-james-webb-telescope-will-activity-6898694773406875648-z-D7"
100
+ url: content.attrs.url || "",
85
101
  width: 325,
86
102
  height: 570
87
103
  })
@@ -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\nexport function ContentEmbedSupport({ body }) {\n const [mounted, setMounted] = useState(false);\n useLayoutEffect(() => {\n setMounted(true);\n }, []);\n\n const renderContent = (content) => {\n // if (!content.attrs.url) return null;\n\n switch (content.type) {\n case \"twitter\":\n return (\n <SocialMediaEmbedServerside>\n <XEmbed url={content.attrs.url} width={325} />\n </SocialMediaEmbedServerside>\n );\n case \"youtube\":\n return (\n <SocialMediaEmbedServerside>\n <YouTubeEmbed url={content.attrs.url} />\n </SocialMediaEmbedServerside>\n );\n case \"instagram\":\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 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 return (\n <SocialMediaEmbedServerside>\n <LinkedInEmbed\n url={content.attrs.url}\n // postUrl=\"https://www.linkedin.com/posts/peterdiamandis_5-discoveries-the-james-webb-telescope-will-activity-6898694773406875648-z-D7\"\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","ContentEmbedSupport","body","mounted","setMounted","renderContent","content","type","url","attrs","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,QAAQ,QAAQ;AAClD,SACEC,aAAa,EACbC,cAAc,EACdC,aAAa,EACbC,WAAW,EACXC,MAAM,EACNC,YAAY,QACP,2BAA2B;AAClC,SAASC,EAAE,QAAQ,2BAA2B;AAC9C,OAAOC,8BAA8B,uDAAuD;AAC5F,SAASC,0BAA0B,QAAQ,+CAA+C;AAE1F,OAAO,SAASC,oBAAoB,EAAEC,IAAI,EAAE;IAC1C,MAAM,CAACC,SAASC,WAAW,GAAGb,SAAS;IACvCD,gBAAgB;QACdc,WAAW;IACb,GAAG,EAAE;IAEL,MAAMC,gBAAgB,CAACC;QACrB,uCAAuC;QAEvC,OAAQA,QAAQC,IAAI;YAClB,KAAK;gBACH,qBACE,KAACP;8BACC,cAAA,KAACJ;wBAAOY,KAAKF,QAAQG,KAAK,CAACD,GAAG;wBAAEE,OAAO;;;YAG7C,KAAK;gBACH,qBACE,KAACV;8BACC,cAAA,KAACH;wBAAaW,KAAKF,QAAQG,KAAK,CAACD,GAAG;;;YAG1C,KAAK;gBACH,qBACE,KAACR;8BACC,cAAA,KA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,UAAUC,cACnB,CAAC,UAAU,EAAEnB,QAAQG,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC;0BAG1CJ,cAAcC;eALV,CAAC,cAAc,EAAEA,QAAQG,KAAK,CAAC,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 { 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 link?.startsWith(\"http\");\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","startsWith","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,E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AAC,cAAc,EAAEA,QAAQE,KAAK,CAAC,UAAU,EAAE;QAQtD;;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,OAW9C"}
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"}
@@ -9,9 +9,10 @@ const SOCIAL_MEDIA = [
9
9
  "videoBlock"
10
10
  ];
11
11
  export function appendIdToClientsideBlocks(body) {
12
+ if (!body) return body;
12
13
  return {
13
14
  ...body,
14
- content: body.content.map((c, index)=>{
15
+ content: body?.content?.map((c, index)=>{
15
16
  if (SOCIAL_MEDIA.includes(c.type)) {
16
17
  c.attrs["data-id"] = index;
17
18
  }
@@ -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 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,OAAO;QACL,GAAGA,IAAI;QACPC,SAASD,KAAKC,OAAO,CAACC,GAAG,CAAC,CAACC,GAAGC;YAC5B,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 }\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"}