@payloadcms/richtext-lexical 3.59.0-internal.ff6711a → 3.59.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. package/dist/exports/client/Field-EHRBYNHO.js +2 -0
  2. package/dist/exports/client/Field-EHRBYNHO.js.map +7 -0
  3. package/dist/exports/client/RelationshipComponent-APF3CN47.js +2 -0
  4. package/dist/exports/client/RelationshipComponent-APF3CN47.js.map +7 -0
  5. package/dist/exports/client/bundled.css +1 -1
  6. package/dist/exports/client/{chunk-TLQLXR6Q.js → chunk-2Y72RT72.js} +2 -2
  7. package/dist/exports/client/chunk-3BY5IZJD.js +2 -0
  8. package/dist/exports/client/chunk-3BY5IZJD.js.map +7 -0
  9. package/dist/exports/client/chunk-CYLMY5ZJ.js +2 -0
  10. package/dist/exports/client/chunk-CYLMY5ZJ.js.map +7 -0
  11. package/dist/exports/client/component-VDJI45F2.js +2 -0
  12. package/dist/exports/client/component-VDJI45F2.js.map +7 -0
  13. package/dist/exports/client/componentInline-7TPI7ZBC.js +2 -0
  14. package/dist/exports/client/index.d.ts +0 -3
  15. package/dist/exports/client/index.d.ts.map +1 -1
  16. package/dist/exports/client/index.js +10 -35
  17. package/dist/exports/client/index.js.map +4 -4
  18. package/dist/features/blocks/client/component/BlockContent.d.ts +27 -52
  19. package/dist/features/blocks/client/component/BlockContent.d.ts.map +1 -1
  20. package/dist/features/blocks/client/component/BlockContent.js +51 -48
  21. package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
  22. package/dist/features/blocks/client/component/components/BlockCollapsible.d.ts +9 -2
  23. package/dist/features/blocks/client/component/components/BlockCollapsible.d.ts.map +1 -1
  24. package/dist/features/blocks/client/component/components/BlockCollapsible.js +25 -7
  25. package/dist/features/blocks/client/component/components/BlockCollapsible.js.map +1 -1
  26. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  27. package/dist/features/blocks/client/component/index.js +56 -71
  28. package/dist/features/blocks/client/component/index.js.map +1 -1
  29. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  30. package/dist/features/blocks/client/componentInline/index.js +11 -13
  31. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  32. package/dist/features/blocks/client/index.d.ts.map +1 -1
  33. package/dist/features/blocks/client/index.js +0 -5
  34. package/dist/features/blocks/client/index.js.map +1 -1
  35. package/dist/features/blocks/client/markdownTransformer.d.ts +17 -0
  36. package/dist/features/blocks/client/markdownTransformer.d.ts.map +1 -0
  37. package/dist/features/blocks/client/markdownTransformer.js +144 -0
  38. package/dist/features/blocks/client/markdownTransformer.js.map +1 -0
  39. package/dist/features/blocks/server/index.js +1 -1
  40. package/dist/features/blocks/server/index.js.map +1 -1
  41. package/dist/features/blocks/server/linesFromMatchToContentAndPropsString.d.ts.map +1 -0
  42. package/dist/features/blocks/server/linesFromMatchToContentAndPropsString.js.map +1 -0
  43. package/dist/features/blocks/server/markdownTransformer.d.ts +22 -0
  44. package/dist/features/blocks/server/markdownTransformer.d.ts.map +1 -0
  45. package/dist/features/blocks/server/{markdown/markdownTransformer.js → markdownTransformer.js} +48 -6
  46. package/dist/features/blocks/server/markdownTransformer.js.map +1 -0
  47. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.d.ts.map +1 -1
  48. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js +3 -5
  49. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -1
  50. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
  51. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +1 -3
  52. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  53. package/dist/features/relationship/client/components/RelationshipComponent.d.ts.map +1 -1
  54. package/dist/features/relationship/client/components/RelationshipComponent.js +9 -5
  55. package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
  56. package/dist/features/toolbars/fixed/client/Toolbar/index.d.ts.map +1 -1
  57. package/dist/features/toolbars/fixed/client/Toolbar/index.js +1 -7
  58. package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
  59. package/dist/features/toolbars/inline/client/Toolbar/index.d.ts.map +1 -1
  60. package/dist/features/toolbars/inline/client/Toolbar/index.js +1 -3
  61. package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
  62. package/dist/features/upload/client/component/index.d.ts.map +1 -1
  63. package/dist/features/upload/client/component/index.js +5 -6
  64. package/dist/features/upload/client/component/index.js.map +1 -1
  65. package/dist/field/bundled.css +1 -1
  66. package/dist/field/rscEntry.d.ts.map +1 -1
  67. package/dist/field/rscEntry.js +0 -2
  68. package/dist/field/rscEntry.js.map +1 -1
  69. package/dist/index.d.ts +0 -1
  70. package/dist/index.d.ts.map +1 -1
  71. package/dist/index.js +0 -1
  72. package/dist/index.js.map +1 -1
  73. package/dist/lexical/LexicalEditor.d.ts.map +1 -1
  74. package/dist/lexical/LexicalEditor.js +26 -20
  75. package/dist/lexical/LexicalEditor.js.map +1 -1
  76. package/dist/lexical/ui/icons/CodeBlock/index.d.ts.map +1 -1
  77. package/dist/lexical/ui/icons/CodeBlock/index.js +15 -10
  78. package/dist/lexical/ui/icons/CodeBlock/index.js.map +1 -1
  79. package/dist/utilities/buildInitialState.d.ts +0 -1
  80. package/dist/utilities/buildInitialState.d.ts.map +1 -1
  81. package/dist/utilities/buildInitialState.js +0 -1
  82. package/dist/utilities/buildInitialState.js.map +1 -1
  83. package/dist/utilities/fieldsDrawer/DrawerContent.d.ts.map +1 -1
  84. package/dist/utilities/fieldsDrawer/DrawerContent.js +3 -7
  85. package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
  86. package/dist/utilities/jsx/collectTopLevelJSXInLines.js +2 -2
  87. package/dist/utilities/jsx/collectTopLevelJSXInLines.js.map +1 -1
  88. package/package.json +6 -6
  89. package/dist/exports/client/Field-CJFETHA3.js +0 -2
  90. package/dist/exports/client/Field-CJFETHA3.js.map +0 -7
  91. package/dist/exports/client/RelationshipComponent-TSIENULZ.js +0 -2
  92. package/dist/exports/client/RelationshipComponent-TSIENULZ.js.map +0 -7
  93. package/dist/exports/client/chunk-BQCXN3B4.js +0 -2
  94. package/dist/exports/client/chunk-BQCXN3B4.js.map +0 -7
  95. package/dist/exports/client/chunk-XNERFY6G.js +0 -2
  96. package/dist/exports/client/chunk-XNERFY6G.js.map +0 -7
  97. package/dist/exports/client/component-CYFKY3IL.js +0 -2
  98. package/dist/exports/client/component-CYFKY3IL.js.map +0 -7
  99. package/dist/exports/client/componentInline-NGTRUSGB.js +0 -2
  100. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.d.ts +0 -6
  101. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.d.ts.map +0 -1
  102. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.js +0 -24
  103. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.js.map +0 -1
  104. package/dist/features/blocks/client/markdown/getMarkdownToLexical.d.ts +0 -6
  105. package/dist/features/blocks/client/markdown/getMarkdownToLexical.d.ts.map +0 -1
  106. package/dist/features/blocks/client/markdown/getMarkdownToLexical.js +0 -20
  107. package/dist/features/blocks/client/markdown/getMarkdownToLexical.js.map +0 -1
  108. package/dist/features/blocks/client/markdown/markdownTransformer.d.ts +0 -12
  109. package/dist/features/blocks/client/markdown/markdownTransformer.d.ts.map +0 -1
  110. package/dist/features/blocks/client/markdown/markdownTransformer.js +0 -348
  111. package/dist/features/blocks/client/markdown/markdownTransformer.js.map +0 -1
  112. package/dist/features/blocks/premade/CodeBlock/Component/Block.d.ts +0 -5
  113. package/dist/features/blocks/premade/CodeBlock/Component/Block.d.ts.map +0 -1
  114. package/dist/features/blocks/premade/CodeBlock/Component/Block.js +0 -156
  115. package/dist/features/blocks/premade/CodeBlock/Component/Block.js.map +0 -1
  116. package/dist/features/blocks/premade/CodeBlock/Component/Code.d.ts +0 -61
  117. package/dist/features/blocks/premade/CodeBlock/Component/Code.d.ts.map +0 -1
  118. package/dist/features/blocks/premade/CodeBlock/Component/Code.js +0 -99
  119. package/dist/features/blocks/premade/CodeBlock/Component/Code.js.map +0 -1
  120. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.d.ts +0 -4
  121. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.d.ts.map +0 -1
  122. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.js +0 -17
  123. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.js.map +0 -1
  124. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.d.ts +0 -4
  125. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.d.ts.map +0 -1
  126. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.js +0 -26
  127. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.js.map +0 -1
  128. package/dist/features/blocks/premade/CodeBlock/converter.d.ts +0 -7
  129. package/dist/features/blocks/premade/CodeBlock/converter.d.ts.map +0 -1
  130. package/dist/features/blocks/premade/CodeBlock/converter.js +0 -46
  131. package/dist/features/blocks/premade/CodeBlock/converter.js.map +0 -1
  132. package/dist/features/blocks/premade/CodeBlock/converterClient.d.ts +0 -2
  133. package/dist/features/blocks/premade/CodeBlock/converterClient.d.ts.map +0 -1
  134. package/dist/features/blocks/premade/CodeBlock/converterClient.js +0 -4
  135. package/dist/features/blocks/premade/CodeBlock/converterClient.js.map +0 -1
  136. package/dist/features/blocks/premade/CodeBlock/index.d.ts +0 -7
  137. package/dist/features/blocks/premade/CodeBlock/index.d.ts.map +0 -1
  138. package/dist/features/blocks/premade/CodeBlock/index.js +0 -52
  139. package/dist/features/blocks/premade/CodeBlock/index.js.map +0 -1
  140. package/dist/features/blocks/server/markdown/getLexicalToMarkdown.d.ts +0 -6
  141. package/dist/features/blocks/server/markdown/getLexicalToMarkdown.d.ts.map +0 -1
  142. package/dist/features/blocks/server/markdown/getLexicalToMarkdown.js +0 -27
  143. package/dist/features/blocks/server/markdown/getLexicalToMarkdown.js.map +0 -1
  144. package/dist/features/blocks/server/markdown/getMarkdownToLexical.d.ts +0 -7
  145. package/dist/features/blocks/server/markdown/getMarkdownToLexical.d.ts.map +0 -1
  146. package/dist/features/blocks/server/markdown/getMarkdownToLexical.js +0 -22
  147. package/dist/features/blocks/server/markdown/getMarkdownToLexical.js.map +0 -1
  148. package/dist/features/blocks/server/markdown/linesFromMatchToContentAndPropsString.d.ts.map +0 -1
  149. package/dist/features/blocks/server/markdown/linesFromMatchToContentAndPropsString.js.map +0 -1
  150. package/dist/features/blocks/server/markdown/markdownTransformer.d.ts +0 -15
  151. package/dist/features/blocks/server/markdown/markdownTransformer.d.ts.map +0 -1
  152. package/dist/features/blocks/server/markdown/markdownTransformer.js.map +0 -1
  153. package/dist/lexical/ui/icons/Collapse/index.d.ts +0 -3
  154. package/dist/lexical/ui/icons/Collapse/index.d.ts.map +0 -1
  155. package/dist/lexical/ui/icons/Collapse/index.js +0 -18
  156. package/dist/lexical/ui/icons/Collapse/index.js.map +0 -1
  157. /package/dist/exports/client/{chunk-TLQLXR6Q.js.map → chunk-2Y72RT72.js.map} +0 -0
  158. /package/dist/exports/client/{componentInline-NGTRUSGB.js.map → componentInline-7TPI7ZBC.js.map} +0 -0
  159. /package/dist/features/blocks/server/{markdown/linesFromMatchToContentAndPropsString.d.ts → linesFromMatchToContentAndPropsString.d.ts} +0 -0
  160. /package/dist/features/blocks/server/{markdown/linesFromMatchToContentAndPropsString.js → linesFromMatchToContentAndPropsString.js} +0 -0
@@ -8,5 +8,5 @@ var nt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.cre
8
8
  `),o=[];for(let r of e)o.push("> "+r);return o.join(`
9
9
  `)},regExp:zt,replace:(n,t,e,o)=>{if(o){let c=n.getPreviousSibling();if(Dt(c)){c.splice(c.getChildrenSize(),0,[Nn(),...t]),c.select(0,0),n.remove();return}}let r=Rn();r.append(...t),n.replace(r),r.select(0,0)}},qt={type:"element",dependencies:[J,Z],export:(n,t)=>k(n)?U(n,t,0):null,regExp:Ut,replace:tt("bullet")},Ln={type:"element",dependencies:[J,Z],export:(n,t)=>k(n)?U(n,t,0):null,regExp:Gt,replace:tt("check")},Qt={type:"element",dependencies:[J,Z],export:(n,t)=>k(n)?U(n,t,0):null,regExp:Kt,replace:tt("number")},jt={type:"text-format",format:["code"],tag:"`"},Vt={type:"text-format",format:["highlight"],tag:"=="},Zt={type:"text-format",format:["bold","italic"],tag:"***"},Jt={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},te={type:"text-format",format:["bold"],tag:"**"},ee={type:"text-format",format:["bold"],intraword:!1,tag:"__"},ne={type:"text-format",format:["strikethrough"],tag:"~~"},oe={type:"text-format",format:["italic"],tag:"*"},re={type:"text-format",format:["italic"],intraword:!1,tag:"_"};function ie(n,t){let e=n.split(`
10
10
  `),o=!1,r=[],c=0;for(let s=0;s<e.length;s++){let i=e[s],a=r[r.length-1];if(bn.test(i)){r.push(i);continue}if(Pt.test(i)){c===0&&(o=!0),c===1&&(o=!1),c>0&&c--,r.push(i);continue}if(yn.test(i)){o=!0,c++,r.push(i);continue}if(o){r.push(i);continue}Bt.test(i)||Bt.test(a)||!a||V.test(a)||V.test(i)||zt.test(i)||Kt.test(i)||Ut.test(i)||Gt.test(i)||An.test(i)||On.test(i)||!t||vt.test(i)||Ht.test(i)||vt.test(a)||Ht.test(a)||Pt.test(a)?r.push(i):r[r.length-1]=a+" "+i.trim()}return r.join(`
11
- `)}var $n=[Yt,Wt,qt,Qt],Dn=[],Bn=[jt,Zt,Jt,te,ee,Vt,oe,re,ne],Pn=[],K=[...$n,...Dn,...Bn,...Pn];function hr(n,t=K,e,o=!1,r=!0){let c=o?n:ie(n,r);return Ot(t,o)(c,e)}function xr(n=K,t,e=!1){return Ft(n,e)(t)}export{cr as a,hr as b,xr as c,nt as d,Gn as e,G as f,ot as g,io as h,ve as i,so as j,_t as k,fo as l};
12
- //# sourceMappingURL=chunk-TLQLXR6Q.js.map
11
+ `)}var $n=[Yt,Wt,qt,Qt],Dn=[],Bn=[jt,Zt,Jt,te,ee,Vt,oe,re,ne],Pn=[],K=[...$n,...Dn,...Bn,...Pn];function hr(n,t=K,e,o=!1,r=!0){let c=o?n:ie(n,r);return Ot(t,o)(c,e)}function xr(n=K,t,e=!1){return Ft(n,e)(t)}export{nt as a,Gn as b,cr as c,hr as d,xr as e,G as f,ot as g,io as h,ve as i,so as j,_t as k,fo as l};
12
+ //# sourceMappingURL=chunk-2Y72RT72.js.map
@@ -0,0 +1,2 @@
1
+ import{a as ie}from"./chunk-INBEEENE.js";import{b as se}from"./chunk-BZZVLW4U.js";import{jsx as r,jsxs as p,Fragment as we}from"react/jsx-runtime";import O,{createContext as Ie,useCallback as A,useEffect as v,useMemo as N,useRef as x}from"react";import{useLexicalComposerContext as ve}from"@lexical/react/LexicalComposerContext";import{getTranslation as ce}from"@payloadcms/translations";import{Button as ae,Drawer as Ne,EditDepthProvider as Oe,Form as Te,formatDrawerSlug as $e,FormSubmit as Pe,RenderFields as Re,ShimmerEffect as Ee,useConfig as Le,useDocumentForm as je,useDocumentInfo as Me,useEditDepth as Ae,useServerFunctions as Je,useTranslation as Ke}from"@payloadcms/ui";import{abortAndIgnore as J}from"@payloadcms/ui/shared";import{$getNodeByKey as K}from"lexical";import{deepCopyObjectSimpleWithoutReactComponents as z,reduceFieldsToValues as ze}from"payload/shared";import{v4 as He}from"uuid";import{jsx as Ce}from"react/jsx-runtime";import _e from"bson-objectid";import ye from"react";import Be from"bson-objectid";import{DecoratorNode as xe}from"lexical";var B=class extends xe{__cacheBuster;__fields;constructor({cacheBuster:e,fields:t,key:l}){super(l),this.__fields=t,this.__cacheBuster=e||0}static clone(e){return new this({cacheBuster:e.__cacheBuster,fields:e.__fields,key:e.__key})}static getType(){return"inlineBlock"}static importDOM(){return{}}static importJSON(e){return Se(e.fields)}static isInline(){return!1}canIndent(){return!0}createDOM(){let e=document.createElement("span");return e.classList.add("inline-block-container"),e}decorate(e,t){return null}exportDOM(){let e=document.createElement("span");e.classList.add("inline-block-container");let t=document.createTextNode(this.getTextContent());return e.append(t),{element:e}}exportJSON(){return{type:"inlineBlock",fields:this.getFields(),version:1}}getCacheBuster(){return this.getLatest().__cacheBuster}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}isInline(){return!0}setFields(e,t){let l=this.getWritable();l.__fields=e,t||l.__cacheBuster++}updateDOM(){return!1}};function Se(s){return new B({fields:{...s,id:s?.id||new Be.default().toHexString()}})}var Fe=ye.lazy(()=>import("./componentInline-7TPI7ZBC.js").then(s=>({default:s.InlineBlockComponent}))),I=class extends B{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return De(e.fields)}decorate(e,t){return Ce(Fe,{cacheBuster:this.getCacheBuster(),formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function De(s){return new I({fields:{...s,id:s?.id||new _e.default().toHexString()}})}function M(s){return s instanceof I}var f="inline-block",ue=Ie({initialState:!1}),ft=()=>O.use(ue),pt=s=>{let{cacheBuster:e,formData:t,nodeKey:l}=s,[d]=ve(),{i18n:T,t:m}=Ke(),{createdInlineBlock:H,fieldProps:{featureClientSchemaMap:de,initialLexicalFormState:me,permissions:Ve,readOnly:S,schemaPath:V},setCreatedInlineBlock:W,uuid:fe}=se(),{fields:C}=je(),{getFormState:_}=Je(),pe=Ae(),q=x(!1),[c,$]=O.useState(()=>me?.[t.id]?.formState),G=x(!1),Q=x(e);v(()=>{G.current?(Q.current!==e&&$(!1),Q.current=e):G.current=!0},[e]);let[P,U]=O.useState(c?._components?.customComponents?.BlockLabel),[X,Y]=O.useState(c?._components?.customComponents?.Block),Z=$e({slug:`lexical-inlineBlocks-create-${fe}-${t.id}`,depth:pe}),{toggleDrawer:b}=ie(Z,!0),be=x(null),{id:y,collectionSlug:F,getDocPreferences:D,globalSlug:w}=Me(),{config:ke}=Le(),he=`${V}.lexical_internal_feature.blocks.lexical_inline_blocks.${t.blockType}`,k=de.blocks?.[he]?.[0],a=k.blockReferences?typeof k?.blockReferences?.[0]=="string"?ke.blocksMap[k?.blockReferences?.[0]]:k?.blockReferences?.[0]:k?.blocks?.[0],ee=a?.fields??[];v(()=>{!q.current&&H?.getKey()===l&&(ee.length>2&&b(),W?.(void 0),q.current=!0)},[ee.length,H,l,W,b]);let te=A(()=>{d.update(()=>{K(l)?.remove()})},[d,l]),h=a?.labels?.singular?ce(a?.labels.singular,T):a?.slug,R=x(new AbortController),g=`${V}.lexical_internal_feature.blocks.lexical_inline_blocks.${a?.slug}.fields`;v(()=>{let n=new AbortController;return t&&!c&&(async()=>{let{state:o}=await _({id:y,collectionSlug:F,data:t,docPermissions:{fields:!0},docPreferences:await D(),documentFormState:z(C),globalSlug:w,initialBlockData:t,initialBlockFormState:t,operation:"update",renderAllFields:!0,schemaPath:g,signal:n.signal});if(o){let u=ze(z(o),!0);d.update(()=>{let j=K(l);if(j&&M(j)){let le=u;le.blockType=t.blockType,j.setFields(le,!0)}}),$(o),U(o._components?.customComponents?.BlockLabel),Y(o._components?.customComponents?.Block)}})(),()=>{J(n)}},[_,d,l,g,y,t,c,F,w,D,C]);let ne=A(async({formState:n,submit:i})=>{J(R.current);let o=new AbortController;R.current=o;let{state:u}=await _({id:y,collectionSlug:F,docPermissions:{fields:!0},docPreferences:await D(),documentFormState:z(C),formState:n,globalSlug:w,initialBlockFormState:n,operation:"update",renderAllFields:!!i,schemaPath:g,signal:o.signal});return u?(i&&(U(u._components?.customComponents?.BlockLabel),Y(u._components?.customComponents?.Block)),u):n},[_,y,F,D,C,w,g]);v(()=>{let n=(i,o)=>Object.keys(o).some(u=>o[u]&&i[u]!==o[u].value);return()=>{c&&n(t,c)&&$(!1),J(R.current)}},[t,c]);let ge=A((n,i)=>{i.blockType=t.blockType,d.update(()=>{let o=K(l);o&&M(o)&&o.setFields(i,!0)})},[d,l,t]),E=N(()=>()=>r(ae,{buttonStyle:"icon-label",className:`${f}__removeButton`,disabled:S,icon:"x",onClick:n=>{n.preventDefault(),te()},round:!0,size:"small",tooltip:m("lexical:blocks:inlineBlocks:remove",{label:h})}),[h,S,te,m]),oe=N(()=>()=>r(ae,{buttonStyle:"icon-label",className:`${f}__editButton`,disabled:S,el:"button",icon:"edit",onClick:()=>{b()},round:!0,size:"small",tooltip:m("lexical:blocks:inlineBlocks:edit",{label:h})}),[h,S,m,b]),L=N(()=>({children:n,className:i})=>r("div",{className:[f,f+"-"+t.blockType,i].filter(Boolean).join(" "),ref:be,children:n}),[t.blockType]),re=N(()=>P?()=>P:()=>r("div",{children:a?.labels?ce(a?.labels.singular,T):""}),[P,a?.labels,T]);return a?p(Te,{beforeSubmit:[async({formState:n})=>await ne({formState:n,submit:!0})],disableValidationOnSubmit:!0,el:"div",fields:a?.fields,initialState:c||{},onChange:[ne],onSubmit:(n,i)=>{ge(n,i),b()},uuid:He(),children:[r(Oe,{children:r(Ne,{className:"",slug:Z,title:m(`lexical:blocks:inlineBlocks:${t?.id?"edit":"create"}`,{label:h??m("lexical:blocks:inlineBlocks:label")}),children:c?p(we,{children:[r(Re,{fields:a?.fields,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:g,permissions:!0,readOnly:!1}),r(Pe,{programmaticSubmit:!0,children:m("fields:saveChanges")})]}):null})}),X?r(ue,{value:{EditButton:oe,initialState:c,InlineBlockContainer:L,Label:re,nodeKey:l,RemoveButton:E},children:X}):p(L,{children:[c?r(re,{}):r(Ee,{height:"15px",width:"40px"}),d.isEditable()?p("div",{className:`${f}__actions`,children:[r(oe,{}),r(E,{})]}):null]})]}):p(L,{className:`${f}-not-found`,children:[p("span",{children:["Error: Block '",t.blockType,"' not found"]}),d.isEditable()?r("div",{className:`${f}__actions`,children:r(E,{})}):null]})};export{ft as a,pt as b,I as c,De as d,M as e};
2
+ //# sourceMappingURL=chunk-3BY5IZJD.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/features/blocks/client/componentInline/index.tsx", "../../../src/features/blocks/client/nodes/InlineBlocksNode.tsx", "../../../src/features/blocks/server/nodes/InlineBlocksNode.tsx"],
4
+ "sourcesContent": ["'use client'\n\nimport React, { createContext, useCallback, useEffect, useMemo, useRef } from 'react'\nconst baseClass = 'inline-block'\n\nimport type { BlocksFieldClient, ClientBlock, Data, FormState } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n Drawer,\n EditDepthProvider,\n Form,\n formatDrawerSlug,\n FormSubmit,\n RenderFields,\n ShimmerEffect,\n useConfig,\n useDocumentForm,\n useDocumentInfo,\n useEditDepth,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport { $getNodeByKey } from 'lexical'\n\nimport './index.scss'\n\nimport { deepCopyObjectSimpleWithoutReactComponents, reduceFieldsToValues } from 'payload/shared'\nimport { v4 as uuid } from 'uuid'\n\nimport type { InlineBlockFields } from '../../server/nodes/InlineBlocksNode.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport { useLexicalDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport { $isInlineBlockNode } from '../nodes/InlineBlocksNode.js'\n\ntype Props = {\n /**\n * Can be modified by the node in order to trigger the re-fetch of the initial state based on the\n * formData. This is useful when node.setFields() is explicitly called from outside of the form - in\n * this case, the new field state is likely not reflected in the form state, so we need to re-fetch\n */\n readonly cacheBuster: number\n readonly formData: InlineBlockFields\n readonly nodeKey: string\n}\n\ntype InlineBlockComponentContextType = {\n EditButton?: React.FC\n initialState: false | FormState | undefined\n InlineBlockContainer?: React.FC<{ children: React.ReactNode }>\n Label?: React.FC\n nodeKey?: string\n RemoveButton?: React.FC\n}\n\nconst InlineBlockComponentContext = createContext<InlineBlockComponentContextType>({\n initialState: false,\n})\n\nexport const useInlineBlockComponentContext = () => React.use(InlineBlockComponentContext)\n\nexport const InlineBlockComponent: React.FC<Props> = (props) => {\n const { cacheBuster, formData, nodeKey } = props\n\n const [editor] = useLexicalComposerContext()\n const { i18n, t } = useTranslation<object, string>()\n const {\n createdInlineBlock,\n fieldProps: {\n featureClientSchemaMap,\n initialLexicalFormState,\n permissions,\n readOnly,\n schemaPath,\n },\n setCreatedInlineBlock,\n uuid: uuidFromContext,\n } = useEditorConfigContext()\n const { fields: parentDocumentFields } = useDocumentForm()\n\n const { getFormState } = useServerFunctions()\n const editDepth = useEditDepth()\n const firstTimeDrawer = useRef(false)\n\n const [initialState, setInitialState] = React.useState<false | FormState | undefined>(\n () => initialLexicalFormState?.[formData.id]?.formState,\n )\n\n const hasMounted = useRef(false)\n const prevCacheBuster = useRef(cacheBuster)\n useEffect(() => {\n if (hasMounted.current) {\n if (prevCacheBuster.current !== cacheBuster) {\n setInitialState(false)\n }\n prevCacheBuster.current = cacheBuster\n } else {\n hasMounted.current = true\n }\n }, [cacheBuster])\n\n const [CustomLabel, setCustomLabel] = React.useState<React.ReactNode | undefined>(\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n initialState?.['_components']?.customComponents?.BlockLabel,\n )\n\n const [CustomBlock, setCustomBlock] = React.useState<React.ReactNode | undefined>(\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n initialState?.['_components']?.customComponents?.Block,\n )\n\n const drawerSlug = formatDrawerSlug({\n slug: `lexical-inlineBlocks-create-${uuidFromContext}-${formData.id}`,\n depth: editDepth,\n })\n const { toggleDrawer } = useLexicalDrawer(drawerSlug, true)\n\n const inlineBlockElemElemRef = useRef<HTMLDivElement | null>(null)\n const { id, collectionSlug, getDocPreferences, globalSlug } = useDocumentInfo()\n const { config } = useConfig()\n\n const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${formData.blockType}`\n\n const clientSchemaMap = featureClientSchemaMap['blocks']\n\n const blocksField: BlocksFieldClient = clientSchemaMap?.[\n componentMapRenderedBlockPath\n ]?.[0] as BlocksFieldClient\n\n const clientBlock: ClientBlock | undefined = blocksField.blockReferences\n ? typeof blocksField?.blockReferences?.[0] === 'string'\n ? config.blocksMap[blocksField?.blockReferences?.[0]]\n : blocksField?.blockReferences?.[0]\n : blocksField?.blocks?.[0]\n\n const clientBlockFields = clientBlock?.fields ?? []\n\n // Open drawer on \"mount\"\n useEffect(() => {\n if (!firstTimeDrawer.current && createdInlineBlock?.getKey() === nodeKey) {\n // > 2 because they always have \"id\" and \"blockName\" fields\n if (clientBlockFields.length > 2) {\n toggleDrawer()\n }\n setCreatedInlineBlock?.(undefined)\n firstTimeDrawer.current = true\n }\n }, [clientBlockFields.length, createdInlineBlock, nodeKey, setCreatedInlineBlock, toggleDrawer])\n\n const removeInlineBlock = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey)?.remove()\n })\n }, [editor, nodeKey])\n\n const blockDisplayName = clientBlock?.labels?.singular\n ? getTranslation(clientBlock?.labels.singular, i18n)\n : clientBlock?.slug\n\n const onChangeAbortControllerRef = useRef(new AbortController())\n const schemaFieldsPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${clientBlock?.slug}.fields`\n\n // Initial state for newly created blocks\n useEffect(() => {\n const abortController = new AbortController()\n\n const awaitInitialState = async () => {\n /*\n * This will only run if a new block is created. For all existing blocks that are loaded when the document is loaded, or when the form is saved,\n * this is not run, as the lexical field RSC will fetch the state server-side and pass it to the client. That way, we avoid unnecessary client-side\n * requests. Though for newly created blocks, we need to fetch the state client-side, as the server doesn't know about the block yet.\n */\n const { state } = await getFormState({\n id,\n collectionSlug,\n data: formData,\n docPermissions: { fields: true },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields),\n globalSlug,\n initialBlockData: formData,\n initialBlockFormState: formData,\n operation: 'update',\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: abortController.signal,\n })\n\n if (state) {\n const newFormStateData: InlineBlockFields = reduceFieldsToValues(\n deepCopyObjectSimpleWithoutReactComponents(state),\n true,\n ) as InlineBlockFields\n\n // Things like default values may come back from the server => update the node with the new data\n editor.update(() => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n const newData = newFormStateData\n newData.blockType = formData.blockType\n\n node.setFields(newData, true)\n }\n })\n\n setInitialState(state)\n setCustomLabel(state['_components']?.customComponents?.BlockLabel)\n setCustomBlock(state['_components']?.customComponents?.Block)\n }\n }\n\n if (formData && !initialState) {\n void awaitInitialState()\n }\n\n return () => {\n abortAndIgnore(abortController)\n }\n }, [\n getFormState,\n editor,\n nodeKey,\n schemaFieldsPath,\n id,\n formData,\n initialState,\n collectionSlug,\n globalSlug,\n getDocPreferences,\n parentDocumentFields,\n ])\n\n /**\n * HANDLE ONCHANGE\n */\n const onChange = useCallback(\n async ({ formState: prevFormState, submit }: { formState: FormState; submit?: boolean }) => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n\n const controller = new AbortController()\n onChangeAbortControllerRef.current = controller\n\n const { state } = await getFormState({\n id,\n collectionSlug,\n docPermissions: {\n fields: true,\n },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields),\n formState: prevFormState,\n globalSlug,\n initialBlockFormState: prevFormState,\n operation: 'update',\n renderAllFields: submit ? true : false,\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n if (!state) {\n return prevFormState\n }\n\n if (submit) {\n setCustomLabel(state['_components']?.customComponents?.BlockLabel)\n setCustomBlock(state['_components']?.customComponents?.Block)\n }\n\n return state\n },\n [\n getFormState,\n id,\n collectionSlug,\n getDocPreferences,\n parentDocumentFields,\n globalSlug,\n schemaFieldsPath,\n ],\n )\n // cleanup effect\n useEffect(() => {\n const isStateOutOfSync = (formData: InlineBlockFields, initialState: FormState) => {\n return Object.keys(initialState).some(\n (key) => initialState[key] && formData[key] !== initialState[key].value,\n )\n }\n\n return () => {\n // If the component is unmounted (either via removeInlineBlock or via lexical itself) and the form state got changed before,\n // we need to reset the initial state to force a re-fetch of the initial state when it gets mounted again (e.g. via lexical history undo).\n // Otherwise it would use an outdated initial state.\n if (initialState && isStateOutOfSync(formData, initialState)) {\n setInitialState(false)\n }\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [formData, initialState])\n\n /**\n * HANDLE FORM SUBMIT\n */\n const onFormSubmit = useCallback(\n (formState: FormState, newData: Data) => {\n newData.blockType = formData.blockType\n\n editor.update(() => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n node.setFields(newData as InlineBlockFields, true)\n }\n })\n },\n [editor, nodeKey, formData],\n )\n\n const RemoveButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__removeButton`}\n disabled={readOnly}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeInlineBlock()\n }}\n round\n size=\"small\"\n tooltip={t('lexical:blocks:inlineBlocks:remove', { label: blockDisplayName })}\n />\n ),\n [blockDisplayName, readOnly, removeInlineBlock, t],\n )\n\n const EditButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__editButton`}\n disabled={readOnly}\n el=\"button\"\n icon=\"edit\"\n onClick={() => {\n toggleDrawer()\n }}\n round\n size=\"small\"\n tooltip={t('lexical:blocks:inlineBlocks:edit', { label: blockDisplayName })}\n />\n ),\n [blockDisplayName, readOnly, t, toggleDrawer],\n )\n\n const InlineBlockContainer = useMemo(\n () =>\n ({ children, className }: { children: React.ReactNode; className?: string }) => (\n <div\n className={[baseClass, baseClass + '-' + formData.blockType, className]\n .filter(Boolean)\n .join(' ')}\n ref={inlineBlockElemElemRef}\n >\n {children}\n </div>\n ),\n [formData.blockType],\n )\n\n const Label = useMemo(() => {\n if (CustomLabel) {\n return () => CustomLabel\n } else {\n return () => (\n <div>{clientBlock?.labels ? getTranslation(clientBlock?.labels.singular, i18n) : ''}</div>\n )\n }\n }, [CustomLabel, clientBlock?.labels, i18n])\n\n if (!clientBlock) {\n return (\n <InlineBlockContainer className={`${baseClass}-not-found`}>\n <span>Error: Block '{formData.blockType}' not found</span>\n {editor.isEditable() ? (\n <div className={`${baseClass}__actions`}>\n <RemoveButton />\n </div>\n ) : null}\n </InlineBlockContainer>\n )\n }\n\n return (\n <Form\n beforeSubmit={[\n async ({ formState }) => {\n // This is only called when form is submitted from drawer\n return await onChange({ formState, submit: true })\n },\n ]}\n disableValidationOnSubmit\n el=\"div\"\n fields={clientBlock?.fields}\n initialState={initialState || {}}\n onChange={[onChange]}\n onSubmit={(formState, data) => {\n onFormSubmit(formState, data)\n toggleDrawer()\n }}\n uuid={uuid()}\n >\n <EditDepthProvider>\n <Drawer\n className={''}\n slug={drawerSlug}\n title={t(`lexical:blocks:inlineBlocks:${formData?.id ? 'edit' : 'create'}`, {\n label: blockDisplayName ?? t('lexical:blocks:inlineBlocks:label'),\n })}\n >\n {initialState ? (\n <>\n <RenderFields\n fields={clientBlock?.fields}\n forceRender\n parentIndexPath=\"\"\n parentPath=\"\" // See Blocks feature path for details as for why this is empty\n parentSchemaPath={schemaFieldsPath}\n permissions={true}\n readOnly={false}\n />\n <FormSubmit programmaticSubmit={true}>{t('fields:saveChanges')}</FormSubmit>\n </>\n ) : null}\n </Drawer>\n </EditDepthProvider>\n {CustomBlock ? (\n <InlineBlockComponentContext\n value={{\n EditButton,\n initialState,\n InlineBlockContainer,\n Label,\n nodeKey,\n RemoveButton,\n }}\n >\n {CustomBlock}\n </InlineBlockComponentContext>\n ) : (\n <InlineBlockContainer>\n {initialState ? <Label /> : <ShimmerEffect height=\"15px\" width=\"40px\" />}\n {editor.isEditable() ? (\n <div className={`${baseClass}__actions`}>\n <EditButton />\n <RemoveButton />\n </div>\n ) : null}\n </InlineBlockContainer>\n )}\n </Form>\n )\n}\n", "'use client'\nimport type { EditorConfig, LexicalEditor, LexicalNode } from 'lexical'\n\nimport ObjectID from 'bson-objectid'\nimport React, { type JSX } from 'react'\n\nimport type {\n InlineBlockFields,\n SerializedInlineBlockNode,\n} from '../../server/nodes/InlineBlocksNode.js'\n\nimport { ServerInlineBlockNode } from '../../server/nodes/InlineBlocksNode.js'\n\nconst InlineBlockComponent = React.lazy(() =>\n import('../componentInline/index.js').then((module) => ({\n default: module.InlineBlockComponent,\n })),\n)\n\nexport class InlineBlockNode extends ServerInlineBlockNode {\n static override clone(node: ServerInlineBlockNode): ServerInlineBlockNode {\n return super.clone(node)\n }\n\n static override getType(): string {\n return super.getType()\n }\n\n static override importJSON(serializedNode: SerializedInlineBlockNode): InlineBlockNode {\n const node = $createInlineBlockNode(serializedNode.fields)\n return node\n }\n\n override decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element {\n return (\n <InlineBlockComponent\n cacheBuster={this.getCacheBuster()}\n formData={this.getFields()}\n nodeKey={this.getKey()}\n />\n )\n }\n\n override exportJSON(): SerializedInlineBlockNode {\n return super.exportJSON()\n }\n}\n\nexport function $createInlineBlockNode(fields: Exclude<InlineBlockFields, 'id'>): InlineBlockNode {\n return new InlineBlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\n },\n })\n}\n\nexport function $isInlineBlockNode(\n node: InlineBlockNode | LexicalNode | null | undefined,\n): node is InlineBlockNode {\n return node instanceof InlineBlockNode\n}\n", "import type {\n DOMConversionMap,\n DOMExportOutput,\n EditorConfig,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n SerializedLexicalNode,\n Spread,\n} from 'lexical'\nimport type { JsonObject } from 'payload'\nimport type React from 'react'\nimport type { JSX } from 'react'\n\nimport ObjectID from 'bson-objectid'\nimport { DecoratorNode } from 'lexical'\n\nexport type InlineBlockFields<TInlineBlockFields extends JsonObject = JsonObject> = {\n blockType: string\n id: string\n} & TInlineBlockFields\n\nexport type SerializedInlineBlockNode<TBlockFields extends JsonObject = JsonObject> = Spread<\n {\n children?: never // required so that our typed editor state doesn't automatically add children\n fields: InlineBlockFields<TBlockFields>\n type: 'inlineBlock'\n },\n SerializedLexicalNode\n>\n\nexport class ServerInlineBlockNode extends DecoratorNode<null | React.ReactElement> {\n __cacheBuster: number\n __fields: InlineBlockFields\n\n constructor({\n cacheBuster,\n fields,\n key,\n }: {\n cacheBuster?: number\n fields: InlineBlockFields\n key?: NodeKey\n }) {\n super(key)\n this.__fields = fields\n this.__cacheBuster = cacheBuster || 0\n }\n\n static override clone(node: ServerInlineBlockNode): ServerInlineBlockNode {\n return new this({\n cacheBuster: node.__cacheBuster,\n fields: node.__fields,\n key: node.__key,\n })\n }\n\n static override getType(): string {\n return 'inlineBlock'\n }\n\n static override importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {}\n }\n\n static override importJSON(serializedNode: SerializedInlineBlockNode): ServerInlineBlockNode {\n const node = $createServerInlineBlockNode(serializedNode.fields)\n return node\n }\n\n static isInline(): false {\n return false\n }\n\n canIndent() {\n return true\n }\n override createDOM() {\n const element = document.createElement('span')\n element.classList.add('inline-block-container')\n\n return element\n }\n\n override decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element | null {\n return null\n }\n\n override exportDOM(): DOMExportOutput {\n const element = document.createElement('span')\n element.classList.add('inline-block-container')\n\n const text = document.createTextNode(this.getTextContent())\n element.append(text)\n return { element }\n }\n\n override exportJSON(): SerializedInlineBlockNode {\n return {\n type: 'inlineBlock',\n fields: this.getFields(),\n version: 1,\n }\n }\n\n getCacheBuster(): number {\n return this.getLatest().__cacheBuster\n }\n\n getFields(): InlineBlockFields {\n return this.getLatest().__fields\n }\n\n override getTextContent(): string {\n return `Block Field`\n }\n\n override isInline() {\n return true\n }\n\n setFields(fields: InlineBlockFields, preventFormStateUpdate?: boolean): void {\n const writable = this.getWritable()\n writable.__fields = fields\n if (!preventFormStateUpdate) {\n writable.__cacheBuster++\n }\n }\n\n override updateDOM(): boolean {\n return false\n }\n}\n\nexport function $createServerInlineBlockNode(\n fields: Exclude<InlineBlockFields, 'id'>,\n): ServerInlineBlockNode {\n return new ServerInlineBlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\n },\n })\n}\n\nexport function $isServerInlineBlockNode(\n node: LexicalNode | null | ServerInlineBlockNode | undefined,\n): node is ServerInlineBlockNode {\n return node instanceof ServerInlineBlockNode\n}\n"],
5
+ "mappings": "mJAEA,OAAOA,GAASC,iBAAAA,GAAeC,eAAAA,EAAaC,aAAAA,EAAWC,WAAAA,EAASC,UAAAA,MAAc,QAK9E,OAASC,6BAAAA,OAAiC,wCAC1C,OAASC,kBAAAA,OAAsB,2BAC/B,OACEC,UAAAA,GACAC,UAAAA,GACAC,qBAAAA,GACAC,QAAAA,GACAC,oBAAAA,GACAC,cAAAA,GACAC,gBAAAA,GACAC,iBAAAA,GACAC,aAAAA,GACAC,mBAAAA,GACAC,mBAAAA,GACAC,gBAAAA,GACAC,sBAAAA,GACAC,kBAAAA,OACK,iBACP,OAASC,kBAAAA,MAAsB,wBAC/B,OAASC,iBAAAA,MAAqB,UAI9B,OAASC,8CAAAA,EAA4CC,wBAAAA,OAA4B,iBACjF,OAASC,MAAMC,OAAY,gDC5B3B,OAAOC,OAAc,gBACrB,OAAOC,OAAyB,QCUhC,OAAOC,OAAc,gBACrB,OAASC,iBAAAA,OAAqB,UAgBvB,IAAMC,EAAN,cAAoCD,EAAA,CACzCE,cACAC,SAEAC,YAAY,CACVC,YAAAA,EACAC,OAAAA,EACAC,IAAAA,CAAG,EAKF,CACD,MAAMA,CAAA,EACN,KAAKJ,SAAWG,EAChB,KAAKJ,cAAgBG,GAAe,CACtC,CAEA,OAAgBG,MAAMC,EAAoD,CACxE,OAAO,IAAI,KAAK,CACdJ,YAAaI,EAAKP,cAClBI,OAAQG,EAAKN,SACbI,IAAKE,EAAKC,KACZ,CAAA,CACF,CAEA,OAAgBC,SAAkB,CAChC,MAAO,aACT,CAEA,OAAgBC,WAAqD,CACnE,MAAO,CAAC,CACV,CAEA,OAAgBC,WAAWC,EAAkE,CAE3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AClC8I,EAAC,OAAA,WAAK,iBAAepI,EAASwD,UAAU,aAAA,IACvCtD,EAAOqJ,WAAU,EAChBzC,EAAC,MAAA,CAAIG,UAAW,GAAG3H,CAAA,qBACjBwH,EAACF,EAAA,CAAA,CAAA,IAED,IAAA,GA0EZ",
6
+ "names": ["React", "createContext", "useCallback", "useEffect", "useMemo", "useRef", "useLexicalComposerContext", "getTranslation", "Button", "Drawer", "EditDepthProvider", "Form", "formatDrawerSlug", "FormSubmit", "RenderFields", "ShimmerEffect", "useConfig", "useDocumentForm", "useDocumentInfo", "useEditDepth", "useServerFunctions", "useTranslation", "abortAndIgnore", "$getNodeByKey", "deepCopyObjectSimpleWithoutReactComponents", "reduceFieldsToValues", "v4", "uuid", "ObjectID", "React", "ObjectID", "DecoratorNode", "ServerInlineBlockNode", "__cacheBuster", "__fields", "constructor", "cacheBuster", "fields", "key", "clone", "node", "__key", "getType", "importDOM", "importJSON", "serializedNode", "$createServerInlineBlockNode", "isInline", "canIndent", "createDOM", "element", "document", "createElement", "classList", "add", "decorate", "editor", "config", "exportDOM", "text", "createTextNode", "getTextContent", "append", "exportJSON", "type", "getFields", "version", "getCacheBuster", "getLatest", "setFields", "preventFormStateUpdate", "writable", "getWritable", "updateDOM", "id", "default", "toHexString", "InlineBlockComponent", "React", "lazy", "then", "module", "default", "InlineBlockNode", "ServerInlineBlockNode", "clone", "node", "getType", "importJSON", "serializedNode", "$createInlineBlockNode", "fields", "decorate", "editor", "config", "_jsx", "cacheBuster", "getCacheBuster", "formData", "getFields", "nodeKey", "getKey", "exportJSON", "id", "ObjectID", "toHexString", "$isInlineBlockNode", "baseClass", "InlineBlockComponentContext", "createContext", "initialState", "useInlineBlockComponentContext", "React", "use", "InlineBlockComponent", "props", "cacheBuster", "formData", "nodeKey", "editor", "useLexicalComposerContext", "i18n", "t", "useTranslation", "createdInlineBlock", "fieldProps", "featureClientSchemaMap", "initialLexicalFormState", "permissions", "readOnly", "schemaPath", "setCreatedInlineBlock", "uuid", "uuidFromContext", "useEditorConfigContext", "fields", "parentDocumentFields", "useDocumentForm", "getFormState", "useServerFunctions", "editDepth", "useEditDepth", "firstTimeDrawer", "useRef", "setInitialState", "useState", "id", "formState", "hasMounted", "prevCacheBuster", "useEffect", "current", "CustomLabel", "setCustomLabel", "customComponents", "BlockLabel", "CustomBlock", "setCustomBlock", "Block", "drawerSlug", "formatDrawerSlug", "slug", "depth", "toggleDrawer", "useLexicalDrawer", "inlineBlockElemElemRef", "collectionSlug", "getDocPreferences", "globalSlug", "useDocumentInfo", "config", "useConfig", "componentMapRenderedBlockPath", "blockType", "blocksField", "clientBlock", "blockReferences", "blocksMap", "blocks", "clientBlockFields", "getKey", "length", "undefined", "removeInlineBlock", "useCallback", "update", "$getNodeByKey", "remove", "blockDisplayName", "labels", "singular", "getTranslation", "onChangeAbortControllerRef", "AbortController", "schemaFieldsPath", "abortController", "state", "data", "docPermissions", "docPreferences", "documentFormState", "deepCopyObjectSimpleWithoutReactComponents", "initialBlockData", "initialBlockFormState", "operation", "renderAllFields", "signal", "newFormStateData", "reduceFieldsToValues", "node", "$isInlineBlockNode", "newData", "setFields", "abortAndIgnore", "onChange", "prevFormState", "submit", "controller", "isStateOutOfSync", "Object", "keys", "some", "key", "value", "onFormSubmit", "RemoveButton", "useMemo", "_jsx", "Button", "buttonStyle", "className", "disabled", "icon", "onClick", "e", "preventDefault", "round", "size", "tooltip", "label", "EditButton", "el", "InlineBlockContainer", "children", "filter", "Boolean", "join", "ref", "Label", "_jsxs", "Form", "beforeSubmit", "disableValidationOnSubmit", "onSubmit", "EditDepthProvider", "Drawer", "title", "_Fragment", "RenderFields", "forceRender", "parentIndexPath", "parentPath", "parentSchemaPath", "FormSubmit", "programmaticSubmit", "ShimmerEffect", "height", "width", "isEditable"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{b as F}from"./chunk-BZZVLW4U.js";import{c as V}from"react/compiler-runtime";import{jsx as R}from"react/jsx-runtime";import{Drawer as q,EditDepthProvider as z,useModal as G}from"@payloadcms/ui";import"react";import{jsx as E,jsxs as O}from"react/jsx-runtime";import{Form as M,FormSubmit as v,RenderFields as T,useDocumentForm as $,useDocumentInfo as N,useServerFunctions as W,useTranslation as k}from"@payloadcms/ui";import{abortAndIgnore as P}from"@payloadcms/ui/shared";import{deepCopyObjectSimpleWithoutReactComponents as y}from"payload/shared";import{useCallback as B,useEffect as I,useRef as H,useState as L}from"react";import{v4 as U}from"uuid";var j=({data:c,featureKey:e,fieldMapOverride:u,handleDrawerSubmit:m,schemaFieldsPathOverride:r,schemaPath:f,schemaPathSuffix:d})=>{let{t:p}=k(),{id:s,collectionSlug:i,getDocPreferences:a,globalSlug:n}=N(),{fields:t}=$(),l=H(new AbortController),[o,h]=L(!1),{fieldProps:{featureClientSchemaMap:w}}=F(),{getFormState:S}=W(),C=r??`${f}.lexical_internal_feature.${e}${d?`.${d}`:""}`,b=u??w[e]?.[C];I(()=>{let g=new AbortController;return(async()=>{let{state:_}=await S({id:s,collectionSlug:i,data:c??{},docPermissions:{fields:!0},docPreferences:await a(),documentFormState:y(t),globalSlug:n,initialBlockData:c,operation:"update",renderAllFields:!0,schemaPath:C,signal:g.signal});h(_)})(),()=>{P(g)}},[C,s,c,S,i,n,a,t]);let x=B(async({formState:g})=>{P(l.current);let A=new AbortController;l.current=A;let{state:_}=await S({id:s,collectionSlug:i,docPermissions:{fields:!0},docPreferences:await a(),documentFormState:y(t),formState:g,globalSlug:n,initialBlockFormState:g,operation:"update",schemaPath:C,signal:A.signal});return _||g},[S,s,i,a,t,n,C]);return I(()=>()=>{P(l.current)},[]),o===!1?null:O(M,{beforeSubmit:[x],disableValidationOnSubmit:!0,fields:Array.isArray(b)?b:[],initialState:o,onChange:[x],onSubmit:m,uuid:U(),children:[E(T,{fields:Array.isArray(b)?b:[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:C,permissions:!0,readOnly:!1}),E(v,{children:p("fields:saveChanges")})]})};var Ce=c=>{let e=V(15),{className:u,data:m,drawerSlug:r,drawerTitle:f,featureKey:d,fieldMapOverride:p,handleDrawerSubmit:s,schemaFieldsPathOverride:i,schemaPath:a,schemaPathSuffix:n}=c,{closeModal:t}=G(),l=f??"",o;e[0]!==t||e[1]!==r||e[2]!==s?(o=(w,S)=>{t(r),setTimeout(()=>{s(w,S)},1)},e[0]=t,e[1]=r,e[2]=s,e[3]=o):o=e[3];let h;return e[4]!==u||e[5]!==m||e[6]!==r||e[7]!==d||e[8]!==p||e[9]!==i||e[10]!==a||e[11]!==n||e[12]!==l||e[13]!==o?(h=R(z,{children:R(q,{className:u,slug:r,title:l,children:R(j,{data:m,featureKey:d,fieldMapOverride:p,handleDrawerSubmit:o,schemaFieldsPathOverride:i,schemaPath:a,schemaPathSuffix:n})})}),e[4]=u,e[5]=m,e[6]=r,e[7]=d,e[8]=p,e[9]=i,e[10]=a,e[11]=n,e[12]=l,e[13]=o,e[14]=h):h=e[14],h};import{c as J}from"react/compiler-runtime";import{jsx as K}from"react/jsx-runtime";import{useAuth as Q,useConfig as X,useEntityVisibility as Y}from"@payloadcms/ui";import*as D from"react";var Z=(c,e)=>c.filter(({slug:u,admin:{enableRichTextRelationship:m},upload:r})=>e?.visibleEntities?.collections.includes(u)?e?.uploads?m&&!!r:r?!1:m:!1),we=c=>{let e=J(12),{children:u,FallbackComponent:m,uploads:r,...f}=c,d=r===void 0?!1:r,{config:p}=X(),{collections:s}=p,{user:i}=Q(),{visibleEntities:a}=Y(),n;e[0]!==s||e[1]!==d||e[2]!==i||e[3]!==a?(n=()=>Z(s,{uploads:d,user:i,visibleEntities:a}).map(ee),e[0]=s,e[1]=d,e[2]=i,e[3]=a,e[4]=n):n=e[4];let[t]=D.useState(n);if(!t.length)return m?K(m,{...f}):null;let l;if(e[5]!==u||e[6]!==t||e[7]!==f){let o;e[9]!==t||e[10]!==f?(o={...f,enabledCollectionSlugs:t},e[9]=t,e[10]=f,e[11]=o):o=e[11],l=D.cloneElement(u,o),e[5]=u,e[6]=t,e[7]=f,e[8]=l}else l=e[8];return l};function ee(c){let{slug:e}=c;return e}import{createCommand as te}from"lexical";var Re=te("INSERT_UPLOAD_WITH_DRAWER_COMMAND");export{Ce as a,we as b,Re as c};
2
+ //# sourceMappingURL=chunk-CYLMY5ZJ.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/utilities/fieldsDrawer/Drawer.tsx", "../../../src/utilities/fieldsDrawer/DrawerContent.tsx", "../../../src/features/relationship/client/utils/EnabledRelationshipsCondition.tsx", "../../../src/features/upload/client/drawer/commands.ts"],
4
+ "sourcesContent": ["'use client'\nimport type { ClientField, Data, FormState, JsonObject } from 'payload'\n\nimport { Drawer, EditDepthProvider, useModal } from '@payloadcms/ui'\nimport React from 'react'\n\nimport { DrawerContent } from './DrawerContent.js'\n\nexport type FieldsDrawerProps = {\n readonly className?: string\n readonly data?: Data\n readonly drawerSlug: string\n readonly drawerTitle?: string\n readonly featureKey: string\n readonly fieldMapOverride?: ClientField[]\n readonly handleDrawerSubmit: (fields: FormState, data: JsonObject) => void\n readonly schemaFieldsPathOverride?: string\n readonly schemaPath: string\n readonly schemaPathSuffix?: string\n}\n\n/**\n * This FieldsDrawer component can be used to easily create a Drawer that contains a form with fields within your feature.\n * The fields are taken directly from the schema map based on your `featureKey` and `schemaPathSuffix`. Thus, this can only\n * be used if you provide your field schema inside the `generateSchemaMap` prop of your feature.server.ts.\n */\nexport const FieldsDrawer: React.FC<FieldsDrawerProps> = ({\n className,\n data,\n drawerSlug,\n drawerTitle,\n featureKey,\n fieldMapOverride,\n handleDrawerSubmit,\n schemaFieldsPathOverride,\n schemaPath,\n schemaPathSuffix,\n}) => {\n const { closeModal } = useModal()\n // The Drawer only renders its children (and itself) if it's open. Thus, by extracting the main content\n // to DrawerContent, this should be faster\n return (\n <EditDepthProvider>\n <Drawer className={className} slug={drawerSlug} title={drawerTitle ?? ''}>\n <DrawerContent\n data={data}\n featureKey={featureKey}\n fieldMapOverride={fieldMapOverride}\n handleDrawerSubmit={(args, args2) => {\n // Simply close drawer - no need for useLexicalDrawer here as at this point,\n // we don't need to restore the cursor position. This is handled by the useEffect in useLexicalDrawer.\n closeModal(drawerSlug)\n\n // Actual drawer submit logic needs to be triggered after the drawer is closed.\n // That's because the lexical selection / cursor restore logic that is striggerer by\n // `useLexicalDrawer` neeeds to be triggered before any editor.update calls that may happen\n // in the `handleDrawerSubmit` function.\n setTimeout(() => {\n handleDrawerSubmit(args, args2)\n }, 1)\n }}\n schemaFieldsPathOverride={schemaFieldsPathOverride}\n schemaPath={schemaPath}\n schemaPathSuffix={schemaPathSuffix}\n />\n </Drawer>\n </EditDepthProvider>\n )\n}\n", "'use client'\nimport type { FormState } from 'payload'\n\nimport {\n Form,\n FormSubmit,\n RenderFields,\n useDocumentForm,\n useDocumentInfo,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport { deepCopyObjectSimpleWithoutReactComponents } from 'payload/shared'\nimport React, { useCallback, useEffect, useRef, useState } from 'react'\nimport { v4 as uuid } from 'uuid'\n\nimport type { FieldsDrawerProps } from './Drawer.js'\n\nimport { useEditorConfigContext } from '../../lexical/config/client/EditorConfigProvider.js'\n\nexport const DrawerContent: React.FC<Omit<FieldsDrawerProps, 'drawerSlug' | 'drawerTitle'>> = ({\n data,\n featureKey,\n fieldMapOverride,\n handleDrawerSubmit,\n schemaFieldsPathOverride,\n schemaPath,\n schemaPathSuffix,\n}) => {\n const { t } = useTranslation()\n const { id, collectionSlug, getDocPreferences, globalSlug } = useDocumentInfo()\n const { fields: parentDocumentFields } = useDocumentForm()\n\n const onChangeAbortControllerRef = useRef(new AbortController())\n\n const [initialState, setInitialState] = useState<false | FormState | undefined>(false)\n\n const {\n fieldProps: { featureClientSchemaMap },\n } = useEditorConfigContext()\n\n const { getFormState } = useServerFunctions()\n\n const schemaFieldsPath =\n schemaFieldsPathOverride ??\n `${schemaPath}.lexical_internal_feature.${featureKey}${schemaPathSuffix ? `.${schemaPathSuffix}` : ''}`\n\n const fields: any = fieldMapOverride ?? featureClientSchemaMap[featureKey]?.[schemaFieldsPath] // Field Schema\n\n useEffect(() => {\n const controller = new AbortController()\n\n const awaitInitialState = async () => {\n const { state } = await getFormState({\n id,\n collectionSlug,\n data: data ?? {},\n docPermissions: {\n fields: true,\n },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields),\n globalSlug,\n initialBlockData: data,\n operation: 'update',\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n setInitialState(state)\n }\n\n void awaitInitialState()\n\n return () => {\n abortAndIgnore(controller)\n }\n }, [\n schemaFieldsPath,\n id,\n data,\n getFormState,\n collectionSlug,\n globalSlug,\n getDocPreferences,\n parentDocumentFields,\n ])\n\n const onChange = useCallback(\n async ({ formState: prevFormState }: { formState: FormState }) => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n\n const controller = new AbortController()\n onChangeAbortControllerRef.current = controller\n\n const { state } = await getFormState({\n id,\n collectionSlug,\n docPermissions: {\n fields: true,\n },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields),\n formState: prevFormState,\n globalSlug,\n initialBlockFormState: prevFormState,\n operation: 'update',\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n if (!state) {\n return prevFormState\n }\n\n return state\n },\n [\n getFormState,\n id,\n collectionSlug,\n getDocPreferences,\n parentDocumentFields,\n globalSlug,\n schemaFieldsPath,\n ],\n )\n\n // cleanup effect\n useEffect(() => {\n return () => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [])\n\n if (initialState === false) {\n return null\n }\n\n return (\n <Form\n beforeSubmit={[onChange]}\n disableValidationOnSubmit\n fields={Array.isArray(fields) ? fields : []}\n initialState={initialState}\n onChange={[onChange]}\n onSubmit={handleDrawerSubmit}\n uuid={uuid()}\n >\n <RenderFields\n fields={Array.isArray(fields) ? fields : []}\n forceRender\n parentIndexPath=\"\"\n parentPath=\"\" // See Blocks feature path for details as for why this is empty\n parentSchemaPath={schemaFieldsPath}\n permissions={true}\n readOnly={false}\n />\n <FormSubmit>{t('fields:saveChanges')}</FormSubmit>\n </Form>\n )\n}\n", "'use client'\nimport type { ClientCollectionConfig, ClientUser, VisibleEntities } from 'payload'\n\nimport { useAuth, useConfig, useEntityVisibility } from '@payloadcms/ui'\nimport * as React from 'react'\n\ntype Options = {\n uploads: boolean\n user: ClientUser\n visibleEntities?: VisibleEntities\n}\n\ntype FilteredCollectionsT = (\n collections: ClientCollectionConfig[],\n options?: Options,\n) => ClientCollectionConfig[]\n\nconst filterRichTextCollections: FilteredCollectionsT = (collections, options) => {\n return collections.filter(({ slug, admin: { enableRichTextRelationship }, upload }) => {\n if (!options?.visibleEntities?.collections.includes(slug)) {\n return false\n }\n\n if (options?.uploads) {\n return enableRichTextRelationship && Boolean(upload) === true\n }\n\n return upload ? false : enableRichTextRelationship\n })\n}\n\nexport const EnabledRelationshipsCondition: React.FC<{\n children: any\n FallbackComponent?: React.FC\n uploads?: boolean\n}> = (props) => {\n const { children, FallbackComponent, uploads = false, ...rest } = props\n const {\n config: { collections },\n } = useConfig()\n const { user } = useAuth()\n const { visibleEntities } = useEntityVisibility()\n\n const [enabledCollectionSlugs] = React.useState(() =>\n filterRichTextCollections(collections, { uploads, user: user!, visibleEntities }).map(\n ({ slug }) => slug,\n ),\n )\n\n if (!enabledCollectionSlugs.length) {\n return FallbackComponent ? <FallbackComponent {...rest} /> : null\n }\n\n return React.cloneElement(children, { ...rest, enabledCollectionSlugs })\n}\n", "'use client'\nimport type { LexicalCommand } from 'lexical'\n\nimport { createCommand } from 'lexical'\n\nexport const INSERT_UPLOAD_WITH_DRAWER_COMMAND: LexicalCommand<{\n replace: { nodeKey: string } | false\n}> = createCommand('INSERT_UPLOAD_WITH_DRAWER_COMMAND')\n"],
5
+ "mappings": "wCAAA,OA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Z,EAAoBa,EAACb,EAAA,CAAA,GAAsBE,CAAI,CAAA,EAAA,KAAO,IAAAY,EAAA,GAAAhB,EAAA,CAAA,IAAAC,GAAAD,EAAA,CAAA,IAAAY,GAAAZ,EAAA,CAAA,IAAAI,EAAA,CAAA,IAAAa,EAAAjB,EAAA,CAAA,IAAAY,GAAAZ,EAAA,EAAA,IAAAI,GAG3Ba,EAAA,CAAA,GAAKb,EAAIQ,uBAAAA,CAAA,EAAyBZ,EAAA,CAAA,EAAAY,EAAAZ,EAAA,EAAA,EAAAI,EAAAJ,EAAA,EAAA,EAAAiB,GAAAA,EAAAjB,EAAA,EAAA,EAA/DgB,EAAAE,eAAmBjB,EAAUgB,CAAkC,EAAAjB,EAAA,CAAA,EAAAC,EAAAD,EAAA,CAAA,EAAAY,EAAAZ,EAAA,CAAA,EAAAI,EAAAJ,EAAA,CAAA,EAAAgB,CAAA,MAAAA,EAAAhB,EAAA,CAAA,EAAA,OAA/DgB,CAA+D,EAlBnE,SAAAL,GAAAR,EAAA,CAUE,GAAA,CAAAb,KAAAA,CAAA,EAAAa,EAAQ,OAAKb,CAAA,CC1CpB,OAAS6B,iBAAAA,OAAqB,UAEvB,IAAMC,GAERD,GAAc,mCAAA",
6
+ "names": ["c", "_c", "Drawer", "EditDepthProvider", "useModal", "Form", "FormSubmit", "RenderFields", "useDocumentForm", "useDocumentInfo", "useServerFunctions", "useTranslation", "abortAndIgnore", "deepCopyObjectSimpleWithoutReactComponents", "useCallback", "useEffect", "useRef", "useState", "v4", "uuid", "DrawerContent", "data", "featureKey", "fieldMapOverride", "handleDrawerSubmit", "schemaFieldsPathOverride", "schemaPath", "schemaPathSuffix", "t", "useTranslation", "id", "collectionSlug", "getDocPreferences", "globalSlug", "useDocumentInfo", "fields", "parentDocumentFields", "useDocumentForm", "onChangeAbortControllerRef", "useRef", "AbortController", "initialState", "setInitialState", "useState", "fieldProps", "featureClientSchemaMap", "useEditorConfigContext", "getFormState", "useServerFunctions", "schemaFieldsPath", "useEffect", "controller", "state", "docPermissions", "docPreferences", "documentFormState", "deepCopyObjectSimpleWithoutReactComponents", "initialBlockData", "operation", "renderAllFields", "signal", "abortAndIgnore", "onChange", "useCallback", "formState", "prevFormState", "current", "initialBlockFormState", "_jsxs", "Form", "beforeSubmit", "disableValidationOnSubmit", "Array", "isArray", "onSubmit", "uuid", "_jsx", "RenderFields", "forceRender", "parentIndexPath", "parentPath", "parentSchemaPath", "permissions", "readOnly", "FormSubmit", "FieldsDrawer", "t0", "$", "_c", "className", "data", "drawerSlug", "drawerTitle", "featureKey", "fieldMapOverride", "handleDrawerSubmit", "schemaFieldsPathOverride", "schemaPath", "schemaPathSuffix", "closeModal", "useModal", "t1", "t2", "args", "args2", "setTimeout", "t3", "_jsx", "EditDepthProvider", "children", "Drawer", "slug", "title", "DrawerContent", "c", "_c", "useAuth", "useConfig", "useEntityVisibility", "React", "filterRichTextCollections", "collections", "options", "filter", "slug", "admin", "enableRichTextRelationship", "upload", "visibleEntities", "includes", "uploads", "Boolean", "EnabledRelationshipsCondition", "props", "$", "children", "FallbackComponent", "t0", "rest", "undefined", "config", "t1", "user", "t2", "map", "_temp", "enabledCollectionSlugs", "useState", "length", "_jsx", "t3", "t4", "cloneElement", "createCommand", "INSERT_UPLOAD_WITH_DRAWER_COMMAND"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use client";import{a as S,b as y,c as R}from"./chunk-CYLMY5ZJ.js";import{a as x}from"./chunk-INBEEENE.js";import{a as N}from"./chunk-F26IQ5RE.js";import{b as p}from"./chunk-BZZVLW4U.js";import{jsx as t,jsxs as n}from"react/jsx-runtime";import{useLexicalComposerContext as Y}from"@lexical/react/LexicalComposerContext.js";import{getTranslation as E}from"@payloadcms/translations";import{Button as h,formatDrawerSlug as Z,Thumbnail as ee,useConfig as te,useEditDepth as ae,usePayloadAPI as oe,useTranslation as le}from"@payloadcms/ui";import{$getNodeByKey as P}from"lexical";import{isImage as ie}from"payload/shared";import{useCallback as f,useId as re,useReducer as se,useRef as ne,useState as de}from"react";var e="lexical-upload",T={depth:0},ce=d=>{let{data:{fields:U,relationTo:g,value:c},nodeKey:i}=d;if(typeof c=="object")throw new Error("Upload value should be a string or number. The Lexical Upload component should not receive the populated value object.");let{config:{routes:{api:L},serverURL:F},getEntityConfig:j}=te(),I=ne(null),{uuid:z}=p(),B=ae(),[o]=Y(),{editorConfig:k,fieldProps:{readOnly:u,schemaPath:A}}=p(),{i18n:_,t:r}=le(),[b,O]=se(s=>s+1,0),[l]=de(()=>j({collectionSlug:g})),K=re(),w=Z({slug:"lexical-upload-drawer-"+z+K,depth:B}),{toggleDrawer:M}=x(w,!0),{closeDocumentDrawer:D,DocumentDrawer:W,DocumentDrawerToggler:H}=N({id:c,collectionSlug:l.slug}),[{data:a},{setParams:v}]=oe(`${F}${L}/${l.slug}/${c}`,{initialParams:T}),C=a?.thumbnailURL||a?.url,q=f(()=>{o.update(()=>{P(i)?.remove()})},[o,i]),G=f(s=>{v({...T,cacheBust:b}),O(),D()},[v,b,D]),$=k?.resolvedFeatureMap?.get("upload")?.sanitizedClientFeatureProps.collections?.[l.slug]?.hasExtraFields,J=f((s,V)=>{o.update(()=>{let m=P(i);if(m){let X={...m.getData(),fields:V};m.setData(X)}})},[o,i]),Q=C&&a?.width&&a?.height?a.width>a.height?"landscape":"portrait":"landscape";return n("div",{className:`${e} ${e}--${Q}`,"data-filename":a?.filename,ref:I,children:[n("div",{className:`${e}__card`,children:[n("div",{className:`${e}__media`,children:[t(ee,{collectionSlug:g,fileSrc:ie(a?.mimeType)?C:null,height:a?.height,size:"none",width:a?.width}),o.isEditable()&&t("div",{className:`${e}__overlay ${e}__floater`,children:n("div",{className:`${e}__actions`,role:"toolbar",children:[$?t(h,{buttonStyle:"icon-label",className:`${e}__upload-drawer-toggler`,disabled:u,el:"button",icon:"edit",onClick:M,round:!0,size:"medium",tooltip:r("fields:editRelationship")}):null,t(h,{buttonStyle:"icon-label",className:`${e}__swap-drawer-toggler`,disabled:u,el:"button",icon:"swap",onClick:()=>{o.dispatchCommand(R,{replace:{nodeKey:i}})},round:!0,size:"medium",tooltip:r("fields:swapUpload")}),t(h,{buttonStyle:"icon-label",className:`${e}__removeButton`,disabled:u,icon:"x",onClick:s=>{s.preventDefault(),q()},round:!0,size:"medium",tooltip:r("fields:removeUpload")})]})})]}),n("div",{className:`${e}__metaOverlay ${e}__floater`,children:[t(H,{className:`${e}__doc-drawer-toggler`,children:t("strong",{className:`${e}__filename`,children:a?.filename||r("general:untitled")})}),t("div",{className:`${e}__collectionLabel`,children:E(l.labels.singular,_)})]})]}),c?t(W,{onSave:G}):null,$?t(S,{data:U,drawerSlug:w,drawerTitle:r("general:editLabel",{label:E(l.labels.singular,_)}),featureKey:"upload",handleDrawerSubmit:J,schemaPath:A,schemaPathSuffix:l.slug}):null]})},Se=d=>t(y,{...d,uploads:!0,children:t(ce,{...d})});export{Se as UploadComponent};
2
+ //# sourceMappingURL=component-VDJI45F2.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/features/upload/client/component/index.tsx"],
4
+ "sourcesContent": ["'use client'\nimport type { ClientCollectionConfig, Data, FormState, JsonObject } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n formatDrawerSlug,\n Thumbnail,\n useConfig,\n useEditDepth,\n usePayloadAPI,\n useTranslation,\n} from '@payloadcms/ui'\nimport { $getNodeByKey, type ElementFormatType } from 'lexical'\nimport { isImage } from 'payload/shared'\nimport React, { useCallback, useId, useReducer, useRef, useState } from 'react'\n\nimport type { BaseClientFeatureProps } from '../../../typesClient.js'\nimport type { UploadData } from '../../server/nodes/UploadNode.js'\nimport type { UploadFeaturePropsClient } from '../index.js'\nimport type { UploadNode } from '../nodes/UploadNode.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport { FieldsDrawer } from '../../../../utilities/fieldsDrawer/Drawer.js'\nimport { useLexicalDocumentDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDocumentDrawer.js'\nimport { useLexicalDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport { EnabledRelationshipsCondition } from '../../../relationship/client/utils/EnabledRelationshipsCondition.js'\nimport { INSERT_UPLOAD_WITH_DRAWER_COMMAND } from '../drawer/commands.js'\nimport './index.scss'\n\nconst baseClass = 'lexical-upload'\n\nconst initialParams = {\n depth: 0,\n}\n\nexport type ElementProps = {\n data: UploadData\n format?: ElementFormatType\n nodeKey: string\n}\n\nconst Component: React.FC<ElementProps> = (props) => {\n const {\n data: { fields, relationTo, value },\n nodeKey,\n } = props\n\n if (typeof value === 'object') {\n throw new Error(\n 'Upload value should be a string or number. The Lexical Upload component should not receive the populated value object.',\n )\n }\n\n const {\n config: {\n routes: { api },\n serverURL,\n },\n getEntityConfig,\n } = useConfig()\n const uploadRef = useRef<HTMLDivElement | null>(null)\n const { uuid } = useEditorConfigContext()\n const editDepth = useEditDepth()\n const [editor] = useLexicalComposerContext()\n\n const {\n editorConfig,\n fieldProps: { readOnly, schemaPath },\n } = useEditorConfigContext()\n\n const { i18n, t } = useTranslation()\n const [cacheBust, dispatchCacheBust] = useReducer((state) => state + 1, 0)\n const [relatedCollection] = useState<ClientCollectionConfig>(() =>\n getEntityConfig({ collectionSlug: relationTo }),\n )\n\n const componentID = useId()\n\n const extraFieldsDrawerSlug = formatDrawerSlug({\n slug: `lexical-upload-drawer-` + uuid + componentID, // There can be multiple upload components, each with their own drawer, in one single editor => separate them by componentID\n depth: editDepth,\n })\n\n // Need to use hook to initialize useEffect that restores cursor position\n const { toggleDrawer } = useLexicalDrawer(extraFieldsDrawerSlug, true)\n\n const { closeDocumentDrawer, DocumentDrawer, DocumentDrawerToggler } = useLexicalDocumentDrawer({\n id: value,\n collectionSlug: relatedCollection.slug,\n })\n\n // Get the referenced document\n const [{ data }, { setParams }] = usePayloadAPI(\n `${serverURL}${api}/${relatedCollection.slug}/${value}`,\n { initialParams },\n )\n\n const thumbnailSRC = data?.thumbnailURL || data?.url\n\n const removeUpload = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey)?.remove()\n })\n }, [editor, nodeKey])\n\n const updateUpload = useCallback(\n (data: Data) => {\n setParams({\n ...initialParams,\n cacheBust, // do this to get the usePayloadAPI to re-fetch the data even though the URL string hasn't changed\n })\n\n dispatchCacheBust()\n closeDocumentDrawer()\n },\n [setParams, cacheBust, closeDocumentDrawer],\n )\n\n const hasExtraFields = (\n editorConfig?.resolvedFeatureMap?.get('upload')\n ?.sanitizedClientFeatureProps as BaseClientFeatureProps<UploadFeaturePropsClient>\n ).collections?.[relatedCollection.slug]?.hasExtraFields\n\n const onExtraFieldsDrawerSubmit = useCallback(\n (_: FormState, data: JsonObject) => {\n // Update lexical node (with key nodeKey) with new data\n editor.update(() => {\n const uploadNode: null | UploadNode = $getNodeByKey(nodeKey)\n if (uploadNode) {\n const newData: UploadData = {\n ...uploadNode.getData(),\n fields: data,\n }\n uploadNode.setData(newData)\n }\n })\n },\n [editor, nodeKey],\n )\n\n const aspectRatio =\n thumbnailSRC && data?.width && data?.height\n ? data.width > data.height\n ? 'landscape'\n : 'portrait'\n : 'landscape'\n\n return (\n <div\n className={`${baseClass} ${baseClass}--${aspectRatio}`}\n data-filename={data?.filename}\n ref={uploadRef}\n >\n <div className={`${baseClass}__card`}>\n <div className={`${baseClass}__media`}>\n <Thumbnail\n collectionSlug={relationTo}\n fileSrc={isImage(data?.mimeType) ? thumbnailSRC : null}\n height={data?.height}\n size=\"none\"\n width={data?.width}\n />\n\n {editor.isEditable() && (\n <div className={`${baseClass}__overlay ${baseClass}__floater`}>\n <div className={`${baseClass}__actions`} role=\"toolbar\">\n {hasExtraFields ? (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__upload-drawer-toggler`}\n disabled={readOnly}\n el=\"button\"\n icon=\"edit\"\n onClick={toggleDrawer}\n round\n size=\"medium\"\n tooltip={t('fields:editRelationship')}\n />\n ) : null}\n\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__swap-drawer-toggler`}\n disabled={readOnly}\n el=\"button\"\n icon=\"swap\"\n onClick={() => {\n editor.dispatchCommand(INSERT_UPLOAD_WITH_DRAWER_COMMAND, {\n replace: { nodeKey },\n })\n }}\n round\n size=\"medium\"\n tooltip={t('fields:swapUpload')}\n />\n\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__removeButton`}\n disabled={readOnly}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeUpload()\n }}\n round\n size=\"medium\"\n tooltip={t('fields:removeUpload')}\n />\n </div>\n </div>\n )}\n </div>\n\n <div className={`${baseClass}__metaOverlay ${baseClass}__floater`}>\n <DocumentDrawerToggler className={`${baseClass}__doc-drawer-toggler`}>\n <strong className={`${baseClass}__filename`}>\n {data?.filename || t('general:untitled')}\n </strong>\n </DocumentDrawerToggler>\n <div className={`${baseClass}__collectionLabel`}>\n {getTranslation(relatedCollection.labels.singular, i18n)}\n </div>\n </div>\n </div>\n\n {value ? <DocumentDrawer onSave={updateUpload} /> : null}\n {hasExtraFields ? (\n <FieldsDrawer\n data={fields}\n drawerSlug={extraFieldsDrawerSlug}\n drawerTitle={t('general:editLabel', {\n label: getTranslation(relatedCollection.labels.singular, i18n),\n })}\n featureKey=\"upload\"\n handleDrawerSubmit={onExtraFieldsDrawerSubmit}\n schemaPath={schemaPath}\n schemaPathSuffix={relatedCollection.slug}\n />\n ) : null}\n </div>\n )\n}\n\nexport const UploadComponent = (props: ElementProps): React.ReactNode => {\n return (\n <EnabledRelationshipsCondition {...props} uploads>\n <Component {...props} />\n </EnabledRelationshipsCondition>\n )\n}\n"],
5
+ "mappings": "6OAGA,OAASA,6BAAAA,MAAiC,2CAC1C,OAASC,kBAAAA,MAAsB,2BAC/B,OACEC,UAAAA,EACAC,oBAAAA,EACAC,aAAAA,GACAC,aAAAA,GACAC,gBAAAA,GACAC,iBAA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eyD,OAAQ3C,IAAmB,KACnDC,EACCkB,EAACyB,EAAA,CACCpG,KAAMC,EACNoG,WAAYjE,EACZkE,YAAa7E,EAAE,oBAAqB,CAClC8E,MAAOP,EAAejE,EAAkBkE,OAAOC,SAAU1E,CAAA,CAC3D,CAAA,EACAgF,WAAW,SACXC,mBAAoB3C,EACpBvC,WAAYA,EACZmF,iBAAkB3E,EAAkBO,OAEpC,IAAA,GAGV,EAEaqE,GAAmB5G,GAE5B4E,EAACiC,EAAA,CAA+B,GAAG7G,EAAO8G,QAAO,YAC/ClC,EAAC7E,GAAA,CAAW,GAAGC",
6
+ "names": ["useLexicalComposerContext", "getTranslation", "Button", "formatDrawerSlug", "Thumbnail", "useConfig", "useEditDepth", "usePayloadAPI", "useTranslation", "$getNodeByKey", "isImage", "useCallback", "useId", "useReducer", "useRef", "useState", "baseClass", "initialParams", "depth", "Component", "props", "data", "fields", "relationTo", "value", "nodeKey", "Error", "config", "routes", "api", "serverURL", "getEntityConfig", "useConfig", "uploadRef", "useRef", "uuid", "useEditorConfigContext", "editDepth", "useEditDepth", "editor", "useLexicalComposerContext", "editorConfig", "fieldProps", "readOnly", "schemaPath", "i18n", "t", "useTranslation", "cacheBust", "dispatchCacheBust", "useReducer", "state", "relatedCollection", "useState", "collectionSlug", "componentID", "useId", "extraFieldsDrawerSlug", "formatDrawerSlug", "slug", "toggleDrawer", "useLexicalDrawer", "closeDocumentDrawer", "DocumentDrawer", "DocumentDrawerToggler", "useLexicalDocumentDrawer", "id", "setParams", "usePayloadAPI", "thumbnailSRC", "thumbnailURL", "url", "removeUpload", "useCallback", "update", "$getNodeByKey", "remove", "updateUpload", "hasExtraFields", "resolvedFeatureMap", "get", "sanitizedClientFeatureProps", "collections", "onExtraFieldsDrawerSubmit", "_", "uploadNode", "newData", "getData", "setData", "aspectRatio", "width", "height", "_jsxs", "className", "filename", "ref", "_jsx", "Thumbnail", "fileSrc", "isImage", "mimeType", "size", "isEditable", "role", "Button", "buttonStyle", "disabled", "el", "icon", "onClick", "round", "tooltip", "dispatchCommand", "INSERT_UPLOAD_WITH_DRAWER_COMMAND", "replace", "e", "preventDefault", "getTranslation", "labels", "singular", "onSave", "FieldsDrawer", "drawerSlug", "drawerTitle", "label", "featureKey", "handleDrawerSubmit", "schemaPathSuffix", "UploadComponent", "EnabledRelationshipsCondition", "uploads"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use client";import{a,b}from"./chunk-3BY5IZJD.js";import"./chunk-INBEEENE.js";import"./chunk-BZZVLW4U.js";export{b as InlineBlockComponent,a as useInlineBlockComponentContext};
2
+ //# sourceMappingURL=componentInline-7TPI7ZBC.js.map
@@ -75,9 +75,6 @@ export { BlockEditButton } from '../../features/blocks/client/component/componen
75
75
  export { BlockRemoveButton } from '../../features/blocks/client/component/components/BlockRemoveButton.js';
76
76
  export { useBlockComponentContext } from '../../features/blocks/client/component/BlockContent.js';
77
77
  export { getRestPopulateFn } from '../../features/converters/utilities/restPopulateFn.js';
78
- export { codeConverterClient } from '../../features/blocks/premade/CodeBlock/converterClient.js';
79
- export { CodeComponent } from '../../features/blocks/premade/CodeBlock/Component/Code.js';
80
- export { CodeBlockBlockComponent } from '../../features/blocks/premade/CodeBlock/Component/Block.js';
81
78
  export { RenderLexical } from '../../field/RenderLexical/index.js';
82
79
  export { buildEditorState } from '../../utilities/buildEditorState.js';
83
80
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exports/client/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,4BAA4B,EAAE,MAAM,+CAA+C,CAAA;AAE5F,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAA;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAA;AACnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAA;AAC3E,OAAO,EACL,oBAAoB,EACpB,2BAA2B,GAC5B,MAAM,iDAAiD,C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