@payloadcms/richtext-lexical 3.2.1 → 3.2.2-canary.380cfb0

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 (44) hide show
  1. package/dist/exports/client/{chunk-WS6E5WE4.js → chunk-RAIJNT4Z.js} +2 -2
  2. package/dist/exports/client/chunk-RAIJNT4Z.js.map +7 -0
  3. package/dist/exports/client/componentInline-PJ7YLXB5.js +2 -0
  4. package/dist/exports/client/index.js +1 -1
  5. package/dist/exports/react/components/RichText/converter/converters/list.d.ts.map +1 -1
  6. package/dist/exports/react/components/RichText/converter/converters/list.js +1 -6
  7. package/dist/exports/react/components/RichText/converter/converters/list.js.map +1 -1
  8. package/dist/exports/react/components/RichText/converter/converters/text.d.ts.map +1 -1
  9. package/dist/exports/react/components/RichText/converter/converters/text.js +1 -4
  10. package/dist/exports/react/components/RichText/converter/converters/text.js.map +1 -1
  11. package/dist/exports/react/components/RichText/converter/defaultConverters.d.ts +2 -1
  12. package/dist/exports/react/components/RichText/converter/defaultConverters.d.ts.map +1 -1
  13. package/dist/exports/react/components/RichText/converter/defaultConverters.js.map +1 -1
  14. package/dist/exports/react/components/RichText/converter/index.js +1 -1
  15. package/dist/exports/react/components/RichText/converter/index.js.map +1 -1
  16. package/dist/exports/react/components/RichText/converter/types.d.ts +26 -8
  17. package/dist/exports/react/components/RichText/converter/types.d.ts.map +1 -1
  18. package/dist/exports/react/components/RichText/converter/types.js.map +1 -1
  19. package/dist/exports/react/components/RichText/index.css +4 -0
  20. package/dist/exports/react/components/RichText/index.d.ts +14 -3
  21. package/dist/exports/react/components/RichText/index.d.ts.map +1 -1
  22. package/dist/exports/react/components/RichText/index.js +2 -1
  23. package/dist/exports/react/components/RichText/index.js.map +1 -1
  24. package/dist/features/blocks/client/componentInline/index.d.ts +1 -1
  25. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  26. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  27. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts +3 -14
  28. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts.map +1 -1
  29. package/dist/features/blocks/client/nodes/InlineBlocksNode.js.map +1 -1
  30. package/dist/features/blocks/server/graphQLPopulationPromise.d.ts +1 -1
  31. package/dist/features/blocks/server/graphQLPopulationPromise.js.map +1 -1
  32. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts +4 -4
  33. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts.map +1 -1
  34. package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
  35. package/dist/features/blocks/server/validate.d.ts +1 -1
  36. package/dist/features/blocks/server/validate.d.ts.map +1 -1
  37. package/dist/features/blocks/server/validate.js.map +1 -1
  38. package/dist/nodeTypes.d.ts +1 -1
  39. package/dist/nodeTypes.d.ts.map +1 -1
  40. package/dist/nodeTypes.js.map +1 -1
  41. package/package.json +7 -7
  42. package/dist/exports/client/chunk-WS6E5WE4.js.map +0 -7
  43. package/dist/exports/client/componentInline-7YSGAB45.js +0 -2
  44. /package/dist/exports/client/{componentInline-7YSGAB45.js.map → componentInline-PJ7YLXB5.js.map} +0 -0
@@ -1,2 +1,2 @@
1
- import{a as Z}from"./chunk-2CYU43GM.js";import{b as X}from"./chunk-CUIBIFW2.js";import{jsx as i,jsxs as I,Fragment as Se}from"react/jsx-runtime";import w,{createContext as _e,useCallback as k,useEffect as T,useMemo as N,useRef as ee}from"react";import{useLexicalComposerContext as Be}from"@lexical/react/LexicalComposerContext";import{useLexicalNodeSelection as De}from"@lexical/react/useLexicalNodeSelection";import{mergeRegister as ye}from"@lexical/utils";import{getTranslation as te}from"@payloadcms/translations";import{Button as ne,Drawer as Ie,EditDepthProvider as Ne,Form as we,formatDrawerSlug as ve,FormSubmit as Fe,RenderFields as Oe,ShimmerEffect as Ee,useDocumentInfo as Pe,useEditDepth as $e,useServerFunctions as Me,useTranslation as Le}from"@payloadcms/ui";import{abortAndIgnore as A}from"@payloadcms/ui/shared";import{$getNodeByKey as oe,$getSelection as Te,$isNodeSelection as Ae,CLICK_COMMAND as Re,COMMAND_PRIORITY_LOW as R,KEY_BACKSPACE_COMMAND as je,KEY_DELETE_COMMAND as Ke}from"lexical";import{reduceFieldsToValues as Je}from"payload/shared";import{v4 as ze}from"uuid";import{jsx as ke}from"react/jsx-runtime";import ge from"bson-objectid";import Ce from"react";import pe from"bson-objectid";import{DecoratorNode as fe}from"lexical";var b=class extends fe{__fields;constructor({fields:e,key:n}){super(n),this.__fields=e}static clone(e){return new this({fields:e.__fields,key:e.__key})}static getType(){return"inlineBlock"}static importDOM(){return{}}static importJSON(e){return be(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,n){return null}exportDOM(){let e=document.createElement("span");e.classList.add("inline-block-container");let n=document.createTextNode(this.getTextContent());return e.append(n),{element:e}}exportJSON(){return{type:"inlineBlock",fields:this.getFields(),version:1}}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}isInline(){return!0}setFields(e){let n=this.getWritable();n.__fields=e}updateDOM(){return!1}};function be(r){return new b({fields:{...r,id:r?.id||new pe.default().toHexString()}})}var xe=Ce.lazy(()=>import("./componentInline-7YSGAB45.js").then(r=>({default:r.InlineBlockComponent}))),y=class extends b{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return he(e.fields)}decorate(e,n){return ke(xe,{formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function he(r){return new y({fields:{...r,id:r?.id||new ge.default().toHexString()}})}function L(r){return r instanceof y}var m="inline-block",re=_e({initialState:!1}),ft=()=>w.useContext(re),bt=r=>{let{formData:e,nodeKey:n}=r,[s]=Be(),{i18n:v,t:d}=Le(),{fieldProps:{featureClientSchemaMap:le,initialLexicalFormState:ie,permissions:se,readOnly:g,schemaPath:j},uuid:ce}=X(),{getFormState:C}=Me(),ae=$e(),[c,ue]=w.useState(ie?.[e.id]?.formState),[F,K]=w.useState(c?._components?.customComponents?.BlockLabel),[J,z]=w.useState(c?._components?.customComponents?.Block),Y=ve({slug:"lexical-inlineBlocks-create-"+ce,depth:ae}),{toggleDrawer:O}=Z(Y,!0),E=ee(null),[a,x,P]=De(n),{id:h,collectionSlug:S,getDocPreferences:_,globalSlug:B}=Pe(),de=`${j}.lexical_internal_feature.blocks.lexical_inline_blocks.${e.blockType}`,u=le.blocks[de][0].blocks[0],H=k(()=>{s.update(()=>{oe(n)?.remove()})},[s,n]),$=k(t=>{let l=Te();return a&&Ae(l)&&(t.preventDefault(),s.update(()=>{l.getNodes().forEach(o=>{L(o)&&o.remove()})})),!1},[s,a]),V=k(t=>{let l=t;return l.target===E.current||E.current?.contains(l.target)?(l.shiftKey?x(!a):a||(P(),x(!0)),!0):!1},[a,x,P]);T(()=>ye(s.registerCommand(Re,V,R),s.registerCommand(Ke,$,R),s.registerCommand(je,$,R)),[P,s,a,n,$,x,V]);let p=u?.labels?.singular?te(u.labels.singular,v):u?.slug,M=ee(new AbortController),f=`${j}.lexical_internal_feature.blocks.lexical_inline_blocks.${u?.slug}.fields`;T(()=>{let t=new AbortController;return e&&!c&&(async()=>{let{state:o}=await C({id:h,collectionSlug:S,data:e,docPermissions:{fields:!0},docPreferences:await _(),globalSlug:B,operation:"update",renderAllFields:!0,schemaPath:f,signal:t.signal});o&&(ue(o),K(o._components?.customComponents?.BlockLabel),z(o._components?.customComponents?.Block))})(),()=>{A(t)}},[C,f,h,e,c,S,B,_]);let W=k(async({formState:t,submit:l})=>{A(M.current);let o=new AbortController;M.current=o;let{state:D}=await C({id:h,collectionSlug:S,docPermissions:{fields:!0},docPreferences:await _(),formState:t,globalSlug:B,operation:"update",renderAllFields:!!l,schemaPath:f,signal:o.signal});return D?(l&&(K(D._components?.customComponents?.BlockLabel),z(D._components?.customComponents?.Block)),D):t},[C,h,S,_,B,f]);T(()=>()=>{A(M.current)},[]);let me=k(t=>{let l=Je(t);l.blockType=e.blockType,s.update(()=>{let o=oe(n);o&&L(o)&&o.setFields(l)})},[s,n,e]),q=N(()=>()=>i(ne,{buttonStyle:"icon-label",className:`${m}__removeButton`,disabled:g,icon:"x",onClick:t=>{t.preventDefault(),H()},round:!0,size:"small",tooltip:d("lexical:blocks:inlineBlocks:remove",{label:p})}),[p,g,H,d]),G=N(()=>()=>i(ne,{buttonStyle:"icon-label",className:`${m}__editButton`,disabled:g,el:"button",icon:"edit",onClick:()=>{O()},round:!0,size:"small",tooltip:d("lexical:blocks:inlineBlocks:edit",{label:p})}),[p,g,d,O]),Q=N(()=>({children:t})=>i("div",{className:[m,m+"-"+e.blockType,a&&`${m}--selected`].filter(Boolean).join(" "),ref:E,children:t}),[e.blockType,a]),U=N(()=>F?()=>F:()=>i("div",{children:te(u.labels.singular,v)}),[F,u.labels,v]);return I(we,{beforeSubmit:[async({formState:t})=>await W({formState:t,submit:!0})],disableValidationOnSubmit:!0,fields:u.fields,initialState:c||{},onChange:[W],onSubmit:t=>{me(t),O()},uuid:ze(),children:[i(Ne,{children:i(Ie,{className:"",slug:Y,title:d(`lexical:blocks:inlineBlocks:${e?.id?"edit":"create"}`,{label:p??d("lexical:blocks:inlineBlocks:label")}),children:c?I(Se,{children:[i(Oe,{fields:u.fields,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:f,permissions:se,readOnly:!1}),i(Fe,{children:d("fields:saveChanges")})]}):null})}),J?i(re.Provider,{value:{EditButton:G,initialState:c,InlineBlockContainer:Q,Label:U,nodeKey:n,RemoveButton:q},children:J}):I(Q,{children:[c?i(U,{}):i(Ee,{height:"15px",width:"40px"}),s.isEditable()?I("div",{className:`${m}__actions`,children:[i(G,{}),i(q,{})]}):null]})]})};export{ft as a,bt as b,y as c,he as d,L as e};
2
- //# sourceMappingURL=chunk-WS6E5WE4.js.map
1
+ import{a as Z}from"./chunk-2CYU43GM.js";import{b as X}from"./chunk-CUIBIFW2.js";import{jsx as i,jsxs as I,Fragment as Se}from"react/jsx-runtime";import w,{createContext as _e,useCallback as k,useEffect as T,useMemo as N,useRef as ee}from"react";import{useLexicalComposerContext as Be}from"@lexical/react/LexicalComposerContext";import{useLexicalNodeSelection as De}from"@lexical/react/useLexicalNodeSelection";import{mergeRegister as ye}from"@lexical/utils";import{getTranslation as te}from"@payloadcms/translations";import{Button as ne,Drawer as Ie,EditDepthProvider as Ne,Form as we,formatDrawerSlug as ve,FormSubmit as Fe,RenderFields as Oe,ShimmerEffect as Ee,useDocumentInfo as Pe,useEditDepth as $e,useServerFunctions as Me,useTranslation as Le}from"@payloadcms/ui";import{abortAndIgnore as A}from"@payloadcms/ui/shared";import{$getNodeByKey as oe,$getSelection as Te,$isNodeSelection as Ae,CLICK_COMMAND as Re,COMMAND_PRIORITY_LOW as R,KEY_BACKSPACE_COMMAND as je,KEY_DELETE_COMMAND as Ke}from"lexical";import{reduceFieldsToValues as Je}from"payload/shared";import{v4 as ze}from"uuid";import{jsx as ke}from"react/jsx-runtime";import ge from"bson-objectid";import Ce from"react";import pe from"bson-objectid";import{DecoratorNode as fe}from"lexical";var b=class extends fe{__fields;constructor({fields:e,key:n}){super(n),this.__fields=e}static clone(e){return new this({fields:e.__fields,key:e.__key})}static getType(){return"inlineBlock"}static importDOM(){return{}}static importJSON(e){return be(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,n){return null}exportDOM(){let e=document.createElement("span");e.classList.add("inline-block-container");let n=document.createTextNode(this.getTextContent());return e.append(n),{element:e}}exportJSON(){return{type:"inlineBlock",fields:this.getFields(),version:1}}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}isInline(){return!0}setFields(e){let n=this.getWritable();n.__fields=e}updateDOM(){return!1}};function be(r){return new b({fields:{...r,id:r?.id||new pe.default().toHexString()}})}var xe=Ce.lazy(()=>import("./componentInline-PJ7YLXB5.js").then(r=>({default:r.InlineBlockComponent}))),y=class extends b{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return he(e.fields)}decorate(e,n){return ke(xe,{formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function he(r){return new y({fields:{...r,id:r?.id||new ge.default().toHexString()}})}function L(r){return r instanceof y}var m="inline-block",re=_e({initialState:!1}),ft=()=>w.useContext(re),bt=r=>{let{formData:e,nodeKey:n}=r,[s]=Be(),{i18n:v,t:d}=Le(),{fieldProps:{featureClientSchemaMap:le,initialLexicalFormState:ie,permissions:se,readOnly:g,schemaPath:j},uuid:ce}=X(),{getFormState:C}=Me(),ae=$e(),[c,ue]=w.useState(ie?.[e.id]?.formState),[F,K]=w.useState(c?._components?.customComponents?.BlockLabel),[J,z]=w.useState(c?._components?.customComponents?.Block),Y=ve({slug:"lexical-inlineBlocks-create-"+ce,depth:ae}),{toggleDrawer:O}=Z(Y,!0),E=ee(null),[a,x,P]=De(n),{id:h,collectionSlug:S,getDocPreferences:_,globalSlug:B}=Pe(),de=`${j}.lexical_internal_feature.blocks.lexical_inline_blocks.${e.blockType}`,u=le.blocks[de][0].blocks[0],H=k(()=>{s.update(()=>{oe(n)?.remove()})},[s,n]),$=k(t=>{let l=Te();return a&&Ae(l)&&(t.preventDefault(),s.update(()=>{l.getNodes().forEach(o=>{L(o)&&o.remove()})})),!1},[s,a]),V=k(t=>{let l=t;return l.target===E.current||E.current?.contains(l.target)?(l.shiftKey?x(!a):a||(P(),x(!0)),!0):!1},[a,x,P]);T(()=>ye(s.registerCommand(Re,V,R),s.registerCommand(Ke,$,R),s.registerCommand(je,$,R)),[P,s,a,n,$,x,V]);let p=u?.labels?.singular?te(u.labels.singular,v):u?.slug,M=ee(new AbortController),f=`${j}.lexical_internal_feature.blocks.lexical_inline_blocks.${u?.slug}.fields`;T(()=>{let t=new AbortController;return e&&!c&&(async()=>{let{state:o}=await C({id:h,collectionSlug:S,data:e,docPermissions:{fields:!0},docPreferences:await _(),globalSlug:B,operation:"update",renderAllFields:!0,schemaPath:f,signal:t.signal});o&&(ue(o),K(o._components?.customComponents?.BlockLabel),z(o._components?.customComponents?.Block))})(),()=>{A(t)}},[C,f,h,e,c,S,B,_]);let W=k(async({formState:t,submit:l})=>{A(M.current);let o=new AbortController;M.current=o;let{state:D}=await C({id:h,collectionSlug:S,docPermissions:{fields:!0},docPreferences:await _(),formState:t,globalSlug:B,operation:"update",renderAllFields:!!l,schemaPath:f,signal:o.signal});return D?(l&&(K(D._components?.customComponents?.BlockLabel),z(D._components?.customComponents?.Block)),D):t},[C,h,S,_,B,f]);T(()=>()=>{A(M.current)},[]);let me=k(t=>{let l=Je(t);l.blockType=e.blockType,s.update(()=>{let o=oe(n);o&&L(o)&&o.setFields(l)})},[s,n,e]),q=N(()=>()=>i(ne,{buttonStyle:"icon-label",className:`${m}__removeButton`,disabled:g,icon:"x",onClick:t=>{t.preventDefault(),H()},round:!0,size:"small",tooltip:d("lexical:blocks:inlineBlocks:remove",{label:p})}),[p,g,H,d]),G=N(()=>()=>i(ne,{buttonStyle:"icon-label",className:`${m}__editButton`,disabled:g,el:"button",icon:"edit",onClick:()=>{O()},round:!0,size:"small",tooltip:d("lexical:blocks:inlineBlocks:edit",{label:p})}),[p,g,d,O]),Q=N(()=>({children:t})=>i("div",{className:[m,m+"-"+e.blockType,a&&`${m}--selected`].filter(Boolean).join(" "),ref:E,children:t}),[e.blockType,a]),U=N(()=>F?()=>F:()=>i("div",{children:te(u.labels.singular,v)}),[F,u.labels,v]);return I(we,{beforeSubmit:[async({formState:t})=>await W({formState:t,submit:!0})],disableValidationOnSubmit:!0,fields:u.fields,initialState:c||{},onChange:[W],onSubmit:t=>{me(t),O()},uuid:ze(),children:[i(Ne,{children:i(Ie,{className:"",slug:Y,title:d(`lexical:blocks:inlineBlocks:${e?.id?"edit":"create"}`,{label:p??d("lexical:blocks:inlineBlocks:label")}),children:c?I(Se,{children:[i(Oe,{fields:u.fields,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:f,permissions:se,readOnly:!1}),i(Fe,{children:d("fields:saveChanges")})]}):null})}),J?i(re.Provider,{value:{EditButton:G,initialState:c,InlineBlockContainer:Q,Label:U,nodeKey:n,RemoveButton:q},children:J}):I(Q,{children:[c?i(U,{}):i(Ee,{height:"15px",width:"40px"}),s.isEditable()?I("div",{className:`${m}__actions`,children:[i(G,{}),i(q,{})]}):null]})]})};export{ft as a,bt as b,y as c,he as d,L as e};
2
+ //# sourceMappingURL=chunk-RAIJNT4Z.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, FormState } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useLexicalNodeSelection } from '@lexical/react/useLexicalNodeSelection'\nimport { mergeRegister } from '@lexical/utils'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n Drawer,\n EditDepthProvider,\n Form,\n formatDrawerSlug,\n FormSubmit,\n RenderFields,\n ShimmerEffect,\n useDocumentInfo,\n useEditDepth,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport {\n $getNodeByKey,\n $getSelection,\n $isNodeSelection,\n CLICK_COMMAND,\n COMMAND_PRIORITY_LOW,\n KEY_BACKSPACE_COMMAND,\n KEY_DELETE_COMMAND,\n} from 'lexical'\nimport { reduceFieldsToValues } from 'payload/shared'\n\nimport './index.scss'\n\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 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.useContext(InlineBlockComponentContext)\n\nexport const InlineBlockComponent: React.FC<Props> = (props) => {\n const { formData, nodeKey } = props\n const [editor] = useLexicalComposerContext()\n const { i18n, t } = useTranslation<object, string>()\n const {\n fieldProps: {\n featureClientSchemaMap,\n initialLexicalFormState,\n permissions,\n readOnly,\n schemaPath,\n },\n uuid: uuidFromContext,\n } = useEditorConfigContext()\n const { getFormState } = useServerFunctions()\n const editDepth = useEditDepth()\n\n const [initialState, setInitialState] = React.useState<false | FormState | undefined>(\n initialLexicalFormState?.[formData.id]?.formState,\n )\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,\n depth: editDepth,\n })\n const { toggleDrawer } = useLexicalDrawer(drawerSlug, true)\n\n const inlineBlockElemElemRef = useRef<HTMLDivElement | null>(null)\n const [isSelected, setSelected, clearSelection] = useLexicalNodeSelection(nodeKey)\n const { id, collectionSlug, getDocPreferences, globalSlug } = useDocumentInfo()\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 = blocksField.blocks[0]\n\n const removeInlineBlock = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey)?.remove()\n })\n }, [editor, nodeKey])\n\n const $onDelete = useCallback(\n (event: KeyboardEvent) => {\n const deleteSelection = $getSelection()\n if (isSelected && $isNodeSelection(deleteSelection)) {\n event.preventDefault()\n editor.update(() => {\n deleteSelection.getNodes().forEach((node) => {\n if ($isInlineBlockNode(node)) {\n node.remove()\n }\n })\n })\n }\n return false\n },\n [editor, isSelected],\n )\n const onClick = useCallback(\n (payload: MouseEvent) => {\n const event = payload\n // Check if inlineBlockElemElemRef.target or anything WITHIN inlineBlockElemElemRef.target was clicked\n if (\n event.target === inlineBlockElemElemRef.current ||\n inlineBlockElemElemRef.current?.contains(event.target as Node)\n ) {\n if (event.shiftKey) {\n setSelected(!isSelected)\n } else {\n if (!isSelected) {\n clearSelection()\n setSelected(true)\n }\n }\n return true\n }\n\n return false\n },\n [isSelected, setSelected, clearSelection],\n )\n\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand<MouseEvent>(CLICK_COMMAND, onClick, COMMAND_PRIORITY_LOW),\n\n editor.registerCommand(KEY_DELETE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW),\n editor.registerCommand(KEY_BACKSPACE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW),\n )\n }, [clearSelection, editor, isSelected, nodeKey, $onDelete, setSelected, onClick])\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 globalSlug,\n operation: 'update',\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: abortController.signal,\n })\n\n if (state) {\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 schemaFieldsPath,\n id,\n formData,\n initialState,\n collectionSlug,\n globalSlug,\n getDocPreferences,\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 formState: prevFormState,\n globalSlug,\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 [getFormState, id, collectionSlug, getDocPreferences, globalSlug, schemaFieldsPath],\n )\n // cleanup effect\n useEffect(() => {\n return () => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [])\n\n /**\n * HANDLE FORM SUBMIT\n */\n const onFormSubmit = useCallback(\n (formState: FormState) => {\n const newData: any = reduceFieldsToValues(formState)\n newData.blockType = formData.blockType\n editor.update(() => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n node.setFields(newData)\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 }: { children: React.ReactNode }) => (\n <div\n className={[\n baseClass,\n baseClass + '-' + formData.blockType,\n isSelected && `${baseClass}--selected`,\n ]\n .filter(Boolean)\n .join(' ')}\n ref={inlineBlockElemElemRef}\n >\n {children}\n </div>\n ),\n [formData.blockType, isSelected],\n )\n\n const Label = useMemo(() => {\n if (CustomLabel) {\n return () => CustomLabel\n } else {\n return () => <div>{getTranslation(clientBlock.labels!.singular, i18n)}</div>\n }\n }, [CustomLabel, clientBlock.labels, i18n])\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 fields={clientBlock.fields}\n initialState={initialState || {}}\n onChange={[onChange]}\n onSubmit={(formState) => {\n onFormSubmit(formState)\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={permissions}\n readOnly={false}\n />\n <FormSubmit>{t('fields:saveChanges')}</FormSubmit>\n </>\n ) : null}\n </Drawer>\n </EditDepthProvider>\n {CustomBlock ? (\n <InlineBlockComponentContext.Provider\n value={{\n EditButton,\n initialState,\n InlineBlockContainer,\n Label,\n nodeKey,\n RemoveButton,\n }}\n >\n {CustomBlock}\n </InlineBlockComponentContext.Provider>\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 clone(node: ServerInlineBlockNode): ServerInlineBlockNode {\n return super.clone(node)\n }\n\n static getType(): string {\n return super.getType()\n }\n\n static importJSON(serializedNode: SerializedInlineBlockNode): InlineBlockNode {\n const node = $createInlineBlockNode(serializedNode.fields)\n return node\n }\n\n decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element {\n return <InlineBlockComponent formData={this.getFields()} nodeKey={this.getKey()} />\n }\n\n 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 __fields: InlineBlockFields\n\n constructor({ fields, key }: { fields: InlineBlockFields; key?: NodeKey }) {\n super(key)\n this.__fields = fields\n }\n\n static clone(node: ServerInlineBlockNode): ServerInlineBlockNode {\n return new this({\n fields: node.__fields,\n key: node.__key,\n })\n }\n\n static getType(): string {\n return 'inlineBlock'\n }\n\n static importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {}\n }\n\n static 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 createDOM() {\n const element = document.createElement('span')\n element.classList.add('inline-block-container')\n\n return element\n }\n\n decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element | null {\n return null\n }\n\n 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 exportJSON(): SerializedInlineBlockNode {\n return {\n type: 'inlineBlock',\n fields: this.getFields(),\n version: 1,\n }\n }\n\n getFields(): InlineBlockFields {\n return this.getLatest().__fields\n }\n\n getTextContent(): string {\n return `Block Field`\n }\n\n isInline() {\n return true\n }\n\n setFields(fields: InlineBlockFields): void {\n const writable = this.getWritable()\n writable.__fields = fields\n }\n\n 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": "iJAEA,OAAOA,GAASC,iBAAAA,GAAeC,eAAAA,EAAaC,aAAAA,EAAWC,WAAAA,EAASC,UAAAA,OAAc,QAK9E,OAASC,6BAAAA,OAAiC,wCAC1C,OAASC,2BAAAA,OAA+B,yCACxC,OAASC,iBAAAA,OAAqB,iBAC9B,OAASC,kBAAAA,OAAsB,2BAC/B,OACEC,UAAAA,GACAC,UAAAA,GACAC,qBAAAA,GACAC,QAAAA,GACAC,oBAAAA,GACAC,cAAAA,GACAC,gBAAAA,GACAC,iBAAAA,GACAC,mBAAAA,GACAC,gBAAAA,GACAC,sBAAAA,GACAC,kBAAAA,OACK,iBACP,OAASC,kBAAAA,MAAsB,wBAC/B,OACEC,iBAAAA,GACAC,iBAAAA,GACAC,oBAAAA,GACAC,iBAAAA,GACAC,wBAAAA,EACAC,yBAAAA,GACAC,sBAAAA,OACK,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Aa7E,CAAA,EACbY,EAAA,CACF,EACAtB,KAAMA,GAAA,YAEN6F,EAACyB,GAAA,UACCzB,EAAC0B,GAAA,CACCvB,UAAW,GACX5E,KAAMF,EACNsG,MAAOhI,EAAE,+BAA+BL,GAAUsB,GAAK,OAAS,QAAA,GAAY,CAC1E8F,MAAOrC,GAAoB1E,EAAE,mCAAA,CAC/B,CAAA,WAECX,EACCoI,EAAAQ,GAAA,WACE5B,EAAC6B,GAAA,CACC7C,OAAQzC,EAAYyC,OACpB8C,YAAW,GACXC,gBAAgB,GAChBC,WAAW,GACXC,iBAAkBtD,EAClB3E,YAAaA,GACbC,SAAU,KAEZ+F,EAACkC,GAAA,UAAYvI,EAAE,oBAAA,OAEf,SAGPuB,EACC8E,EAAClH,GAA4BqJ,SAAQ,CACnCC,MAAO,CACLzB,WAAAA,EACA3H,aAAAA,EACA6H,qBAAAA,EACAM,MAAAA,EACA5H,QAAAA,EACAuG,aAAAA,CACF,WAEC5E,IAGHkG,EAACP,EAAA,WACE7H,EAAegH,EAACmB,EAAA,CAAA,CAAA,EAAWnB,EAACqC,GAAA,CAAcC,OAAO,OAAOC,MAAM,SAC9D/I,EAAOgJ,WAAU,EAChBpB,EAAC,MAAA,CAAIjB,UAAW,GAAGtH,CAAA,sBACjBmH,EAACW,EAAA,CAAA,CAAA,EACDX,EAACF,EAAA,CAAA,CAAA,CAAA,IAED,IAAA,MAKd",
6
+ "names": ["React", "createContext", "useCallback", "useEffect", "useMemo", "useRef", "useLexicalComposerContext", "useLexicalNodeSelection", "mergeRegister", "getTranslation", "Button", "Drawer", "EditDepthProvider", "Form", "formatDrawerSlug", "FormSubmit", "RenderFields", "ShimmerEffect", "useDocumentInfo", "useEditDepth", "useServerFunctions", "useTranslation", "abortAndIgnore", "$getNodeByKey", "$getSelection", "$isNodeSelection", "CLICK_COMMAND", "COMMAND_PRIORITY_LOW", "KEY_BACKSPACE_COMMAND", "KEY_DELETE_COMMAND", "reduceFieldsToValues", "v4", "uuid", "ObjectID", "React", "ObjectID", "DecoratorNode", "ServerInlineBlockNode", "__fields", "constructor", "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", "getLatest", "setFields", "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", "formData", "getFields", "nodeKey", "getKey", "exportJSON", "id", "ObjectID", "toHexString", "$isInlineBlockNode", "baseClass", "InlineBlockComponentContext", "createContext", "initialState", "useInlineBlockComponentContext", "React", "useContext", "InlineBlockComponent", "props", "formData", "nodeKey", "editor", "useLexicalComposerContext", "i18n", "t", "useTranslation", "fieldProps", "featureClientSchemaMap", "initialLexicalFormState", "permissions", "readOnly", "schemaPath", "uuid", "uuidFromContext", "useEditorConfigContext", "getFormState", "useServerFunctions", "editDepth", "useEditDepth", "setInitialState", "useState", "id", "formState", "CustomLabel", "setCustomLabel", "customComponents", "BlockLabel", "CustomBlock", "setCustomBlock", "Block", "drawerSlug", "formatDrawerSlug", "slug", "depth", "toggleDrawer", "useLexicalDrawer", "inlineBlockElemElemRef", "useRef", "isSelected", "setSelected", "clearSelection", "useLexicalNodeSelection", "collectionSlug", "getDocPreferences", "globalSlug", "useDocumentInfo", "componentMapRenderedBlockPath", "blockType", "clientBlock", "blocks", "removeInlineBlock", "useCallback", "update", "$getNodeByKey", "remove", "$onDelete", "event", "deleteSelection", "$getSelection", "$isNodeSelection", "preventDefault", "getNodes", "forEach", "node", "$isInlineBlockNode", "onClick", "payload", "target", "current", "contains", "shiftKey", "useEffect", "mergeRegister", "registerCommand", "CLICK_COMMAND", "COMMAND_PRIORITY_LOW", "KEY_DELETE_COMMAND", "KEY_BACKSPACE_COMMAND", "blockDisplayName", "labels", "singular", "getTranslation", "onChangeAbortControllerRef", "AbortController", "schemaFieldsPath", "abortController", "state", "data", "docPermissions", "fields", "docPreferences", "operation", "renderAllFields", "signal", "abortAndIgnore", "onChange", "prevFormState", "submit", "controller", "onFormSubmit", "newData", "reduceFieldsToValues", "setFields", "RemoveButton", "useMemo", "_jsx", "Button", "buttonStyle", "className", "disabled", "icon", "e", "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", "Provider", "value", "ShimmerEffect", "height", "width", "isEditable"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use client";import{a,b}from"./chunk-RAIJNT4Z.js";import"./chunk-2CYU43GM.js";import"./chunk-CUIBIFW2.js";export{b as InlineBlockComponent,a as useInlineBlockComponentContext};
2
+ //# sourceMappingURL=componentInline-PJ7YLXB5.js.map
@@ -1,4 +1,4 @@
1
- "use client";import{a as be,c as ro,d as no,e as io}from"./chunk-WS6E5WE4.js";import{a as Be,b as gt,c as Ct,d as xt}from"./chunk-XCEM47RI.js";import{a as je,b as Ge,c as Ue,d as lo}from"./chunk-ZTAS32RX.js";import{a as He,b as bt,c as We,d as Ve,e as Ke,f as so}from"./chunk-DOK5S7LE.js";import{a as ce}from"./chunk-2CYU43GM.js";import{a as ds}from"./chunk-5PBXL4HT.js";import{a as us,b as mr,d as pr,e as fr,f as hr,g as ms,h as ps,i as fs,k as hs,m as gs,n as Cs}from"./chunk-2L2Z4JHF.js";import{a as cs,b as B}from"./chunk-CUIBIFW2.js";function Z(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{$isElementNode as _e,$isRangeSelection as Tt,FORMAT_ELEMENT_COMMAND as Et}from"lexical";import{jsx as ao,jsxs as xs}from"react/jsx-runtime";import"react";var gr=()=>xs("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[ao("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),ao("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),ao("path",{d:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as co,jsxs as bs}from"react/jsx-runtime";import"react";var Cr=()=>bs("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[co("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),co("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),co("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as uo,jsxs as _s}from"react/jsx-runtime";import"react";var _t=()=>_s("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[uo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),uo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),uo("path",{d:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as mo,jsxs as Ts}from"react/jsx-runtime";import"react";var xr=()=>Ts("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[mo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),mo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),mo("path",{d:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});var y=t=>o=>{let r={clientFeatureProps:o};if(typeof t=="function")r.feature=({featureClientSchemaMap:n,featureProviderMap:i,field:l,resolvedFeatures:s,schemaPath:a,unSanitizedEditorConfig:d})=>{let c=t({featureClientSchemaMap:n,featureProviderMap:i,field:l,props:o,resolvedFeatures:s,schemaPath:a,unSanitizedEditorConfig:d});return c.sanitizedClientFeatureProps===null&&(c.sanitizedClientFeatureProps=o),c};else{let n={...t};n.sanitizedClientFeatureProps=o,r.feature=n}return r};var br=t=>({type:"dropdown",ChildComponent:_t,items:t,key:"align",order:30});var _r=[br([{ChildComponent:_t,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if(_e(e)&&e.getFormatType()==="left")continue;let o=e.getParent();if(!(_e(o)&&o.getFormatType()==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Et,"left")},order:1},{ChildComponent:gr,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if(_e(e)&&e.getFormatType()==="center")continue;let o=e.getParent();if(!(_e(o)&&o.getFormatType()==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Et,"center")},order:2},{ChildComponent:xr,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if(_e(e)&&e.getFormatType()==="right")continue;let o=e.getParent();if(!(_e(o)&&o.getFormatType()==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Et,"right")},order:3},{ChildComponent:Cr,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if(_e(e)&&e.getFormatType()==="justify")continue;let o=e.getParent();if(!(_e(o)&&o.getFormatType()==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Et,"justify")},order:4}])],Es=y({toolbarFixed:{groups:_r},toolbarInline:{groups:_r}});import{$createQuoteNode as Rr,$isQuoteNode as Nr,QuoteNode as Ls}from"@lexical/rich-text";import{$setBlocksType as Ir}from"@lexical/selection";import{$getSelection as Sr,$isRangeSelection as Rs}from"lexical";import{jsx as Tr}from"react/jsx-runtime";import"react";var po=()=>Tr("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Tr("path",{d:"M13.5353 10.5725C13.5353 9.47709 11.0456 9.99991 11.0456 7.85883C11.0456 6.46464 12.1162 5.61816 13.361 5.61816C14.805 5.61816 16 6.86298 16 8.92937C16 11.2945 14.4564 13.7841 11.1203 14.3816L10.8216 13.1368C12.888 12.4895 13.5353 11.4937 13.5353 10.5725ZM6.71369 10.5725C6.71369 9.47709 4.22407 9.99991 4.22407 7.85883C4.22407 6.46464 5.29461 5.61816 6.53942 5.61816C7.9834 5.61816 9.17842 6.86298 9.17842 8.92937C9.17842 11.2945 7.63485 13.7841 4.29876 14.3816L4 13.1368C6.06639 12.4895 6.71369 11.4937 6.71369 10.5725Z",fill:"currentColor"})});import{jsx as Er}from"react/jsx-runtime";import"react";var ze=()=>Er("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Er("path",{d:"M11.708 14.5H7.79785V13.9414H8.01367C9.00391 13.9414 9.15625 13.9033 9.15625 13.6113V6.70508H8.07715C6.82031 6.70508 6.73145 7.08594 6.28711 8.67285H5.80469L5.91895 6.12109H13.5869L13.7012 8.67285H13.2188C12.7744 7.08594 12.6855 6.70508 11.4287 6.70508H10.3496V13.6113C10.3496 13.9033 10.502 13.9414 11.4922 13.9414H11.708V14.5Z",fill:"currentColor"})});var q=t=>({type:"dropdown",ChildComponent:ze,items:t,key:"text",order:25});import{$createQuoteNode as ws,$isQuoteNode as wr,QuoteNode as ks}from"@lexical/rich-text";import{$createLineBreakNode as Ns}from"lexical";var kr={type:"element",dependencies:[ks],export:(t,e)=>{if(!wr(t))return null;let o=e(t).split(`
1
+ "use client";import{a as be,c as ro,d as no,e as io}from"./chunk-RAIJNT4Z.js";import{a as Be,b as gt,c as Ct,d as xt}from"./chunk-XCEM47RI.js";import{a as je,b as Ge,c as Ue,d as lo}from"./chunk-ZTAS32RX.js";import{a as He,b as bt,c as We,d as Ve,e as Ke,f as so}from"./chunk-DOK5S7LE.js";import{a as ce}from"./chunk-2CYU43GM.js";import{a as ds}from"./chunk-5PBXL4HT.js";import{a as us,b as mr,d as pr,e as fr,f as hr,g as ms,h as ps,i as fs,k as hs,m as gs,n as Cs}from"./chunk-2L2Z4JHF.js";import{a as cs,b as B}from"./chunk-CUIBIFW2.js";function Z(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{$isElementNode as _e,$isRangeSelection as Tt,FORMAT_ELEMENT_COMMAND as Et}from"lexical";import{jsx as ao,jsxs as xs}from"react/jsx-runtime";import"react";var gr=()=>xs("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[ao("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),ao("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),ao("path",{d:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as co,jsxs as bs}from"react/jsx-runtime";import"react";var Cr=()=>bs("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[co("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),co("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),co("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as uo,jsxs as _s}from"react/jsx-runtime";import"react";var _t=()=>_s("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[uo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),uo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),uo("path",{d:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as mo,jsxs as Ts}from"react/jsx-runtime";import"react";var xr=()=>Ts("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[mo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),mo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),mo("path",{d:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});var y=t=>o=>{let r={clientFeatureProps:o};if(typeof t=="function")r.feature=({featureClientSchemaMap:n,featureProviderMap:i,field:l,resolvedFeatures:s,schemaPath:a,unSanitizedEditorConfig:d})=>{let c=t({featureClientSchemaMap:n,featureProviderMap:i,field:l,props:o,resolvedFeatures:s,schemaPath:a,unSanitizedEditorConfig:d});return c.sanitizedClientFeatureProps===null&&(c.sanitizedClientFeatureProps=o),c};else{let n={...t};n.sanitizedClientFeatureProps=o,r.feature=n}return r};var br=t=>({type:"dropdown",ChildComponent:_t,items:t,key:"align",order:30});var _r=[br([{ChildComponent:_t,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if(_e(e)&&e.getFormatType()==="left")continue;let o=e.getParent();if(!(_e(o)&&o.getFormatType()==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Et,"left")},order:1},{ChildComponent:gr,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if(_e(e)&&e.getFormatType()==="center")continue;let o=e.getParent();if(!(_e(o)&&o.getFormatType()==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Et,"center")},order:2},{ChildComponent:xr,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if(_e(e)&&e.getFormatType()==="right")continue;let o=e.getParent();if(!(_e(o)&&o.getFormatType()==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Et,"right")},order:3},{ChildComponent:Cr,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if(_e(e)&&e.getFormatType()==="justify")continue;let o=e.getParent();if(!(_e(o)&&o.getFormatType()==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Et,"justify")},order:4}])],Es=y({toolbarFixed:{groups:_r},toolbarInline:{groups:_r}});import{$createQuoteNode as Rr,$isQuoteNode as Nr,QuoteNode as Ls}from"@lexical/rich-text";import{$setBlocksType as Ir}from"@lexical/selection";import{$getSelection as Sr,$isRangeSelection as Rs}from"lexical";import{jsx as Tr}from"react/jsx-runtime";import"react";var po=()=>Tr("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Tr("path",{d:"M13.5353 10.5725C13.5353 9.47709 11.0456 9.99991 11.0456 7.85883C11.0456 6.46464 12.1162 5.61816 13.361 5.61816C14.805 5.61816 16 6.86298 16 8.92937C16 11.2945 14.4564 13.7841 11.1203 14.3816L10.8216 13.1368C12.888 12.4895 13.5353 11.4937 13.5353 10.5725ZM6.71369 10.5725C6.71369 9.47709 4.22407 9.99991 4.22407 7.85883C4.22407 6.46464 5.29461 5.61816 6.53942 5.61816C7.9834 5.61816 9.17842 6.86298 9.17842 8.92937C9.17842 11.2945 7.63485 13.7841 4.29876 14.3816L4 13.1368C6.06639 12.4895 6.71369 11.4937 6.71369 10.5725Z",fill:"currentColor"})});import{jsx as Er}from"react/jsx-runtime";import"react";var ze=()=>Er("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Er("path",{d:"M11.708 14.5H7.79785V13.9414H8.01367C9.00391 13.9414 9.15625 13.9033 9.15625 13.6113V6.70508H8.07715C6.82031 6.70508 6.73145 7.08594 6.28711 8.67285H5.80469L5.91895 6.12109H13.5869L13.7012 8.67285H13.2188C12.7744 7.08594 12.6855 6.70508 11.4287 6.70508H10.3496V13.6113C10.3496 13.9033 10.502 13.9414 11.4922 13.9414H11.708V14.5Z",fill:"currentColor"})});var q=t=>({type:"dropdown",ChildComponent:ze,items:t,key:"text",order:25});import{$createQuoteNode as ws,$isQuoteNode as wr,QuoteNode as ks}from"@lexical/rich-text";import{$createLineBreakNode as Ns}from"lexical";var kr={type:"element",dependencies:[ks],export:(t,e)=>{if(!wr(t))return null;let o=e(t).split(`
2
2
  `),r=[];for(let n of o)r.push("> "+n);return r.join(`
3
3
  `)},regExp:/^>\s/,replace:(t,e,o,r)=>{if(r){let i=t.getPreviousSibling();if(wr(i)){i.splice(i.getChildrenSize(),0,[Ns(),...e]),i.select(0,0),t.remove();return}}let n=ws();n.append(...e),t.replace(n),n.select(0,0)}};var Lr=[q([{ChildComponent:po,isActive:({selection:t})=>{if(!Rs(t))return!1;for(let e of t.getNodes())if(!Nr(e)&&!Nr(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Sr();Ir(e,()=>Rr())})},order:20}])],Is=y({markdownTransformers:[kr],nodes:[Ls],slashMenu:{groups:[Z([{Icon:po,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Sr();Ir(e,()=>Rr())})}}])]},toolbarFixed:{groups:Lr},toolbarInline:{groups:Lr}});import{getTranslation as St}from"@payloadcms/translations";import{jsx as fo,jsxs as Ss}from"react/jsx-runtime";import"react";var wt=()=>Ss("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[fo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),fo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),fo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as yr}from"react/jsx-runtime";import"react";var kt=()=>yr("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:yr("path",{clipRule:"evenodd",d:"M5.33333 6.5C5.11232 6.5 4.90036 6.5878 4.74408 6.74408C4.5878 6.90036 4.5 7.11232 4.5 7.33333V12.1667C4.5 12.3877 4.5878 12.5996 4.74408 12.7559C4.90036 12.9122 5.11232 13 5.33333 13H14.6667C14.8877 13 15.0996 12.9122 15.2559 12.7559C15.4122 12.5996 15.5 12.3877 15.5 12.1667V11.6667C15.5 11.3905 15.7239 11.1667 16 11.1667C16.2761 11.1667 16.5 11.3905 16.5 11.6667V12.1667C16.5 12.6529 16.3068 13.1192 15.963 13.463C15.6192 13.8068 15.1529 14 14.6667 14H5.33333C4.8471 14 4.38079 13.8068 4.03697 13.463C3.69315 13.1192 3.5 12.6529 3.5 12.1667V7.33333C3.5 6.8471 3.69315 6.38079 4.03697 6.03697C4.38079 5.69315 4.8471 5.5 5.33333 5.5H10.3333C10.6095 5.5 10.8333 5.72386 10.8333 6C10.8333 6.27614 10.6095 6.5 10.3333 6.5H5.33333ZM13 6.5C12.7239 6.5 12.5 6.27614 12.5 6C12.5 5.72386 12.7239 5.5 13 5.5H16C16.2761 5.5 16.5 5.72386 16.5 6V9C16.5 9.27614 16.2761 9.5 16 9.5C15.7239 9.5 15.5 9.27614 15.5 9V7.20711L13.3536 9.35355C13.1583 9.54882 12.8417 9.54882 12.6464 9.35355C12.4512 9.15829 12.4512 8.84171 12.6464 8.64645L14.7929 6.5H13ZM6.16699 8.33325C6.16699 8.05711 6.39085 7.83325 6.66699 7.83325H11.0003C11.2765 7.83325 11.5003 8.05711 11.5003 8.33325C11.5003 8.60939 11.2765 8.83325 11.0003 8.83325H6.66699C6.39085 8.83325 6.16699 8.60939 6.16699 8.33325ZM6.16699 10.9999C6.16699 10.7238 6.39085 10.4999 6.66699 10.4999H13.3337C13.6098 10.4999 13.8337 10.7238 13.8337 10.9999C13.8337 11.2761 13.6098 11.4999 13.3337 11.4999H6.66699C6.39085 11.4999 6.16699 11.2761 6.16699 10.9999Z",fill:"currentColor",fillRule:"evenodd"})});import{jsx as ia}from"react/jsx-runtime";import la from"bson-objectid";import"react";import{DecoratorBlockNode as ys}from"@lexical/react/LexicalDecoratorBlockNode.js";import vs from"bson-objectid";var Ze=class extends ys{__fields;constructor({fields:e,format:o,key:r}){super(o,r),this.__fields=e}static clone(e){return new this({fields:e.__fields,format:e.__format,key:e.__key})}static getType(){return"block"}static importDOM(){return{}}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=Ms(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}decorate(e,o){return null}exportDOM(){let e=document.createElement("div"),o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),type:"block",fields:this.getFields(),version:2}}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}setFields(e){let o=this.getWritable();o.__fields=e}};function Ms(t){return new Ze({fields:{...t,id:t?.id||new vs.default().toHexString()}})}import{jsx as X,jsxs as Lt,Fragment as Bs}from"react/jsx-runtime";import{Button as Ar,Collapsible as Hs,Drawer as js,EditDepthProvider as Gs,ErrorPill as Us,Form as Ws,formatDrawerSlug as Vs,FormSubmit as Ks,Pill as zs,RenderFields as Zs,SectionTitle as Xs,useDocumentInfo as Fr,useEditDepth as Ys,useFormSubmitted as Js,useServerFunctions as qs,useTranslation as Qs}from"@payloadcms/ui";import{abortAndIgnore as ho}from"@payloadcms/ui/shared";import{deepCopyObjectSimpleWithoutReactComponents as ea,reduceFieldsToValues as Or}from"payload/shared";import Xe,{useCallback as go,useEffect as $r,useMemo as Ye,useRef as ta}from"react";import{useLexicalComposerContext as oa}from"@lexical/react/LexicalComposerContext";import{getTranslation as ra}from"@payloadcms/translations";import{$getNodeByKey as Co}from"lexical";import{v4 as na}from"uuid";import{c as Ds}from"react/compiler-runtime";import{jsx as Nt,jsxs as As}from"react/jsx-runtime";import{RenderFields as Fs,useFormSubmitted as Os}from"@payloadcms/ui";import $s,{createContext as Ps}from"react";var vr=Ps({initialState:!1}),ve=()=>$s.useContext(vr),Mr=t=>{let e=Ds(13),{BlockDrawer:o,Collapsible:r,CustomBlock:n,EditButton:i,errorCount:l,formSchema:s,initialState:a,nodeKey:d,RemoveButton:c}=t,m=Os()&&l>0,p,f;e[0]!==r||e[1]!==l||e[2]!==m?(f=w=>Nt(r,{editButton:w.editButton,errorCount:l,fieldHasErrors:m,Label:w.Label,removeButton:w.removeButton,children:w.children}),e[0]=r,e[1]=l,e[2]=m,e[3]=f):f=e[3],p=f;let h=p,C;return e[4]!==n||e[5]!==h||e[6]!==i||e[7]!==a||e[8]!==d||e[9]!==c||e[10]!==o||e[11]!==s?(C=n?As(vr.Provider,{value:{BlockCollapsible:h,EditButton:i,initialState:a,nodeKey:d,RemoveButton:c},children:[n,Nt(o,{})]}):Nt(h,{children:Nt(Fs,{fields:s,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0})}),e[4]=n,e[5]=h,e[6]=i,e[7]=a,e[8]=d,e[9]=c,e[10]=o,e[11]=s,e[12]=C):C=e[12],C};function Dr({fields:t}){for(let e in t){let o=t[e];Array.isArray(o.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var re="lexical-block",Pr=t=>{let{formData:e,nodeKey:o}=t,r=Js(),{id:n,collectionSlug:i,globalSlug:l}=Fr(),{fieldProps:{featureClientSchemaMap:s,field:a,initialLexicalFormState:d,permissions:c,readOnly:u,schemaPath:m},uuid:p}=B(),f=ta(new AbortController),h=Ys(),[C,w]=Xe.useState(0),v=Vs({slug:`lexical-blocks-create-${p}-${e.id}`,depth:h}),{toggleDrawer:D}=ce(v),{getDocPreferences:x,setDocFieldPreferences:E}=Fr(),[g]=oa(),{getFormState:_}=qs(),N=`${m}.lexical_internal_feature.blocks.lexical_blocks.${e.blockType}.fields`,[k,R]=Xe.useState(d?.[e.id]?.formState?{...d?.[e.id]?.formState,blockName:{initialValue:e.blockName,passesCondition:!0,valid:!0,value:e.blockName}}:!1),[I,b]=Xe.useState(k?._components?.customComponents?.BlockLabel),[T,S]=Xe.useState(k?._components?.customComponents?.Block);$r(()=>{let j=new AbortController;return e&&!k&&(async()=>{let{state:K}=await _({id:n,collectionSlug:i,data:e,docPermissions:{fields:!0},docPreferences:await x(),globalSlug:l,operation:"update",renderAllFields:!0,schemaPath:N,signal:j.signal});K&&(K.blockName={initialValue:e.blockName,passesCondition:!0,valid:!0,value:e.blockName},R(K),b(K._components?.customComponents?.BlockLabel),S(K._components?.customComponents?.Block))})(),()=>{ho(j)}},[_,N,n,e,k,i,l,x]);let[L,A]=Xe.useState(d?.[e.id]?.collapsed??!1),M=`${m}.lexical_internal_feature.blocks.lexical_blocks.${e.blockType}`,$=s.blocks[M][0].blocks[0],{i18n:W,t:J}=Qs(),U=go(async({formState:j,submit:te})=>{ho(f.current);let K=new AbortController;f.current=K;let{state:z}=await _({id:n,collectionSlug:i,docPermissions:{fields:!0},docPreferences:await x(),formState:j,globalSlug:l,operation:"update",renderAllFields:!!te,schemaPath:N,signal:K.signal});if(!z)return j;z.blockName=j.blockName;let oe=Or(Dr({fields:ea(z)}),!0);if(setTimeout(()=>{g.update(()=>{let xe=Co(o);if(xe&&Rt(xe)){let we=oe;we.blockType=e.blockType,xe.setFields(we)}})},0),te){b(z._components?.customComponents?.BlockLabel),S(z._components?.customComponents?.Block);let xe=0;for(let we of Object.values(z))we?.valid===!1&&xe++;w(xe)}return z},[_,n,i,x,l,N,e.blockType,g,o]);$r(()=>()=>{ho(f.current)},[]);let H=go(()=>{g.update(()=>{Co(o)?.remove()})},[g,o]),ee=$?.labels?.singular?ra($.labels.singular,W):$?.slug,pt=go(j=>{x().then(te=>{let z=te?.fields?.[a.name]?.collapsed,oe=z&&z?.length?z:[];j?oe.includes(e.id)||oe.push(e.id):oe.includes(e.id)&&oe.splice(oe.indexOf(e.id),1),E(a.name,{collapsed:oe,hello:"hi"})})},[x,a.name,E,e.id]),ie=Ye(()=>()=>X(Ar,{buttonStyle:"icon-label",className:`${re}__editButton`,disabled:u,el:"button",icon:"edit",onClick:j=>(j.preventDefault(),j.stopPropagation(),D(),!1),onMouseDown:j=>{j.preventDefault()},round:!0,size:"small",tooltip:J("lexical:blocks:inlineBlocks:edit",{label:ee})}),[ee,u,J,D]),ye=Ye(()=>()=>X(Ar,{buttonStyle:"icon-label",className:`${re}__removeButton`,disabled:a?.admin?.readOnly||!1,icon:"x",onClick:j=>{j.preventDefault(),H()},round:!0,tooltip:"Remove Block"}),[a?.admin?.readOnly,H]),ft=Ye(()=>({children:j,editButton:te,errorCount:K,fieldHasErrors:z,Label:oe,removeButton:xe})=>X("div",{className:re+" "+re+"-"+e.blockType,children:X(Hs,{className:[`${re}__row`,z?`${re}__row--has-errors`:`${re}__row--no-errors`].join(" "),collapsibleStyle:z?"error":"default",header:Lt("div",{className:`${re}__block-header`,children:[oe??I?oe??I:Lt("div",{children:[X(zs,{className:`${re}__block-pill ${re}__block-pill-${e?.blockType}`,pillStyle:"white",children:ee}),X(Xs,{path:"blockName",readOnly:a?.admin?.readOnly||!1}),z&&X(Us,{count:K??0,i18n:W,withMessage:!0})]}),Lt("div",{children:[T&&te!==!1||!T&&te?X(ie,{}):null,xe!==!1&&g.isEditable()?X(ye,{}):null]})]}),isCollapsed:L,onToggle:we=>{pt(we),A(we)},children:j},0)}),[T,I,ie,ye,ee,g,e.blockType,W,L,pt,a?.admin?.readOnly]),ht=Ye(()=>()=>X(Gs,{children:X(js,{className:"",slug:v,title:J(`lexical:blocks:inlineBlocks:${e?.id?"edit":"create"}`,{label:ee??J("lexical:blocks:inlineBlocks:label")}),children:k?Lt(Bs,{children:[X(Zs,{fields:$.fields,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:N,permissions:c,readOnly:!1}),X(Ks,{children:J("fields:saveChanges")})]}):null})}),[k,v,ee,J,$.fields,N,c]);return Ye(()=>k?X(Ws,{beforeSubmit:[async({formState:j})=>await U({formState:j,submit:!0})],fields:$.fields,initialState:k,onChange:[U],onSubmit:j=>{let te=Or(j);te.blockType=e.blockType,g.update(()=>{let K=Co(o);K&&Rt(K)&&K.setFields(te)}),D()},submitted:r,uuid:na(),children:X(Mr,{baseClass:re,BlockDrawer:ht,Collapsible:ft,CustomBlock:T,EditButton:ie,errorCount:C,formSchema:$.fields,initialState:k,nodeKey:o,RemoveButton:ye})}):null,[ft,ht,T,ye,ie,g,C,D,$.fields,k,o,U,r])};var ue=class extends Ze{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=It(e.fields);return o.setFormat(e.format),o}decorate(e,o){return ia(Pr,{formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function It(t){return new ue({fields:{...t,id:t?.id||new la.default().toHexString()}})}function Rt(t){return t instanceof ue}import{createCommand as Br}from"lexical";var Je=Br("INSERT_BLOCK_COMMAND"),qe=Br("INSERT_INLINE_BLOCK_COMMAND");import{c as sa}from"react/compiler-runtime";import{useLexicalComposerContext as aa}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as ca,$wrapNodeInElement as ua,mergeRegister as da}from"@lexical/utils";import{formatDrawerSlug as ma,useEditDepth as pa}from"@payloadcms/ui";import{$createParagraphNode as fa,$getNodeByKey as ha,$getPreviousSelection as ga,$getSelection as Ca,$insertNodes as xa,$isParagraphNode as Hr,$isRangeSelection as ba,$isRootOrShadowRoot as _a,COMMAND_PRIORITY_EDITOR as jr}from"lexical";import{useEffect as Ta,useState as Ea}from"react";var Gr=()=>{let t=sa(10),[e]=aa(),[o,r]=Ea(null),{uuid:n}=B(),i=pa(),l="lexical-inlineBlocks-create-"+n,s;t[0]!==l||t[1]!==i?(s=ma({slug:l,depth:i}),t[0]=l,t[1]=i,t[2]=s):s=t[2];let a=s,{toggleDrawer:d}=ce(a,!0),c;t[3]!==e||t[4]!==o?(c=()=>{if(!e.hasNodes([ue]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return da(e.registerCommand(Je,m=>(e.update(()=>{let p=Ca()||ga();if(ba(p)){let f=It(m);ca(f);let{focus:h}=p,C=h.getNode();Hr(C)&&C.getTextContentSize()===0&&C.getParentOrThrow().getChildren().filter(w=>Hr(w)).length>1&&C.remove()}}),!0),jr),e.registerCommand(qe,m=>{if(o){let f=ha(o);return!f||!io(f)?!1:(f.setFields(m),r(null),!0)}let p=no(m);return xa([p]),_a(p.getParentOrThrow())&&ua(p,fa).selectEnd(),!0},jr))},t[3]=e,t[4]=o,t[5]=c):c=t[5];let u;return t[6]!==e||t[7]!==o||t[8]!==d?(u=[e,o,d],t[6]=e,t[7]=o,t[8]=d,t[9]=u):u=t[9],Ta(c,u),null};var wa=y(({featureClientSchemaMap:t,props:e,schemaPath:o})=>{let r=`${o}.lexical_internal_feature.blocks.lexical_blocks`,n=`${o}.lexical_internal_feature.blocks.lexical_inline_blocks`,i=t.blocks,l=Object.entries(i).filter(([c])=>c.startsWith(r+".")&&!c.replace(r+".","").includes(".")).map(([c,u])=>u[0]),s=Object.entries(i).filter(([c])=>c.startsWith(n+".")&&!c.replace(n+".","").includes(".")).map(([c,u])=>u[0]),a=l.map(c=>c.blocks[0]),d=s.map(c=>c.blocks[0]);return{nodes:[ue,ro],plugins:[{Component:Gr,position:"normal"}],sanitizedClientFeatureProps:e,slashMenu:{groups:[a?.length?{items:a.map(c=>({Icon:wt,key:"block-"+c.slug,keywords:["block","blocks",c.slug],label:({i18n:u})=>c?.labels?.singular?St(c.labels.singular,u):c?.slug,onSelect:({editor:u})=>{u.dispatchCommand(Je,{blockName:"",blockType:c.slug})}})),key:"blocks",label:({i18n:c})=>c.t("lexical:blocks:label")}:null,d?.length?{items:d.map(c=>({Icon:kt,key:"inlineBlocks-"+c.slug,keywords:["inlineBlock","inline block",c.slug],label:({i18n:u})=>c?.labels?.singular?St(c.labels.singular,u):c?.slug,onSelect:({editor:u})=>{u.dispatchCommand(qe,{blockName:"",blockType:c.slug})}})),key:"inlineBlocks",label:({i18n:c})=>c.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[a.length?{type:"dropdown",ChildComponent:wt,items:a.map((c,u)=>({ChildComponent:wt,isActive:void 0,key:"block-"+c.slug,label:({i18n:m})=>c?.labels?.singular?St(c.labels.singular,m):c?.slug,onSelect:({editor:m})=>{m.dispatchCommand(Je,{blockName:"",blockType:c.slug})},order:u})),key:"blocks",order:20}:null,d?.length?{type:"dropdown",ChildComponent:kt,items:d.map((c,u)=>({ChildComponent:kt,isActive:void 0,key:"inlineBlock-"+c.slug,label:({i18n:m})=>c?.labels?.singular?St(c.labels.singular,m):c?.slug,onSelect:({editor:m})=>{m.dispatchCommand(qe,{blockName:"",blockType:c.slug})},order:u})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as ka}from"react/compiler-runtime";import{jsx as Ne,jsxs as _o}from"react/jsx-runtime";import{useLexicalComposerContext as Na}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as La,$createTextNode as Ra,$getRoot as Ia}from"lexical";import*as Kr from"react";import{useCallback as ke,useEffect as xo,useLayoutEffect as Ur,useRef as bo,useState as yt}from"react";var Sa=t=>{let e=document.createElement("textarea");e.value=t||"",e.style.position="absolute",e.style.opacity="0",document.body?.appendChild(e),e.focus(),e.select();try{let o=document.execCommand("copy");console.log(o)}catch(o){console.error(o)}document.body?.removeChild(e)},ya=(t,e)=>{let o=document.createElement("a");o.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(e||"")),o.setAttribute("download",t),o.style.display="none",document.body?.appendChild(o),o.click(),document.body?.removeChild(o)},va=t=>{let o=((r,n)=>{switch(r){case"click":return` await page.mouse.click(${n.x}, ${n.y});`;case"keydown":return` await page.keyboard.keydown('${n}');`;case"keyup":return` await page.keyboard.keyup('${n}');`;case"press":return` await page.keyboard.press('${n}');`;case"selectAll":return" await selectAll(page);";case"snapshot":return` await assertHTMLSnapshot(page);
4
4
  await assertSelection(page, {
@@ -1 +1 @@
1
- {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../../../../src/exports/react/components/RichText/converter/converters/list.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AAChG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAEhD,eAAO,MAAM,gBAAgB,EAAE,aAAa,CAAC,sBAAsB,GAAG,kBAAkB,CAqDvF,CAAA"}
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../../../../src/exports/react/components/RichText/converter/converters/list.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AAChG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAEhD,eAAO,MAAM,gBAAgB,EAAE,aAAa,CAAC,sBAAsB,GAAG,kBAAkB,CAgDvF,CAAA"}
@@ -30,15 +30,13 @@ export const ListJSXConverter = {
30
30
  className: `list-item-checkbox${node.checked ? ' list-item-checkbox-checked' : ' list-item-checkbox-unchecked'}${hasSubLists ? ' nestedListItem' : ''}`,
31
31
  // eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role
32
32
  role: "checkbox",
33
- style: {
34
- listStyleType: 'none'
35
- },
36
33
  tabIndex: -1,
37
34
  value: node?.value,
38
35
  children: hasSubLists ? children : /*#__PURE__*/_jsxs(_Fragment, {
39
36
  children: [/*#__PURE__*/_jsx("input", {
40
37
  checked: node.checked,
41
38
  id: uuid,
39
+ readOnly: true,
42
40
  type: "checkbox"
43
41
  }), /*#__PURE__*/_jsx("label", {
44
42
  htmlFor: uuid,
@@ -49,9 +47,6 @@ export const ListJSXConverter = {
49
47
  } else {
50
48
  return /*#__PURE__*/_jsx("li", {
51
49
  className: hasSubLists ? 'nestedListItem' : '',
52
- style: hasSubLists ? {
53
- listStyleType: 'none'
54
- } : {},
55
50
  value: node?.value,
56
51
  children: children
57
52
  });
@@ -1 +1 @@
1
- {"version":3,"file":"list.js","names":["v4","uuidv4","ListJSXConverter","list","node","nodesToJSX","children","nodes","NodeTag","tag","_jsx","className","listType","listitem","parent","hasSubLists","some","child","type","uuid","checked","role","style","listStyleType","tabIndex","value","_jsxs","_Fragment","id","htmlFor"],"sources":["../../../../../../../src/exports/react/components/RichText/converter/converters/list.tsx"],"sourcesContent":["import { v4 as uuidv4 } from 'uuid'\n\nimport type { SerializedListItemNode, SerializedListNode } from '../../../../../../nodeTypes.js'\nimport type { JSXConverters } from '../types.js'\n\nexport const ListJSXConverter: JSXConverters<SerializedListItemNode | SerializedListNode> = {\n list: ({ node, nodesToJSX }) => {\n const children = nodesToJSX({\n nodes: node.children,\n })\n\n const NodeTag = node.tag\n\n return <NodeTag className={`list-${node?.listType}`}>{children}</NodeTag>\n },\n listitem: ({ node, nodesToJSX, parent }) => {\n const hasSubLists = node.children.some((child) => child.type === 'list')\n\n const children = nodesToJSX({\n nodes: node.children,\n })\n\n if ('listType' in parent && parent?.listType === 'check') {\n const uuid = uuidv4()\n\n return (\n <li\n aria-checked={node.checked ? 'true' : 'false'}\n className={`list-item-checkbox${node.checked ? ' list-item-checkbox-checked' : ' list-item-checkbox-unchecked'}${hasSubLists ? ' nestedListItem' : ''}`}\n // eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role\n role=\"checkbox\"\n style={{ listStyleType: 'none' }}\n tabIndex={-1}\n value={node?.value}\n >\n {hasSubLists ? (\n children\n ) : (\n <>\n <input checked={node.checked} id={uuid} type=\"checkbox\" />\n <label htmlFor={uuid}>{children}</label>\n <br />\n </>\n )}\n </li>\n )\n } else {\n return (\n <li\n className={hasSubLists ? 'nestedListItem' : ''}\n style={hasSubLists ? { listStyleType: 'none' } : {}}\n value={node?.value}\n >\n {children}\n </li>\n )\n }\n },\n}\n"],"mappings":";AAAA,SAASA,EAAA,IAAMC,MAAM,QAAQ;AAK7B,OAAO,MAAMC,gBAAA,GAA+E;EAC1FC,IAAA,EAAMA,CAAC;IAAEC,IAAI;IAAEC;EAAU,CAAE;IACzB,MAAMC,QAAA,GAAWD,UAAA,CAAW;MAC1BE,KAAA,EAAOH,IAAA,CAAKE;IACd;IAEA,MAAME,OAAA,GAAUJ,IAAA,CAAKK,GAAG;IAExB,oBAAOC,IAAA,CAACF,OAAA;MAAQG,SAAA,EAAW,QAAQP,IAAA,EAAMQ,QAAA,EAAU;gBAAGN;;EACxD;EACAO,QAAA,EAAUA,CAAC;IAAET,IAAI;IAAEC,UAAU;IAAES;EAAM,CAAE;IACrC,MAAMC,WAAA,GAAcX,IAAA,CAAKE,QAAQ,CAACU,IAAI,CAAEC,KAAA,IAAUA,KAAA,CAAMC,IAAI,KAAK;IAEjE,MAAMZ,QAAA,GAAWD,UAAA,CAAW;MAC1BE,KAAA,EAAOH,IAAA,CAAKE;IACd;IAEA,IAAI,cAAcQ,MAAA,IAAUA,MAAA,EAAQF,QAAA,KAAa,SAAS;MACxD,MAAMO,IAAA,GAAOlB,MAAA;MAEb,oBACES,IAAA,CAAC;QACC,gBAAcN,IAAA,CAAKgB,OAAO,GAAG,SAAS;QACtCT,SAAA,EAAW,qBAAqBP,IAAA,CAAKgB,OAAO,GAAG,gCAAgC,kCAAkCL,WAAA,GAAc,oBAAoB,IAAI;QACvJ;QACAM,IAAA,EAAK;QACLC,KAAA,EAAO;UAAEC,aAAA,EAAe;QAAO;QAC/BC,QAAA,EAAU,CAAC;QACXC,KAAA,EAAOrB,IAAA,EAAMqB,KAAA;kBAEZV,WAAA,GACCT,QAAA,gBAEAoB,KAAA,CAAAC,SAAA;kCACEjB,IAAA,CAAC;YAAMU,OAAA,EAAShB,IAAA,CAAKgB,OAAO;YAAEQ,EAAA,EAAIT,IAAA;YAAMD,IAAA,EAAK;2BAC7CR,IAAA,CAAC;YAAMmB,OAAA,EAASV,IAAA;sBAAOb;2BACvBI,IAAA,CAAC;;;IAKX,OAAO;MACL,oBACEA,IAAA,CAAC;QACCC,SAAA,EAAWI,WAAA,GAAc,mBAAmB;QAC5CO,KAAA,EAAOP,WAAA,GAAc;UAAEQ,aAAA,EAAe;QAAO,IAAI,CAAC;QAClDE,KAAA,EAAOrB,IAAA,EAAMqB,KAAA;kBAEZnB;;IAGP;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"list.js","names":["v4","uuidv4","ListJSXConverter","list","node","nodesToJSX","children","nodes","NodeTag","tag","_jsx","className","listType","listitem","parent","hasSubLists","some","child","type","uuid","checked","role","tabIndex","value","_jsxs","_Fragment","id","readOnly","htmlFor"],"sources":["../../../../../../../src/exports/react/components/RichText/converter/converters/list.tsx"],"sourcesContent":["import { v4 as uuidv4 } from 'uuid'\n\nimport type { SerializedListItemNode, SerializedListNode } from '../../../../../../nodeTypes.js'\nimport type { JSXConverters } from '../types.js'\n\nexport const ListJSXConverter: JSXConverters<SerializedListItemNode | SerializedListNode> = {\n list: ({ node, nodesToJSX }) => {\n const children = nodesToJSX({\n nodes: node.children,\n })\n\n const NodeTag = node.tag\n\n return <NodeTag className={`list-${node?.listType}`}>{children}</NodeTag>\n },\n listitem: ({ node, nodesToJSX, parent }) => {\n const hasSubLists = node.children.some((child) => child.type === 'list')\n\n const children = nodesToJSX({\n nodes: node.children,\n })\n\n if ('listType' in parent && parent?.listType === 'check') {\n const uuid = uuidv4()\n\n return (\n <li\n aria-checked={node.checked ? 'true' : 'false'}\n className={`list-item-checkbox${node.checked ? ' list-item-checkbox-checked' : ' list-item-checkbox-unchecked'}${hasSubLists ? ' nestedListItem' : ''}`}\n // eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role\n role=\"checkbox\"\n tabIndex={-1}\n value={node?.value}\n >\n {hasSubLists ? (\n children\n ) : (\n <>\n <input checked={node.checked} id={uuid} readOnly={true} type=\"checkbox\" />\n <label htmlFor={uuid}>{children}</label>\n <br />\n </>\n )}\n </li>\n )\n } else {\n return (\n <li className={hasSubLists ? 'nestedListItem' : ''} value={node?.value}>\n {children}\n </li>\n )\n }\n },\n}\n"],"mappings":";AAAA,SAASA,EAAA,IAAMC,MAAM,QAAQ;AAK7B,OAAO,MAAMC,gBAAA,GAA+E;EAC1FC,IAAA,EAAMA,CAAC;IAAEC,IAAI;IAAEC;EAAU,CAAE;IACzB,MAAMC,QAAA,GAAWD,UAAA,CAAW;MAC1BE,KAAA,EAAOH,IAAA,CAAKE;IACd;IAEA,MAAME,OAAA,GAAUJ,IAAA,CAAKK,GAAG;IAExB,oBAAOC,IAAA,CAACF,OAAA;MAAQG,SAAA,EAAW,QAAQP,IAAA,EAAMQ,QAAA,EAAU;gBAAGN;;EACxD;EACAO,QAAA,EAAUA,CAAC;IAAET,IAAI;IAAEC,UAAU;IAAES;EAAM,CAAE;IACrC,MAAMC,WAAA,GAAcX,IAAA,CAAKE,QAAQ,CAACU,IAAI,CAAEC,KAAA,IAAUA,KAAA,CAAMC,IAAI,KAAK;IAEjE,MAAMZ,QAAA,GAAWD,UAAA,CAAW;MAC1BE,KAAA,EAAOH,IAAA,CAAKE;IACd;IAEA,IAAI,cAAcQ,MAAA,IAAUA,MAAA,EAAQF,QAAA,KAAa,SAAS;MACxD,MAAMO,IAAA,GAAOlB,MAAA;MAEb,oBACES,IAAA,CAAC;QACC,gBAAcN,IAAA,CAAKgB,OAAO,GAAG,SAAS;QACtCT,SAAA,EAAW,qBAAqBP,IAAA,CAAKgB,OAAO,GAAG,gCAAgC,kCAAkCL,WAAA,GAAc,oBAAoB,IAAI;QACvJ;QACAM,IAAA,EAAK;QACLC,QAAA,EAAU,CAAC;QACXC,KAAA,EAAOnB,IAAA,EAAMmB,KAAA;kBAEZR,WAAA,GACCT,QAAA,gBAEAkB,KAAA,CAAAC,SAAA;kCACEf,IAAA,CAAC;YAAMU,OAAA,EAAShB,IAAA,CAAKgB,OAAO;YAAEM,EAAA,EAAIP,IAAA;YAAMQ,QAAA,EAAU;YAAMT,IAAA,EAAK;2BAC7DR,IAAA,CAAC;YAAMkB,OAAA,EAAST,IAAA;sBAAOb;2BACvBI,IAAA,CAAC;;;IAKX,OAAO;MACL,oBACEA,IAAA,CAAC;QAAGC,SAAA,EAAWI,WAAA,GAAc,mBAAmB;QAAIQ,KAAA,EAAOnB,IAAA,EAAMmB,KAAA;kBAC9DjB;;IAGP;EACF;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../../../../../src/exports/react/components/RichText/converter/converters/text.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAIhD,eAAO,MAAM,gBAAgB,EAAE,aAAa,CAAC,kBAAkB,CA4B9D,CAAA"}
1
+ {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../../../../../src/exports/react/components/RichText/converter/converters/text.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAIhD,eAAO,MAAM,gBAAgB,EAAE,aAAa,CAAC,kBAAkB,CA4B9D,CAAA"}
@@ -1,14 +1,11 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import escapeHTML from 'escape-html';
3
2
  import React from 'react';
4
3
  import { NodeFormat } from '../../../../../../lexical/utils/nodeFormat.js';
5
4
  export const TextJSXConverter = {
6
5
  text: ({
7
6
  node
8
7
  }) => {
9
- let text = /*#__PURE__*/_jsx(React.Fragment, {
10
- children: escapeHTML(node.text)
11
- });
8
+ let text = node.text;
12
9
  if (node.format & NodeFormat.IS_BOLD) {
13
10
  text = /*#__PURE__*/_jsx("strong", {
14
11
  children: text
@@ -1 +1 @@
1
- {"version":3,"file":"text.js","names":["escapeHTML","React","NodeFormat","TextJSXConverter","text","node","_jsx","Fragment","format","IS_BOLD","IS_ITALIC","IS_STRIKETHROUGH","style","textDecoration","IS_UNDERLINE","IS_CODE","IS_SUBSCRIPT","IS_SUPERSCRIPT"],"sources":["../../../../../../../src/exports/react/components/RichText/converter/converters/text.tsx"],"sourcesContent":["import escapeHTML from 'escape-html'\nimport React from 'react'\n\nimport type { SerializedTextNode } from '../../../../../../nodeTypes.js'\nimport type { JSXConverters } from '../types.js'\n\nimport { NodeFormat } from '../../../../../../lexical/utils/nodeFormat.js'\n\nexport const TextJSXConverter: JSXConverters<SerializedTextNode> = {\n text: ({ node }) => {\n let text: React.ReactNode = <React.Fragment>{escapeHTML(node.text)}</React.Fragment>\n\n if (node.format & NodeFormat.IS_BOLD) {\n text = <strong>{text}</strong>\n }\n if (node.format & NodeFormat.IS_ITALIC) {\n text = <em>{text}</em>\n }\n if (node.format & NodeFormat.IS_STRIKETHROUGH) {\n text = <span style={{ textDecoration: 'line-through' }}>{text}</span>\n }\n if (node.format & NodeFormat.IS_UNDERLINE) {\n text = <span style={{ textDecoration: 'underline' }}>{text}</span>\n }\n if (node.format & NodeFormat.IS_CODE) {\n text = <code>{text}</code>\n }\n if (node.format & NodeFormat.IS_SUBSCRIPT) {\n text = <sub>{text}</sub>\n }\n if (node.format & NodeFormat.IS_SUPERSCRIPT) {\n text = <sup>{text}</sup>\n }\n\n return text\n },\n}\n"],"mappings":";AAAA,OAAOA,UAAA,MAAgB;AACvB,OAAOC,KAAA,MAAW;AAKlB,SAASC,UAAU,QAAQ;AAE3B,OAAO,MAAMC,gBAAA,GAAsD;EACjEC,IAAA,EAAMA,CAAC;IAAEC;EAAI,CAAE;IACb,IAAID,IAAA,gBAAwBE,IAAA,CAACL,KAAA,CAAMM,QAAQ;gBAAEP,UAAA,CAAWK,IAAA,CAAKD,IAAI;;IAEjE,IAAIC,IAAA,CAAKG,MAAM,GAAGN,UAAA,CAAWO,OAAO,EAAE;MACpCL,IAAA,gBAAOE,IAAA,CAAC;kBAAQF;;IAClB;IACA,IAAIC,IAAA,CAAKG,MAAM,GAAGN,UAAA,CAAWQ,SAAS,EAAE;MACtCN,IAAA,gBAAOE,IAAA,CAAC;kBAAIF;;IACd;IACA,IAAIC,IAAA,CAAKG,MAAM,GAAGN,UAAA,CAAWS,gBAAgB,EAAE;MAC7CP,IAAA,gBAAOE,IAAA,CAAC;QAAKM,KAAA,EAAO;UAAEC,cAAA,EAAgB;QAAe;kBAAIT;;IAC3D;IACA,IAAIC,IAAA,CAAKG,MAAM,GAAGN,UAAA,CAAWY,YAAY,EAAE;MACzCV,IAAA,gBAAOE,IAAA,CAAC;QAAKM,KAAA,EAAO;UAAEC,cAAA,EAAgB;QAAY;kBAAIT;;IACxD;IACA,IAAIC,IAAA,CAAKG,MAAM,GAAGN,UAAA,CAAWa,OAAO,EAAE;MACpCX,IAAA,gBAAOE,IAAA,CAAC;kBAAMF;;IAChB;IACA,IAAIC,IAAA,CAAKG,MAAM,GAAGN,UAAA,CAAWc,YAAY,EAAE;MACzCZ,IAAA,gBAAOE,IAAA,CAAC;kBAAKF;;IACf;IACA,IAAIC,IAAA,CAAKG,MAAM,GAAGN,UAAA,CAAWe,cAAc,EAAE;MAC3Cb,IAAA,gBAAOE,IAAA,CAAC;kBAAKF;;IACf;IAEA,OAAOA,IAAA;EACT;AACF","ignoreList":[]}
1
+ {"version":3,"file":"text.js","names":["React","NodeFormat","TextJSXConverter","text","node","format","IS_BOLD","_jsx","IS_ITALIC","IS_STRIKETHROUGH","style","textDecoration","IS_UNDERLINE","IS_CODE","IS_SUBSCRIPT","IS_SUPERSCRIPT"],"sources":["../../../../../../../src/exports/react/components/RichText/converter/converters/text.tsx"],"sourcesContent":["import React from 'react'\n\nimport type { SerializedTextNode } from '../../../../../../nodeTypes.js'\nimport type { JSXConverters } from '../types.js'\n\nimport { NodeFormat } from '../../../../../../lexical/utils/nodeFormat.js'\n\nexport const TextJSXConverter: JSXConverters<SerializedTextNode> = {\n text: ({ node }) => {\n let text: React.ReactNode = node.text\n\n if (node.format & NodeFormat.IS_BOLD) {\n text = <strong>{text}</strong>\n }\n if (node.format & NodeFormat.IS_ITALIC) {\n text = <em>{text}</em>\n }\n if (node.format & NodeFormat.IS_STRIKETHROUGH) {\n text = <span style={{ textDecoration: 'line-through' }}>{text}</span>\n }\n if (node.format & NodeFormat.IS_UNDERLINE) {\n text = <span style={{ textDecoration: 'underline' }}>{text}</span>\n }\n if (node.format & NodeFormat.IS_CODE) {\n text = <code>{text}</code>\n }\n if (node.format & NodeFormat.IS_SUBSCRIPT) {\n text = <sub>{text}</sub>\n }\n if (node.format & NodeFormat.IS_SUPERSCRIPT) {\n text = <sup>{text}</sup>\n }\n\n return text\n },\n}\n"],"mappings":";AAAA,OAAOA,KAAA,MAAW;AAKlB,SAASC,UAAU,QAAQ;AAE3B,OAAO,MAAMC,gBAAA,GAAsD;EACjEC,IAAA,EAAMA,CAAC;IAAEC;EAAI,CAAE;IACb,IAAID,IAAA,GAAwBC,IAAA,CAAKD,IAAI;IAErC,IAAIC,IAAA,CAAKC,MAAM,GAAGJ,UAAA,CAAWK,OAAO,EAAE;MACpCH,IAAA,gBAAOI,IAAA,CAAC;kBAAQJ;;IAClB;IACA,IAAIC,IAAA,CAAKC,MAAM,GAAGJ,UAAA,CAAWO,SAAS,EAAE;MACtCL,IAAA,gBAAOI,IAAA,CAAC;kBAAIJ;;IACd;IACA,IAAIC,IAAA,CAAKC,MAAM,GAAGJ,UAAA,CAAWQ,gBAAgB,EAAE;MAC7CN,IAAA,gBAAOI,IAAA,CAAC;QAAKG,KAAA,EAAO;UAAEC,cAAA,EAAgB;QAAe;kBAAIR;;IAC3D;IACA,IAAIC,IAAA,CAAKC,MAAM,GAAGJ,UAAA,CAAWW,YAAY,EAAE;MACzCT,IAAA,gBAAOI,IAAA,CAAC;QAAKG,KAAA,EAAO;UAAEC,cAAA,EAAgB;QAAY;kBAAIR;;IACxD;IACA,IAAIC,IAAA,CAAKC,MAAM,GAAGJ,UAAA,CAAWY,OAAO,EAAE;MACpCV,IAAA,gBAAOI,IAAA,CAAC;kBAAMJ;;IAChB;IACA,IAAIC,IAAA,CAAKC,MAAM,GAAGJ,UAAA,CAAWa,YAAY,EAAE;MACzCX,IAAA,gBAAOI,IAAA,CAAC;kBAAKJ;;IACf;IACA,IAAIC,IAAA,CAAKC,MAAM,GAAGJ,UAAA,CAAWc,cAAc,EAAE;MAC3CZ,IAAA,gBAAOI,IAAA,CAAC;kBAAKJ;;IACf;IAEA,OAAOA,IAAA;EACT;AACF","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ import type { DefaultNodeTypes } from '../../../../../nodeTypes.js';
1
2
  import type { JSXConverters } from './types.js';
2
- export declare const defaultJSXConverters: JSXConverters;
3
+ export declare const defaultJSXConverters: JSXConverters<DefaultNodeTypes>;
3
4
  //# sourceMappingURL=defaultConverters.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"defaultConverters.d.ts","sourceRoot":"","sources":["../../../../../../src/exports/react/components/RichText/converter/defaultConverters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAa/C,eAAO,MAAM,oBAAoB,EAAE,aAWlC,CAAA"}
1
+ {"version":3,"file":"defaultConverters.d.ts","sourceRoot":"","sources":["../../../../../../src/exports/react/components/RichText/converter/defaultConverters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAa/C,eAAO,MAAM,oBAAoB,EAAE,aAAa,CAAC,gBAAgB,CAWhE,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"defaultConverters.js","names":["BlockquoteJSXConverter","HeadingJSXConverter","HorizontalRuleJSXConverter","LinebreakJSXConverter","LinkJSXConverter","ListJSXConverter","ParagraphJSXConverter","TableJSXConverter","TextJSXConverter","UploadJSXConverter","defaultJSXConverters"],"sources":["../../../../../../src/exports/react/components/RichText/converter/defaultConverters.ts"],"sourcesContent":["import type { JSXConverters } from './types.js'\n\nimport { BlockquoteJSXConverter } from './converters/blockquote.js'\nimport { HeadingJSXConverter } from './converters/heading.js'\nimport { HorizontalRuleJSXConverter } from './converters/horizontalRule.js'\nimport { LinebreakJSXConverter } from './converters/linebreak.js'\nimport { LinkJSXConverter } from './converters/link.js'\nimport { ListJSXConverter } from './converters/list.js'\nimport { ParagraphJSXConverter } from './converters/paragraph.js'\nimport { TableJSXConverter } from './converters/table.js'\nimport { TextJSXConverter } from './converters/text.js'\nimport { UploadJSXConverter } from './converters/upload.js'\n\nexport const defaultJSXConverters: JSXConverters = {\n ...ParagraphJSXConverter,\n ...TextJSXConverter,\n ...LinebreakJSXConverter,\n ...BlockquoteJSXConverter,\n ...TableJSXConverter,\n ...HeadingJSXConverter,\n ...HorizontalRuleJSXConverter,\n ...ListJSXConverter,\n ...LinkJSXConverter({}),\n ...UploadJSXConverter,\n}\n"],"mappings":"AAEA,SAASA,sBAAsB,QAAQ;AACvC,SAASC,mBAAmB,QAAQ;AACpC,SAASC,0BAA0B,QAAQ;AAC3C,SAASC,qBAAqB,QAAQ;AACtC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,qBAAqB,QAAQ;AACtC,SAASC,iBAAiB,QAAQ;AAClC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,kBAAkB,QAAQ;AAEnC,OAAO,MAAMC,oBAAA,GAAsC;EACjD,GAAGJ,qBAAqB;EACxB,GAAGE,gBAAgB;EACnB,GAAGL,qBAAqB;EACxB,GAAGH,sBAAsB;EACzB,GAAGO,iBAAiB;EACpB,GAAGN,mBAAmB;EACtB,GAAGC,0BAA0B;EAC7B,GAAGG,gBAAgB;EACnB,GAAGD,gBAAA,CAAiB,CAAC,EAAE;EACvB,GAAGK;AACL","ignoreList":[]}
1
+ {"version":3,"file":"defaultConverters.js","names":["BlockquoteJSXConverter","HeadingJSXConverter","HorizontalRuleJSXConverter","LinebreakJSXConverter","LinkJSXConverter","ListJSXConverter","ParagraphJSXConverter","TableJSXConverter","TextJSXConverter","UploadJSXConverter","defaultJSXConverters"],"sources":["../../../../../../src/exports/react/components/RichText/converter/defaultConverters.ts"],"sourcesContent":["import type { DefaultNodeTypes } from '../../../../../nodeTypes.js'\nimport type { JSXConverters } from './types.js'\n\nimport { BlockquoteJSXConverter } from './converters/blockquote.js'\nimport { HeadingJSXConverter } from './converters/heading.js'\nimport { HorizontalRuleJSXConverter } from './converters/horizontalRule.js'\nimport { LinebreakJSXConverter } from './converters/linebreak.js'\nimport { LinkJSXConverter } from './converters/link.js'\nimport { ListJSXConverter } from './converters/list.js'\nimport { ParagraphJSXConverter } from './converters/paragraph.js'\nimport { TableJSXConverter } from './converters/table.js'\nimport { TextJSXConverter } from './converters/text.js'\nimport { UploadJSXConverter } from './converters/upload.js'\n\nexport const defaultJSXConverters: JSXConverters<DefaultNodeTypes> = {\n ...ParagraphJSXConverter,\n ...TextJSXConverter,\n ...LinebreakJSXConverter,\n ...BlockquoteJSXConverter,\n ...TableJSXConverter,\n ...HeadingJSXConverter,\n ...HorizontalRuleJSXConverter,\n ...ListJSXConverter,\n ...LinkJSXConverter({}),\n ...UploadJSXConverter,\n}\n"],"mappings":"AAGA,SAASA,sBAAsB,QAAQ;AACvC,SAASC,mBAAmB,QAAQ;AACpC,SAASC,0BAA0B,QAAQ;AAC3C,SAASC,qBAAqB,QAAQ;AACtC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,qBAAqB,QAAQ;AACtC,SAASC,iBAAiB,QAAQ;AAClC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,kBAAkB,QAAQ;AAEnC,OAAO,MAAMC,oBAAA,GAAwD;EACnE,GAAGJ,qBAAqB;EACxB,GAAGE,gBAAgB;EACnB,GAAGL,qBAAqB;EACxB,GAAGH,sBAAsB;EACzB,GAAGO,iBAAiB;EACpB,GAAGN,mBAAmB;EACtB,GAAGC,0BAA0B;EAC7B,GAAGG,gBAAgB;EACnB,GAAGD,gBAAA,CAAiB,CAAC,EAAE;EACvB,GAAGK;AACL","ignoreList":[]}
@@ -110,7 +110,7 @@ export function convertLexicalNodesToJSX({
110
110
  }
111
111
  }
112
112
  if (!disableIndent && (!Array.isArray(disableIndent) || !disableIndent?.includes(node.type))) {
113
- if ('indent' in node && node.indent) {
113
+ if ('indent' in node && node.indent && node.type !== 'listitem') {
114
114
  style.paddingInlineStart = `${Number(node.indent) * 2}em`;
115
115
  }
116
116
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","convertLexicalToJSX","converters","data","disableIndent","disableTextAlign","root","children","length","convertLexicalNodesToJSX","nodes","parent","_jsx","_Fragment","unknownConverter","unknown","jsxArray","map","node","i","converterForNode","type","blocks","fields","blockType","console","error","inlineBlocks","childIndex","nodesToJSX","args","reactNode","style","Array","isArray","includes","format","textAlign","indent","paddingInlineStart","Number","isValidElement","newStyle","props","cloneElement","key","filter","Boolean","jsx"],"sources":["../../../../../../src/exports/react/components/RichText/converter/index.tsx"],"sourcesContent":["import type { SerializedEditorState, SerializedLexicalNode } from 'lexical'\n\nimport React from 'react'\n\nimport type { SerializedBlockNode, SerializedInlineBlockNode } from '../../../../../nodeTypes.js'\nimport type { JSXConverter, JSXConverters, SerializedLexicalNodeWithParent } from './types.js'\n\nexport type ConvertLexicalToHTMLArgs = {\n converters: JSXConverters\n data: SerializedEditorState\n disableIndent?: boolean | string[]\n disableTextAlign?: boolean | string[]\n}\n\nexport function convertLexicalToJSX({\n converters,\n data,\n disableIndent,\n disableTextAlign,\n}: ConvertLexicalToHTMLArgs): React.ReactNode {\n if (data?.root?.children?.length) {\n return convertLexicalNodesToJSX({\n converters,\n disableIndent,\n disableTextAlign,\n nodes: data?.root?.children,\n parent: data?.root,\n })\n }\n return <></>\n}\n\nexport function convertLexicalNodesToJSX({\n converters,\n disableIndent,\n disableTextAlign,\n nodes,\n parent,\n}: {\n converters: JSXConverters\n disableIndent?: boolean | string[]\n disableTextAlign?: boolean | string[]\n nodes: SerializedLexicalNode[]\n parent: SerializedLexicalNodeWithParent\n}): React.ReactNode[] {\n const unknownConverter: JSXConverter<any> = converters.unknown as JSXConverter<any>\n\n const jsxArray: React.ReactNode[] = nodes.map((node, i) => {\n let converterForNode: JSXConverter<any> | undefined\n if (node.type === 'block') {\n converterForNode = converters?.blocks?.[(node as SerializedBlockNode)?.fields?.blockType]\n if (!converterForNode) {\n console.error(\n `Lexical => JSX converter: Blocks converter: found ${(node as SerializedBlockNode)?.fields?.blockType} block, but no converter is provided`,\n )\n }\n } else if (node.type === 'inlineBlock') {\n converterForNode =\n converters?.inlineBlocks?.[(node as SerializedInlineBlockNode)?.fields?.blockType]\n if (!converterForNode) {\n console.error(\n `Lexical => JSX converter: Inline Blocks converter: found ${(node as SerializedInlineBlockNode)?.fields?.blockType} inline block, but no converter is provided`,\n )\n }\n } else {\n converterForNode = converters[node.type] as JSXConverter<any>\n }\n\n try {\n if (!converterForNode) {\n if (unknownConverter) {\n return unknownConverter({\n childIndex: i,\n converters,\n node,\n nodesToJSX: (args) => {\n return convertLexicalNodesToJSX({\n converters: args.converters ?? converters,\n disableIndent: args.disableIndent ?? disableIndent,\n disableTextAlign: args.disableTextAlign ?? disableTextAlign,\n nodes: args.nodes,\n parent: args.parent ?? {\n ...node,\n parent,\n },\n })\n },\n parent,\n })\n }\n return <span key={i}>unknown node</span>\n }\n\n const reactNode = converterForNode({\n childIndex: i,\n converters,\n node,\n nodesToJSX: (args) => {\n return convertLexicalNodesToJSX({\n converters: args.converters ?? converters,\n disableIndent: args.disableIndent ?? disableIndent,\n disableTextAlign: args.disableTextAlign ?? disableTextAlign,\n nodes: args.nodes,\n parent: args.parent ?? {\n ...node,\n parent,\n },\n })\n },\n parent,\n })\n\n const style: React.CSSProperties = {}\n\n // Check if disableTextAlign is not true and does not include node type\n if (\n !disableTextAlign &&\n (!Array.isArray(disableTextAlign) || !disableTextAlign?.includes(node.type))\n ) {\n if ('format' in node && node.format) {\n switch (node.format) {\n case 'center':\n style.textAlign = 'center'\n break\n case 'end':\n style.textAlign = 'right'\n break\n case 'justify':\n style.textAlign = 'justify'\n break\n case 'left':\n //style.textAlign = 'left'\n // Do nothing, as left is the default\n break\n case 'right':\n style.textAlign = 'right'\n break\n case 'start':\n style.textAlign = 'left'\n break\n }\n }\n }\n\n if (\n !disableIndent &&\n (!Array.isArray(disableIndent) || !disableIndent?.includes(node.type))\n ) {\n if ('indent' in node && node.indent) {\n style.paddingInlineStart = `${Number(node.indent) * 2}em`\n }\n }\n\n if (React.isValidElement(reactNode)) {\n // Inject style into reactNode\n if (style.textAlign || style.paddingInlineStart) {\n const newStyle = {\n ...style,\n // @ts-expect-error type better later\n ...(reactNode?.props?.style ?? {}),\n // reactNode style comes after, thus a textAlign specified in the converter has priority over the one we inject here\n }\n\n return React.cloneElement(reactNode, {\n key: i,\n // @ts-expect-error type better later\n style: newStyle,\n })\n }\n return React.cloneElement(reactNode, {\n key: i,\n })\n }\n\n return reactNode\n } catch (error) {\n console.error('Error converting lexical node to HTML:', error, 'node:', node)\n return null\n }\n })\n\n return jsxArray.filter(Boolean).map((jsx) => jsx)\n}\n"],"mappings":";AAEA,OAAOA,KAAA,MAAW;AAYlB,OAAO,SAASC,oBAAoB;EAClCC,UAAU;EACVC,IAAI;EACJC,aAAa;EACbC;AAAgB,CACS;EACzB,IAAIF,IAAA,EAAMG,IAAA,EAAMC,QAAA,EAAUC,MAAA,EAAQ;IAChC,OAAOC,wBAAA,CAAyB;MAC9BP,UAAA;MACAE,aAAA;MACAC,gBAAA;MACAK,KAAA,EAAOP,IAAA,EAAMG,IAAA,EAAMC,QAAA;MACnBI,MAAA,EAAQR,IAAA,EAAMG;IAChB;EACF;EACA,oBAAOM,IAAA,CAAAC,SAAA;AACT;AAEA,OAAO,SAASJ,yBAAyB;EACvCP,UAAU;EACVE,aAAa;EACbC,gBAAgB;EAChBK,KAAK;EACLC;AAAM,CAOP;EACC,MAAMG,gBAAA,GAAsCZ,UAAA,CAAWa,OAAO;EAE9D,MAAMC,QAAA,GAA8BN,KAAA,CAAMO,GAAG,CAAC,CAACC,IAAA,EAAMC,CAAA;IACnD,IAAIC,gBAAA;IACJ,IAAIF,IAAA,CAAKG,IAAI,KAAK,SAAS;MACzBD,gBAAA,GAAmBlB,UAAA,EAAYoB,MAAA,GAAUJ,IAAA,EAA8BK,MAAA,EAAQC,SAAA,CAAU;MACzF,IAAI,CAACJ,gBAAA,EAAkB;QACrBK,OAAA,CAAQC,KAAK,CACX,qDAAsDR,IAAA,EAA8BK,MAAA,EAAQC,SAAA,sCAA+C;MAE/I;IACF,OAAO,IAAIN,IAAA,CAAKG,IAAI,KAAK,eAAe;MACtCD,gBAAA,GACElB,UAAA,EAAYyB,YAAA,GAAgBT,IAAA,EAAoCK,MAAA,EAAQC,SAAA,CAAU;MACpF,IAAI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KAAA,CAAM4C,YAAY,CAACb,SAAA,EAAW;UACnCc,GAAA,EAAK1B;QACP;MACF;MAEA,OAAOY,SAAA;IACT,EAAE,OAAOL,KAAA,EAAO;MACdD,OAAA,CAAQC,KAAK,CAAC,0CAA0CA,KAAA,EAAO,SAASR,IAAA;MACxE,OAAO;IACT;EACF;EAEA,OAAOF,QAAA,CAAS8B,MAAM,CAACC,OAAA,EAAS9B,GAAG,CAAE+B,GAAA,IAAQA,GAAA;AAC/C","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["React","convertLexicalToJSX","converters","data","disableIndent","disableTextAlign","root","children","length","convertLexicalNodesToJSX","nodes","parent","_jsx","_Fragment","unknownConverter","unknown","jsxArray","map","node","i","converterForNode","type","blocks","fields","blockType","console","error","inlineBlocks","childIndex","nodesToJSX","args","reactNode","style","Array","isArray","includes","format","textAlign","indent","paddingInlineStart","Number","isValidElement","newStyle","props","cloneElement","key","filter","Boolean","jsx"],"sources":["../../../../../../src/exports/react/components/RichText/converter/index.tsx"],"sourcesContent":["import type { SerializedEditorState, SerializedLexicalNode } from 'lexical'\n\nimport React from 'react'\n\nimport type { SerializedBlockNode, SerializedInlineBlockNode } from '../../../../../nodeTypes.js'\nimport type { JSXConverter, JSXConverters, SerializedLexicalNodeWithParent } from './types.js'\n\nexport type ConvertLexicalToHTMLArgs = {\n converters: JSXConverters\n data: SerializedEditorState\n disableIndent?: boolean | string[]\n disableTextAlign?: boolean | string[]\n}\n\nexport function convertLexicalToJSX({\n converters,\n data,\n disableIndent,\n disableTextAlign,\n}: ConvertLexicalToHTMLArgs): React.ReactNode {\n if (data?.root?.children?.length) {\n return convertLexicalNodesToJSX({\n converters,\n disableIndent,\n disableTextAlign,\n nodes: data?.root?.children,\n parent: data?.root,\n })\n }\n return <></>\n}\n\nexport function convertLexicalNodesToJSX({\n converters,\n disableIndent,\n disableTextAlign,\n nodes,\n parent,\n}: {\n converters: JSXConverters\n disableIndent?: boolean | string[]\n disableTextAlign?: boolean | string[]\n nodes: SerializedLexicalNode[]\n parent: SerializedLexicalNodeWithParent\n}): React.ReactNode[] {\n const unknownConverter: JSXConverter<any> = converters.unknown as JSXConverter<any>\n\n const jsxArray: React.ReactNode[] = nodes.map((node, i) => {\n let converterForNode: JSXConverter<any> | undefined\n if (node.type === 'block') {\n converterForNode = converters?.blocks?.[(node as SerializedBlockNode)?.fields?.blockType]\n if (!converterForNode) {\n console.error(\n `Lexical => JSX converter: Blocks converter: found ${(node as SerializedBlockNode)?.fields?.blockType} block, but no converter is provided`,\n )\n }\n } else if (node.type === 'inlineBlock') {\n converterForNode =\n converters?.inlineBlocks?.[(node as SerializedInlineBlockNode)?.fields?.blockType]\n if (!converterForNode) {\n console.error(\n `Lexical => JSX converter: Inline Blocks converter: found ${(node as SerializedInlineBlockNode)?.fields?.blockType} inline block, but no converter is provided`,\n )\n }\n } else {\n converterForNode = converters[node.type] as JSXConverter<any>\n }\n\n try {\n if (!converterForNode) {\n if (unknownConverter) {\n return unknownConverter({\n childIndex: i,\n converters,\n node,\n nodesToJSX: (args) => {\n return convertLexicalNodesToJSX({\n converters: args.converters ?? converters,\n disableIndent: args.disableIndent ?? disableIndent,\n disableTextAlign: args.disableTextAlign ?? disableTextAlign,\n nodes: args.nodes,\n parent: args.parent ?? {\n ...node,\n parent,\n },\n })\n },\n parent,\n })\n }\n return <span key={i}>unknown node</span>\n }\n\n const reactNode = converterForNode({\n childIndex: i,\n converters,\n node,\n nodesToJSX: (args) => {\n return convertLexicalNodesToJSX({\n converters: args.converters ?? converters,\n disableIndent: args.disableIndent ?? disableIndent,\n disableTextAlign: args.disableTextAlign ?? disableTextAlign,\n nodes: args.nodes,\n parent: args.parent ?? {\n ...node,\n parent,\n },\n })\n },\n parent,\n })\n\n const style: React.CSSProperties = {}\n\n // Check if disableTextAlign is not true and does not include node type\n if (\n !disableTextAlign &&\n (!Array.isArray(disableTextAlign) || !disableTextAlign?.includes(node.type))\n ) {\n if ('format' in node && node.format) {\n switch (node.format) {\n case 'center':\n style.textAlign = 'center'\n break\n case 'end':\n style.textAlign = 'right'\n break\n case 'justify':\n style.textAlign = 'justify'\n break\n case 'left':\n //style.textAlign = 'left'\n // Do nothing, as left is the default\n break\n case 'right':\n style.textAlign = 'right'\n break\n case 'start':\n style.textAlign = 'left'\n break\n }\n }\n }\n\n if (\n !disableIndent &&\n (!Array.isArray(disableIndent) || !disableIndent?.includes(node.type))\n ) {\n if ('indent' in node && node.indent && node.type !== 'listitem') {\n style.paddingInlineStart = `${Number(node.indent) * 2}em`\n }\n }\n\n if (React.isValidElement(reactNode)) {\n // Inject style into reactNode\n if (style.textAlign || style.paddingInlineStart) {\n const newStyle = {\n ...style,\n // @ts-expect-error type better later\n ...(reactNode?.props?.style ?? {}),\n // reactNode style comes after, thus a textAlign specified in the converter has priority over the one we inject here\n }\n\n return React.cloneElement(reactNode, {\n key: i,\n // @ts-expect-error type better later\n style: newStyle,\n })\n }\n return React.cloneElement(reactNode, {\n key: i,\n })\n }\n\n return reactNode\n } catch (error) {\n console.error('Error converting lexical node to HTML:', error, 'node:', node)\n return null\n }\n })\n\n return jsxArray.filter(Boolean).map((jsx) => jsx)\n}\n"],"mappings":";AAEA,OAAOA,KAAA,MAAW;AAYlB,OAAO,SAASC,oBAAoB;EAClCC,UAAU;EACVC,IAAI;EACJC,aAAa;EACbC;AAAgB,CACS;EACzB,IAAIF,IAAA,EAAMG,IAAA,EAAMC,QAAA,EAAUC,MAAA,EAAQ;IAChC,OAAOC,wBAAA,CAAyB;MAC9BP,UAAA;MACAE,aAAA;MACAC,gBAAA;MACAK,KAAA,EAAOP,IAAA,EAAMG,IAAA,EAAMC,QAAA;MACnBI,MAAA,EAAQR,IAAA,EAAMG;IAChB;EACF;EACA,oBAAOM,IAAA,CAAAC,SAAA;AACT;AAEA,OAAO,SAASJ,yBAAyB;EACvCP,UAAU;EACVE,aAAa;EACbC,gBAAgB;EAChBK,KAAK;EACLC;AAAM,CAOP;EACC,MAAMG,gBAAA,GAAsCZ,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A,IAAI,YAAYH,IAAA,IAAQA,IAAA,CAAKoB,MAAM,IAAIpB,IAAA,CAAKG,IAAI,KAAK,YAAY;UAC/DW,KAAA,CAAMO,kBAAkB,GAAG,GAAGC,MAAA,CAAOtB,IAAA,CAAKoB,MAAM,IAAI,KAAK;QAC3D;MACF;MAEA,iBAAItC,KAAA,CAAMyC,cAAc,CAACV,SAAA,GAAY;QACnC;QACA,IAAIC,KAAA,CAAMK,SAAS,IAAIL,KAAA,CAAMO,kBAAkB,EAAE;UAC/C,MAAMG,QAAA,GAAW;YACf,GAAGV,KAAK;YACR;YACA,IAAID,SAAA,EAAWY,KAAA,EAAOX,KAAA,IAAS,CAAC,CAAC;UAEnC;UAEA,oBAAOhC,KAAA,CAAM4C,YAAY,CAACb,SAAA,EAAW;YACnCc,GAAA,EAAK1B,CAAA;YACL;YACAa,KAAA,EAAOU;UACT;QACF;QACA,oBAAO1C,KAAA,CAAM4C,YAAY,CAACb,SAAA,EAAW;UACnCc,GAAA,EAAK1B;QACP;MACF;MAEA,OAAOY,SAAA;IACT,EAAE,OAAOL,KAAA,EAAO;MACdD,OAAA,CAAQC,KAAK,CAAC,0CAA0CA,KAAA,EAAO,SAASR,IAAA;MACxE,OAAO;IACT;EACF;EAEA,OAAOF,QAAA,CAAS8B,MAAM,CAACC,OAAA,EAAS9B,GAAG,CAAE+B,GAAA,IAAQA,GAAA;AAC/C","ignoreList":[]}
@@ -19,24 +19,42 @@ export type JSXConverter<T extends {
19
19
  export type JSXConverters<T extends {
20
20
  [key: string]: any;
21
21
  type?: string;
22
- } = DefaultNodeTypes> = {
22
+ } = DefaultNodeTypes | SerializedBlockNode<{
23
+ blockName?: null | string;
24
+ blockType: string;
25
+ }> | SerializedInlineBlockNode<{
26
+ blockName?: null | string;
27
+ blockType: string;
28
+ }>> = {
23
29
  [key: string]: {
24
30
  [blockSlug: string]: JSXConverter<any>;
25
31
  } | JSXConverter<any> | undefined;
26
32
  } & {
27
- [nodeType in NonNullable<T['type']>]?: JSXConverter<Extract<T, {
33
+ [nodeType in Exclude<NonNullable<T['type']>, 'block' | 'inlineBlock'>]?: JSXConverter<Extract<T, {
28
34
  type: nodeType;
29
35
  }>>;
30
36
  } & {
31
37
  blocks?: {
32
- [blockSlug: string]: JSXConverter<{
33
- fields: Record<string, any>;
34
- } & SerializedBlockNode>;
38
+ [K in Extract<Extract<T, {
39
+ type: 'block';
40
+ }> extends SerializedBlockNode<infer B> ? B extends {
41
+ blockType: string;
42
+ } ? B['blockType'] : never : never, string>]?: JSXConverter<Extract<T, {
43
+ type: 'block';
44
+ }> extends SerializedBlockNode<infer B> ? SerializedBlockNode<Extract<B, {
45
+ blockType: K;
46
+ }>> : SerializedBlockNode>;
35
47
  };
36
48
  inlineBlocks?: {
37
- [blockSlug: string]: JSXConverter<{
38
- fields: Record<string, any>;
39
- } & SerializedInlineBlockNode>;
49
+ [K in Extract<Extract<T, {
50
+ type: 'inlineBlock';
51
+ }> extends SerializedInlineBlockNode<infer B> ? B extends {
52
+ blockType: string;
53
+ } ? B['blockType'] : never : never, string>]?: JSXConverter<Extract<T, {
54
+ type: 'inlineBlock';
55
+ }> extends SerializedInlineBlockNode<infer B> ? SerializedInlineBlockNode<Extract<B, {
56
+ blockType: K;
57
+ }>> : SerializedInlineBlockNode>;
40
58
  };
41
59
  };
42
60
  export type SerializedLexicalNodeWithParent = {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/exports/react/components/RichText/converter/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAEpD,OAAO,KAAK,EACV,gBAAgB,EAChB,mBAAmB,EACnB,yBAAyB,EAC1B,MAAM,6BAA6B,CAAA;AACpC,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,qB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AE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;SAAE,GAAG,yBAAyB,CAAC,CAAA;KAC/F,CAAA;CACF,CAAA;AAED,MAAM,MAAM,+BAA+B,GAAG;IAC5C,MAAM,CAAC,EAAE,qBAAqB,CAAA;CAC/B,GAAG,qBAAqB,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/exports/react/components/RichText/converter/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAEpD,OAAO,KAAK,EACV,gBAAgB,EAChB,mBAAmB,EACnB,yBAAyB,EAC1B,MAAM,6BAA6B,CAAA;AACpC,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,qBAAqB,IAC9F,CAAC,IAAI,EAAE;IACL,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,aAAa,CAAA;IACzB,IAAI,EAAE,CAAC,CAAA;IACP,UAAU,EAAE,CAAC,IAAI,EAAE;QACjB,UAAU,CAAC,EAAE,aAAa,CAAA;QAC1B,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAA;QAClC,gBAAgB,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAA;QACrC,KAAK,EAAE,qBAAqB,EAAE,CAAA;QAC9B,MAAM,CAAC,EAAE,+BAA+B,CAAA;KACzC,KAAK,KAAK,CAAC,SAAS,EAAE,CAAA;IACvB,MAAM,EAAE,+BAA+B,CAAA;CACxC,KAAK,KAAK,CAAC,SAAS,CAAA;AAEvB,MAAM,MAAM,aAAa,CACvB,CAAC,SAAS;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAC3C,gBAAgB,G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,EAAE,aAAa,CAAA;SAAE,CAAC,SAAS,yBAAyB,CAAC,MAAM,CAAC,CAAC,GAC1E,CAAC,SAAS;YAAE,SAAS,EAAE,MAAM,CAAA;SAAE,GAC7B,CAAC,CAAC,WAAW,CAAC,GACd,KAAK,GACP,KAAK,EACT,MAAM,CACP,CAAC,CAAC,EAAE,YAAY,CACf,OAAO,CAAC,CAAC,EAAE;YAAE,IAAI,EAAE,aAAa,CAAA;SAAE,CAAC,SAAS,yBAAyB,CAAC,MAAM,CAAC,CAAC,GAC1E,yBAAyB,CAAC,OAAO,CAAC,CAAC,EAAE;YAAE,SAAS,EAAE,CAAC,CAAA;SAAE,CAAC,CAAC,GACvD,yBAAyB,CAC9B;KACF,CAAA;CACF,CAAA;AACD,MAAM,MAAM,+BAA+B,GAAG;IAC5C,MAAM,CAAC,EAAE,qBAAqB,CAAA;CAC/B,GAAG,qBAAqB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../../../../src/exports/react/components/RichText/converter/types.ts"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\n\nimport type {\n DefaultNodeTypes,\n SerializedBlockNode,\n SerializedInlineBlockNode,\n} from '../../../../../nodeTypes.js'\nexport type JSXConverter<T extends { [key: string]: any; type?: string } = SerializedLexicalNode> =\n (args: {\n childIndex: number\n converters: JSXConverters\n node: T\n nodesToJSX: (args: {\n converters?: JSXConverters\n disableIndent?: boolean | string[]\n disableTextAlign?: boolean | string[]\n nodes: SerializedLexicalNode[]\n parent?: SerializedLexicalNodeWithParent\n }) => React.ReactNode[]\n parent: SerializedLexicalNodeWithParent\n }) => React.ReactNode\nexport type JSXConverters<T extends { [key: string]: any; type?: string } = DefaultNodeTypes> = {\n [key: string]:\n | {\n [blockSlug: string]: JSXConverter<any> // Not true, but need to appease TypeScript\n }\n | JSXConverter<any>\n | undefined\n} & {\n [nodeType in NonNullable<T['type']>]?: JSXConverter<Extract<T, { type: nodeType }>>\n} & {\n blocks?: {\n [blockSlug: string]: JSXConverter<{ fields: Record<string, any> } & SerializedBlockNode>\n }\n inlineBlocks?: {\n [blockSlug: string]: JSXConverter<{ fields: Record<string, any> } & SerializedInlineBlockNode>\n }\n}\n\nexport type SerializedLexicalNodeWithParent = {\n parent?: SerializedLexicalNode\n} & SerializedLexicalNode\n"],"mappings":"AAuCA","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../../../../src/exports/react/components/RichText/converter/types.ts"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\n\nimport type {\n DefaultNodeTypes,\n SerializedBlockNode,\n SerializedInlineBlockNode,\n} from '../../../../../nodeTypes.js'\nexport type JSXConverter<T extends { [key: string]: any; type?: string } = SerializedLexicalNode> =\n (args: {\n childIndex: number\n converters: JSXConverters\n node: T\n nodesToJSX: (args: {\n converters?: JSXConverters\n disableIndent?: boolean | string[]\n disableTextAlign?: boolean | string[]\n nodes: SerializedLexicalNode[]\n parent?: SerializedLexicalNodeWithParent\n }) => React.ReactNode[]\n parent: SerializedLexicalNodeWithParent\n }) => React.ReactNode\n\nexport type JSXConverters<\n T extends { [key: string]: any; type?: string } =\n | DefaultNodeTypes\n | SerializedBlockNode<{ blockName?: null | string; blockType: string }> // need these to ensure types for blocks and inlineBlocks work if no generics are provided\n | SerializedInlineBlockNode<{ blockName?: null | string; blockType: string }>, // need these to ensure types for blocks and inlineBlocks work if no generics are provided\n> = {\n [key: string]:\n | {\n [blockSlug: string]: JSXConverter<any>\n }\n | JSXConverter<any>\n | undefined\n} & {\n [nodeType in Exclude<NonNullable<T['type']>, 'block' | 'inlineBlock'>]?: JSXConverter<\n Extract<T, { type: nodeType }>\n >\n} & {\n blocks?: {\n [K in Extract<\n Extract<T, { type: 'block' }> extends SerializedBlockNode<infer B>\n ? B extends { blockType: string }\n ? B['blockType']\n : never\n : never,\n string\n >]?: JSXConverter<\n Extract<T, { type: 'block' }> extends SerializedBlockNode<infer B>\n ? SerializedBlockNode<Extract<B, { blockType: K }>>\n : SerializedBlockNode\n >\n }\n inlineBlocks?: {\n [K in Extract<\n Extract<T, { type: 'inlineBlock' }> extends SerializedInlineBlockNode<infer B>\n ? B extends { blockType: string }\n ? B['blockType']\n : never\n : never,\n string\n >]?: JSXConverter<\n Extract<T, { type: 'inlineBlock' }> extends SerializedInlineBlockNode<infer B>\n ? SerializedInlineBlockNode<Extract<B, { blockType: K }>>\n : SerializedInlineBlockNode\n >\n }\n}\nexport type SerializedLexicalNodeWithParent = {\n parent?: SerializedLexicalNode\n} & SerializedLexicalNode\n"],"mappings":"AAoEA","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ .payload-richtext .nestedListItem,
2
+ .payload-richtext .list-check {
3
+ list-style-type: none;
4
+ }
@@ -1,9 +1,20 @@
1
1
  import type { SerializedEditorState } from 'lexical';
2
2
  import React from 'react';
3
+ import type { DefaultNodeTypes, SerializedBlockNode, SerializedInlineBlockNode } from '../../../../nodeTypes.js';
3
4
  import type { JSXConverters } from './converter/types.js';
4
- export type JSXConvertersFunction = (args: {
5
- defaultConverters: JSXConverters;
6
- }) => JSXConverters;
5
+ import './index.css';
6
+ export type JSXConvertersFunction<T extends {
7
+ [key: string]: any;
8
+ type?: string;
9
+ } = DefaultNodeTypes | SerializedBlockNode<{
10
+ blockName?: null | string;
11
+ blockType: string;
12
+ }> | SerializedInlineBlockNode<{
13
+ blockName?: null | string;
14
+ blockType: string;
15
+ }>> = (args: {
16
+ defaultConverters: JSXConverters<DefaultNodeTypes>;
17
+ }) => JSXConverters<T>;
7
18
  type Props = {
8
19
  className?: string;
9
20
  converters?: JSXConverters | JSXConvertersFunction;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exports/react/components/RichText/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAEpD,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,aAAa,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,iBAAiB,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAA;CAAE,KAAK,aAAa,CAAC,CAAC,CAAC,CAAA;AAEtF,KAAK,KAAK,GAAG;IACX,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,aAAa,GAAG,qBAAqB,CAAA;IAClD,IAAI,EAAE,qBAAqB,CAAA;IAC3B,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAA;IAClC,gBAAgB,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAA;CACtC,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAoCpC,CAAA"}
@@ -2,6 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import React from 'react';
3
3
  import { defaultJSXConverters } from './converter/defaultConverters.js';
4
4
  import { convertLexicalToJSX } from './converter/index.js';
5
+ import './index.css';
5
6
  export const RichText = ({
6
7
  className,
7
8
  converters,
@@ -25,7 +26,7 @@ export const RichText = ({
25
26
  finalConverters = defaultJSXConverters;
26
27
  }
27
28
  return /*#__PURE__*/_jsx("div", {
28
- className: className,
29
+ className: className ?? 'payload-richtext',
29
30
  children: editorState && !Array.isArray(editorState) && typeof editorState === 'object' && 'root' in editorState && convertLexicalToJSX({
30
31
  converters: finalConverters,
31
32
  data: editorState,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","defaultJSXConverters","convertLexicalToJSX","RichText","className","converters","data","editorState","disableIndent","disableTextAlign","finalConverters","defaultConverters","_jsx","Array","isArray"],"sources":["../../../../../src/exports/react/components/RichText/index.tsx"],"sourcesContent":["import type { SerializedEditorState } from 'lexical'\n\nimport React from 'react'\n\nimport type { JSXConverters } from './converter/types.js'\n\nimport { defaultJSXConverters } from './converter/defaultConverters.js'\nimport { convertLexicalToJSX } from './converter/index.js'\n\nexport type JSXConvertersFunction = (args: { defaultConverters: JSXConverters }) => JSXConverters\n\ntype Props = {\n className?: string\n converters?: JSXConverters | JSXConvertersFunction\n data: SerializedEditorState\n disableIndent?: boolean | string[]\n disableTextAlign?: boolean | string[]\n}\n\nexport const RichText: React.FC<Props> = ({\n className,\n converters,\n data: editorState,\n disableIndent,\n disableTextAlign,\n}) => {\n if (!editorState) {\n return null\n }\n\n let finalConverters: JSXConverters = {}\n if (converters) {\n if (typeof converters === 'function') {\n finalConverters = converters({ defaultConverters: defaultJSXConverters })\n } else {\n finalConverters = converters\n }\n } else {\n finalConverters = defaultJSXConverters\n }\n\n return (\n <div className={className}>\n {editorState &&\n !Array.isArray(editorState) &&\n typeof editorState === 'object' &&\n 'root' in editorState &&\n convertLexicalToJSX({\n converters: finalConverters,\n data: editorState,\n disableIndent,\n disableTextAlign,\n })}\n </div>\n )\n}\n"],"mappings":";AAEA,OAAOA,KAAA,MAAW;AAIlB,SAASC,oBAAoB,QAAQ;AACrC,SAASC,mBAAmB,QAAQ;AAYpC,OAAO,MAAMC,QAAA,GAA4BA,CAAC;EACxCC,SAAS;EACTC,UAAU;EACVC,IAAA,EAAMC,WAAW;EACjBC,aAAa;EACbC;AAAgB,CACjB;EACC,IAAI,CAACF,WAAA,EAAa;IAChB,OAAO;EACT;EAEA,IAAIG,eAAA,GAAiC,CAAC;EACtC,IAAIL,UAAA,EAAY;IACd,IAAI,OAAOA,UAAA,KAAe,YAAY;MACpCK,eAAA,GAAkBL,UAAA,CAAW;QAAEM,iBAAA,EAAmBV;MAAqB;IACzE,OAAO;MACLS,eAAA,GAAkBL,UAAA;IACpB;EACF,OAAO;IACLK,eAAA,GAAkBT,oBAAA;EACpB;EAEA,oBACEW,IAAA,CAAC;IAAIR,SAAA,EAAWA,SAAA;cACbG,WAAA,IACC,CAACM,KAAA,CAAMC,OAAO,CAACP,WAAA,KACf,OAAOA,WAAA,KAAgB,YACvB,UAAUA,WAAA,IACVL,mBAAA,CAAoB;MAClBG,UAAA,EAAYK,eAAA;MACZJ,IAAA,EAAMC,WAAA;MACNC,aAAA;MACAC;IACF;;AAGR","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["React","defaultJSXConverters","convertLexicalToJSX","RichText","className","converters","data","editorState","disableIndent","disableTextAlign","finalConverters","defaultConverters","_jsx","Array","isArray"],"sources":["../../../../../src/exports/react/components/RichText/index.tsx"],"sourcesContent":["import type { SerializedEditorState } from 'lexical'\n\nimport React from 'react'\n\nimport type {\n DefaultNodeTypes,\n SerializedBlockNode,\n SerializedInlineBlockNode,\n} from '../../../../nodeTypes.js'\nimport type { JSXConverters } from './converter/types.js'\n\nimport { defaultJSXConverters } from './converter/defaultConverters.js'\nimport { convertLexicalToJSX } from './converter/index.js'\nimport './index.css'\n\nexport type JSXConvertersFunction<\n T extends { [key: string]: any; type?: string } =\n | DefaultNodeTypes\n | SerializedBlockNode<{ blockName?: null | string; blockType: string }>\n | SerializedInlineBlockNode<{ blockName?: null | string; blockType: string }>,\n> = (args: { defaultConverters: JSXConverters<DefaultNodeTypes> }) => JSXConverters<T>\n\ntype Props = {\n className?: string\n converters?: JSXConverters | JSXConvertersFunction\n data: SerializedEditorState\n disableIndent?: boolean | string[]\n disableTextAlign?: boolean | string[]\n}\n\nexport const RichText: React.FC<Props> = ({\n className,\n converters,\n data: editorState,\n disableIndent,\n disableTextAlign,\n}) => {\n if (!editorState) {\n return null\n }\n\n let finalConverters: JSXConverters = {}\n if (converters) {\n if (typeof converters === 'function') {\n finalConverters = converters({ defaultConverters: defaultJSXConverters })\n } else {\n finalConverters = converters\n }\n } else {\n finalConverters = defaultJSXConverters\n }\n\n return (\n <div className={className ?? 'payload-richtext'}>\n {editorState &&\n !Array.isArray(editorState) &&\n typeof editorState === 'object' &&\n 'root' in editorState &&\n convertLexicalToJSX({\n converters: finalConverters,\n data: editorState,\n disableIndent,\n disableTextAlign,\n })}\n </div>\n )\n}\n"],"mappings":";AAEA,OAAOA,KAAA,MAAW;AASlB,SAASC,oBAAoB,QAAQ;AACrC,SAASC,mBAAmB,QAAQ;AACpC,OAAO;AAiBP,OAAO,MAAMC,QAAA,GAA4BA,CAAC;EACxCC,SAAS;EACTC,UAAU;EACVC,IAAA,EAAMC,WAAW;EACjBC,aAAa;EACbC;AAAgB,CACjB;EACC,IAAI,CAACF,WAAA,EAAa;IAChB,OAAO;EACT;EAEA,IAAIG,eAAA,GAAiC,CAAC;EACtC,IAAIL,UAAA,EAAY;IACd,IAAI,OAAOA,UAAA,KAAe,YAAY;MACpCK,eAAA,GAAkBL,UAAA,CAAW;QAAEM,iBAAA,EAAmBV;MAAqB;IACzE,OAAO;MACLS,eAAA,GAAkBL,UAAA;IACpB;EACF,OAAO;IACLK,eAAA,GAAkBT,oBAAA;EACpB;EAEA,oBACEW,IAAA,CAAC;IAAIR,SAAA,EAAWA,SAAA,IAAa;cAC1BG,WAAA,IACC,CAACM,KAAA,CAAMC,OAAO,CAACP,WAAA,KACf,OAAOA,WAAA,KAAgB,YACvB,UAAUA,WAAA,IACVL,mBAAA,CAAoB;MAClBG,UAAA,EAAYK,eAAA;MACZJ,IAAA,EAAMC,WAAA;MACNC,aAAA;MACAC;IACF;;AAGR","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { FormState } from 'payload';
3
3
  import './index.scss';
4
- import type { InlineBlockFields } from '../nodes/InlineBlocksNode.js';
4
+ import type { InlineBlockFields } from '../../server/nodes/InlineBlocksNode.js';
5
5
  type Props = {
6
6
  readonly formData: InlineBlockFields;
7
7
  readonly nodeKey: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/blocks/client/componentInline/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAiE,MAAM,OAAO,CAAA;AAGrF,OAAO,KAAK,EAAqB,SAAS,EAAE,MAAM,SAAS,CAAA;AAgC3D,OAAO,cAAc,CAAA;AAIrB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAMrE,KAAK,KAAK,GAAG;IACX,QAAQ,CAAC,QA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AK,CAAC,EAAE,KAAK,CAAC,EAAE,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,YAAY,CAAC,EAAE,KAAK,CAAC,EAAE,CAAA;CACxB,CAAA;AAMD,eAAO,MAAM,8BAA8B,uCAAsD,CAAA;AAEjG,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAqWhD,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","createContext","useCallback","useEffect","useMemo","useRef","baseClass","useLexicalComposerContext","useLexicalNodeSelection","mergeRegister","getTranslation","Button","Drawer","EditDepthProvider","Form","formatDrawerSlug","FormSubmit","RenderFields","ShimmerEffect","useDocumentInfo","useEditDepth","useServerFunctions","useTranslation","abortAndIgnore","$getNodeByKey","$getSelection","$isNodeSelection","CLICK_COMMAND","COMMAND_PRIORITY_LOW","KEY_BACKSPACE_COMMAND","KEY_DELETE_COMMAND","reduceFieldsToValues","v4","uuid","useEditorConfigContext","useLexicalDrawer","$isInlineBlockNode","InlineBlockComponentContext","initialState","useInlineBlockComponentContext","useContext","InlineBlockComponent","props","formData","nodeKey","editor","i18n","t","fieldProps","featureClientSchemaMap","initialLexicalFormState","permissions","readOnly","schemaPath","uuidFromContext","getFormState","editDepth","setInitialState","useState","id","formState","CustomLabel","setCustomLabel","customComponents","BlockLabel","CustomBlock","setCustomBlock","Block","drawerSlug","slug","depth","toggleDrawer","inlineBlockElemElemRef","isSelected","setSelected","clearSelection","collectionSlug","getDocPreferences","globalSlug","componentMapRenderedBlockPath","blockType","clientSchemaMap","blocksField","clientBlock","blocks","removeInlineBlock","update","remove","$onDelete","event","deleteSelection","preventDefault","getNodes","forEach","node","onClick","payload","target","current","contains","shiftKey","registerCommand","blockDisplayName","labels","singular","onChangeAbortControllerRef","AbortController","schemaFieldsPath","abortController","awaitInitialState","state","data","docPermissions","fields","docPreferences","operation","renderAllFields","signal","onChange","prevFormState","submit","controller","onFormSubmit","newData","setFields","RemoveButton","_jsx","buttonStyle","className","disabled","icon","e","round","size","tooltip","label","EditButton","el","InlineBlockContainer","children","filter","Boolean","join","ref","Label","_jsxs","beforeSubmit","disableValidationOnSubmit","onSubmit","title","_Fragment","forceRender","parentIndexPath","parentPath","parentSchemaPath","Provider","value","height","width","isEditable"],"sources":["../../../../../src/features/blocks/client/componentInline/index.tsx"],"sourcesContent":["'use client'\n\nimport React, { createContext, useCallback, useEffect, useMemo, useRef } from 'react'\nconst baseClass = 'inline-block'\n\nimport type { BlocksFieldClient, FormState } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useLexicalNodeSelection } from '@lexical/react/useLexicalNodeSelection'\nimport { mergeRegister } from '@lexical/utils'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n Drawer,\n EditDepthProvider,\n Form,\n formatDrawerSlug,\n FormSubmit,\n RenderFields,\n ShimmerEffect,\n useDocumentInfo,\n useEditDepth,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport {\n $getNodeByKey,\n $getSelection,\n $isNodeSelection,\n CLICK_COMMAND,\n COMMAND_PRIORITY_LOW,\n KEY_BACKSPACE_COMMAND,\n KEY_DELETE_COMMAND,\n} from 'lexical'\nimport { reduceFieldsToValues } from 'payload/shared'\n\nimport './index.scss'\n\nimport { v4 as uuid } from 'uuid'\n\nimport type { InlineBlockFields } from '../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 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.useContext(InlineBlockComponentContext)\n\nexport const InlineBlockComponent: React.FC<Props> = (props) => {\n const { formData, nodeKey } = props\n const [editor] = useLexicalComposerContext()\n const { i18n, t } = useTranslation<object, string>()\n const {\n fieldProps: {\n featureClientSchemaMap,\n initialLexicalFormState,\n permissions,\n readOnly,\n schemaPath,\n },\n uuid: uuidFromContext,\n } = useEditorConfigContext()\n const { getFormState } = useServerFunctions()\n const editDepth = useEditDepth()\n\n const [initialState, setInitialState] = React.useState<false | FormState | undefined>(\n initialLexicalFormState?.[formData.id]?.formState,\n )\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,\n depth: editDepth,\n })\n const { toggleDrawer } = useLexicalDrawer(drawerSlug, true)\n\n const inlineBlockElemElemRef = useRef<HTMLDivElement | null>(null)\n const [isSelected, setSelected, clearSelection] = useLexicalNodeSelection(nodeKey)\n const { id, collectionSlug, getDocPreferences, globalSlug } = useDocumentInfo()\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 = blocksField.blocks[0]\n\n const removeInlineBlock = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey)?.remove()\n })\n }, [editor, nodeKey])\n\n const $onDelete = useCallback(\n (event: KeyboardEvent) => {\n const deleteSelection = $getSelection()\n if (isSelected && $isNodeSelection(deleteSelection)) {\n event.preventDefault()\n editor.update(() => {\n deleteSelection.getNodes().forEach((node) => {\n if ($isInlineBlockNode(node)) {\n node.remove()\n }\n })\n })\n }\n return false\n },\n [editor, isSelected],\n )\n const onClick = useCallback(\n (payload: MouseEvent) => {\n const event = payload\n // Check if inlineBlockElemElemRef.target or anything WITHIN inlineBlockElemElemRef.target was clicked\n if (\n event.target === inlineBlockElemElemRef.current ||\n inlineBlockElemElemRef.current?.contains(event.target as Node)\n ) {\n if (event.shiftKey) {\n setSelected(!isSelected)\n } else {\n if (!isSelected) {\n clearSelection()\n setSelected(true)\n }\n }\n return true\n }\n\n return false\n },\n [isSelected, setSelected, clearSelection],\n )\n\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand<MouseEvent>(CLICK_COMMAND, onClick, COMMAND_PRIORITY_LOW),\n\n editor.registerCommand(KEY_DELETE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW),\n editor.registerCommand(KEY_BACKSPACE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW),\n )\n }, [clearSelection, editor, isSelected, nodeKey, $onDelete, setSelected, onClick])\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 globalSlug,\n operation: 'update',\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: abortController.signal,\n })\n\n if (state) {\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 schemaFieldsPath,\n id,\n formData,\n initialState,\n collectionSlug,\n globalSlug,\n getDocPreferences,\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 formState: prevFormState,\n globalSlug,\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 [getFormState, id, collectionSlug, getDocPreferences, globalSlug, schemaFieldsPath],\n )\n // cleanup effect\n useEffect(() => {\n return () => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [])\n\n /**\n * HANDLE FORM SUBMIT\n */\n const onFormSubmit = useCallback(\n (formState: FormState) => {\n const newData: any = reduceFieldsToValues(formState)\n newData.blockType = formData.blockType\n editor.update(() => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n node.setFields(newData)\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 }: { children: React.ReactNode }) => (\n <div\n className={[\n baseClass,\n baseClass + '-' + formData.blockType,\n isSelected && `${baseClass}--selected`,\n ]\n .filter(Boolean)\n .join(' ')}\n ref={inlineBlockElemElemRef}\n >\n {children}\n </div>\n ),\n [formData.blockType, isSelected],\n )\n\n const Label = useMemo(() => {\n if (CustomLabel) {\n return () => CustomLabel\n } else {\n return () => <div>{getTranslation(clientBlock.labels!.singular, i18n)}</div>\n }\n }, [CustomLabel, clientBlock.labels, i18n])\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 fields={clientBlock.fields}\n initialState={initialState || {}}\n onChange={[onChange]}\n onSubmit={(formState) => {\n onFormSubmit(formState)\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={permissions}\n readOnly={false}\n />\n <FormSubmit>{t('fields:saveChanges')}</FormSubmit>\n </>\n ) : null}\n </Drawer>\n </EditDepthProvider>\n {CustomBlock ? (\n <InlineBlockComponentContext.Provider\n value={{\n EditButton,\n initialState,\n InlineBlockContainer,\n Label,\n nodeKey,\n RemoveButton,\n }}\n >\n {CustomBlock}\n </InlineBlockComponentContext.Provider>\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"],"mappings":"AAAA;;;AAEA,OAAOA,KAAA,IAASC,aAAa,EAAEC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ;AAC9E,MAAMC,SAAA,GAAY;AAIlB,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,uBAAuB,QAAQ;AACxC,SAASC,aAAa,QAAQ;AAC9B,SAASC,cAAc,QAAQ;AAC/B,SACEC,MAAM,EACNC,MAAM,EACNC,iBAAiB,EACjBC,IAAI,EACJC,gBAAgB,EAChBC,UAAU,EACVC,YAAY,EACZC,aAAa,EACbC,eAAe,EACfC,YAAY,EACZC,kBAAkB,EAClBC,cAAc,QACT;AACP,SAASC,cAAc,QAAQ;AAC/B,SACEC,aAAa,EACbC,aAAa,EACbC,gBAAgB,EAChBC,aAAa,EACbC,oBAAoB,EACpBC,qBAAqB,EACrBC,kBAAkB,QACb;AACP,SAASC,oBAAoB,QAAQ;AAIrC,SAASC,EAAA,IAAMC,IAAI,QAAQ;AAI3B,SAASC,sBAAsB,QAAQ;AACvC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,kBAAkB,QAAQ;AAgBnC,MAAMC,2BAAA,gBAA8BpC,aAAA,CAA+C;EACjFqC,YAAA,EAAc;AAChB;A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AKd","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["React","createContext","useCallback","useEffect","useMemo","useRef","baseClass","useLexicalComposerContext","useLexicalNodeSelection","mergeRegister","getTranslation","Button","Drawer","EditDepthProvider","Form","formatDrawerSlug","FormSubmit","RenderFields","ShimmerEffect","useDocumentInfo","useEditDepth","useServerFunctions","useTranslation","abortAndIgnore","$getNodeByKey","$getSelection","$isNodeSelection","CLICK_COMMAND","COMMAND_PRIORITY_LOW","KEY_BACKSPACE_COMMAND","KEY_DELETE_COMMAND","reduceFieldsToValues","v4","uuid","useEditorConfigContext","useLexicalDrawer","$isInlineBlockNode","InlineBlockComponentContext","initialState","useInlineBlockComponentContext","useContext","InlineBlockComponent","props","formData","nodeKey","editor","i18n","t","fieldProps","featureClientSchemaMap","initialLexicalFormState","permissions","readOnly","schemaPath","uuidFromContext","getFormState","editDepth","setInitialState","useState","id","formState","CustomLabel","setCustomLabel","customComponents","BlockLabel","CustomBlock","setCustomBlock","Block","drawerSlug","slug","depth","toggleDrawer","inlineBlockElemElemRef","isSelected","setSelected","clearSelection","collectionSlug","getDocPreferences","globalSlug","componentMapRenderedBlockPath","blockType","clientSchemaMap","blocksField","clientBlock","blocks","removeInlineBlock","update","remove","$onDelete","event","deleteSelection","preventDefault","getNodes","forEach","node","onClick","payload","target","current","contains","shiftKey","registerCommand","blockDisplayName","labels","singular","onChangeAbortControllerRef","AbortController","schemaFieldsPath","abortController","awaitInitialState","state","data","docPermissions","fields","docPreferences","operation","renderAllFields","signal","onChange","prevFormState","submit","controller","onFormSubmit","newData","setFields","RemoveButton","_jsx","buttonStyle","className","disabled","icon","e","round","size","tooltip","label","EditButton","el","InlineBlockContainer","children","filter","Boolean","join","ref","Label","_jsxs","beforeSubmit","disableValidationOnSubmit","onSubmit","title","_Fragment","forceRender","parentIndexPath","parentPath","parentSchemaPath","Provider","value","height","width","isEditable"],"sources":["../../../../../src/features/blocks/client/componentInline/index.tsx"],"sourcesContent":["'use client'\n\nimport React, { createContext, useCallback, useEffect, useMemo, useRef } from 'react'\nconst baseClass = 'inline-block'\n\nimport type { BlocksFieldClient, FormState } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useLexicalNodeSelection } from '@lexical/react/useLexicalNodeSelection'\nimport { mergeRegister } from '@lexical/utils'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n Drawer,\n EditDepthProvider,\n Form,\n formatDrawerSlug,\n FormSubmit,\n RenderFields,\n ShimmerEffect,\n useDocumentInfo,\n useEditDepth,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport {\n $getNodeByKey,\n $getSelection,\n $isNodeSelection,\n CLICK_COMMAND,\n COMMAND_PRIORITY_LOW,\n KEY_BACKSPACE_COMMAND,\n KEY_DELETE_COMMAND,\n} from 'lexical'\nimport { reduceFieldsToValues } from 'payload/shared'\n\nimport './index.scss'\n\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 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.useContext(InlineBlockComponentContext)\n\nexport const InlineBlockComponent: React.FC<Props> = (props) => {\n const { formData, nodeKey } = props\n const [editor] = useLexicalComposerContext()\n const { i18n, t } = useTranslation<object, string>()\n const {\n fieldProps: {\n featureClientSchemaMap,\n initialLexicalFormState,\n permissions,\n readOnly,\n schemaPath,\n },\n uuid: uuidFromContext,\n } = useEditorConfigContext()\n const { getFormState } = useServerFunctions()\n const editDepth = useEditDepth()\n\n const [initialState, setInitialState] = React.useState<false | FormState | undefined>(\n initialLexicalFormState?.[formData.id]?.formState,\n )\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,\n depth: editDepth,\n })\n const { toggleDrawer } = useLexicalDrawer(drawerSlug, true)\n\n const inlineBlockElemElemRef = useRef<HTMLDivElement | null>(null)\n const [isSelected, setSelected, clearSelection] = useLexicalNodeSelection(nodeKey)\n const { id, collectionSlug, getDocPreferences, globalSlug } = useDocumentInfo()\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 = blocksField.blocks[0]\n\n const removeInlineBlock = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey)?.remove()\n })\n }, [editor, nodeKey])\n\n const $onDelete = useCallback(\n (event: KeyboardEvent) => {\n const deleteSelection = $getSelection()\n if (isSelected && $isNodeSelection(deleteSelection)) {\n event.preventDefault()\n editor.update(() => {\n deleteSelection.getNodes().forEach((node) => {\n if ($isInlineBlockNode(node)) {\n node.remove()\n }\n })\n })\n }\n return false\n },\n [editor, isSelected],\n )\n const onClick = useCallback(\n (payload: MouseEvent) => {\n const event = payload\n // Check if inlineBlockElemElemRef.target or anything WITHIN inlineBlockElemElemRef.target was clicked\n if (\n event.target === inlineBlockElemElemRef.current ||\n inlineBlockElemElemRef.current?.contains(event.target as Node)\n ) {\n if (event.shiftKey) {\n setSelected(!isSelected)\n } else {\n if (!isSelected) {\n clearSelection()\n setSelected(true)\n }\n }\n return true\n }\n\n return false\n },\n [isSelected, setSelected, clearSelection],\n )\n\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand<MouseEvent>(CLICK_COMMAND, onClick, COMMAND_PRIORITY_LOW),\n\n editor.registerCommand(KEY_DELETE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW),\n editor.registerCommand(KEY_BACKSPACE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW),\n )\n }, [clearSelection, editor, isSelected, nodeKey, $onDelete, setSelected, onClick])\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 globalSlug,\n operation: 'update',\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: abortController.signal,\n })\n\n if (state) {\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 schemaFieldsPath,\n id,\n formData,\n initialState,\n collectionSlug,\n globalSlug,\n getDocPreferences,\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 formState: prevFormState,\n globalSlug,\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 [getFormState, id, collectionSlug, getDocPreferences, globalSlug, schemaFieldsPath],\n )\n // cleanup effect\n useEffect(() => {\n return () => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [])\n\n /**\n * HANDLE FORM SUBMIT\n */\n const onFormSubmit = useCallback(\n (formState: FormState) => {\n const newData: any = reduceFieldsToValues(formState)\n newData.blockType = formData.blockType\n editor.update(() => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n node.setFields(newData)\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 }: { children: React.ReactNode }) => (\n <div\n className={[\n baseClass,\n baseClass + '-' + formData.blockType,\n isSelected && `${baseClass}--selected`,\n ]\n .filter(Boolean)\n .join(' ')}\n ref={inlineBlockElemElemRef}\n >\n {children}\n </div>\n ),\n [formData.blockType, isSelected],\n )\n\n const Label = useMemo(() => {\n if (CustomLabel) {\n return () => CustomLabel\n } else {\n return () => <div>{getTranslation(clientBlock.labels!.singular, i18n)}</div>\n }\n }, [CustomLabel, clientBlock.labels, i18n])\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 fields={clientBlock.fields}\n initialState={initialState || {}}\n onChange={[onChange]}\n onSubmit={(formState) => {\n onFormSubmit(formState)\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={permissions}\n readOnly={false}\n />\n <FormSubmit>{t('fields:saveChanges')}</FormSubmit>\n </>\n ) : null}\n </Drawer>\n </EditDepthProvider>\n {CustomBlock ? (\n <InlineBlockComponentContext.Provider\n value={{\n EditButton,\n initialState,\n InlineBlockContainer,\n Label,\n nodeKey,\n RemoveButton,\n }}\n >\n {CustomBlock}\n </InlineBlockComponentContext.Provider>\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"],"mappings":"AAAA;;;AAEA,OAAOA,KAAA,IAASC,aAAa,EAAEC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ;AAC9E,MAAMC,SAAA,GAAY;AAIlB,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,uBAAuB,QAAQ;AACxC,SAASC,aAAa,QAAQ;AAC9B,SAASC,cAAc,QAAQ;AAC/B,SACEC,MAAM,EACNC,MAAM,EACNC,iBAAiB,EACjBC,IAAI,EACJC,gBAAgB,EAChBC,UAAU,EACVC,YAAY,EACZC,aAAa,EACbC,eAAe,EACfC,YAAY,EACZC,kBAAkB,EAClBC,cAAc,QACT;AACP,SAASC,cAAc,QAAQ;AAC/B,SACEC,aAAa,EACbC,aAAa,EACbC,gBAAgB,EAChBC,aAAa,EACbC,oBAAoB,EACpBC,qBAAqB,EACrBC,kBAAkB,QACb;AACP,SAASC,oBAAoB,QAAQ;AAIrC,SAASC,EAAA,IAAMC,IAAI,QAAQ;AAI3B,SAASC,sBAAsB,QAAQ;AACvC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,kBAAkB,QAAQ;AAgBnC,MAAMC,2BAAA,gBAA8BpC,aAAA,CAA+C;EACjFqC,YAAA,EAAc;AAChB;AAEA,OAAO,MAAMC,8BAAA,GAAiCA,CAAA;EAAA,OAAMvC,KAAA,CAAAwC,UAAA,CAAAH,2BAAiB;AAAA;AAErE,OAAO,MAAMI,oBAAA,GAAyCC,KAAA;EACpD,MAAM;IAAEC,QAAQ;IAAEC;EAAO,CAAE,GAAGF,KAAA;EAC9B,MAAM,CAACG,MAAA,CAAO,GAAGtC,yBAAA;EACjB,M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H,MAAA;QACCoH,SAAA,EAAW;QACX3D,IAAA,EAAMD,UAAA;QACNiF,KAAA,EAAOtG,CAAA,CAAE,+BAA+BJ,QAAA,EAAUgB,EAAA,GAAK,SAAS,UAAU,EAAE;UAC1E4E,KAAA,EAAOjC,gBAAA,IAAoBvD,CAAA,CAAE;QAC/B;kBAECT,YAAA,gBACC2G,KAAA,CAAAK,SAAA;kCACExB,IAAA,CAAC7G,YAAA;YACCgG,MAAA,EAAQ9B,WAAA,CAAY8B,MAAM;YAC1BsC,WAAW;YACXC,eAAA,EAAgB;YAChBC,UAAA,EAAW,GAAG;YAAA;;YACdC,gBAAA,EAAkB/C,gBAAA;YAClBxD,WAAA,EAAaA,WAAA;YACbC,QAAA,EAAU;2BAEZ0E,IAAA,CAAC9G,UAAA;sBAAY+B,CAAA,CAAE;;aAEf;;QAGPkB,WAAA,gBACC6D,IAAA,CAACzF,2BAAA,CAA4BsH,QAAQ;MACnCC,KAAA,EAAO;QACLpB,UAAA;QACAlG,YAAA;QACAoG,oBAAA;QACAM,KAAA;QACApG,OAAA;QACAiF;MACF;gBAEC5D;sBAGHgF,KAAA,CAACP,oBAAA;iBACEpG,YAAA,gBAAewF,IAAA,CAACkB,KAAA,qBAAWlB,IAAA,CAAC5G,aAAA;QAAc2I,MAAA,EAAO;QAAOC,KAAA,EAAM;UAC9DjH,MAAA,CAAOkH,UAAU,kBAChBd,KAAA,CAAC;QAAIjB,SAAA,EAAW,GAAG1H,SAAA,WAAoB;gCACrCwH,IAAA,CAACU,UAAA,O,aACDV,IAAA,CAACD,YAAA;WAED;;;AAKd","ignoreList":[]}
@@ -1,24 +1,13 @@
1
- import type { EditorConfig, LexicalEditor, LexicalNode, SerializedLexicalNode, Spread } from 'lexical';
1
+ import type { EditorConfig, LexicalEditor, LexicalNode } from 'lexical';
2
2
  import { type JSX } from 'react';
3
- import type { SerializedServerInlineBlockNode } from '../../server/nodes/InlineBlocksNode.js';
3
+ import type { InlineBlockFields, SerializedInlineBlockNode } from '../../server/nodes/InlineBlocksNode.js';
4
4
  import { ServerInlineBlockNode } from '../../server/nodes/InlineBlocksNode.js';
5
- export type InlineBlockFields = {
6
- /** Block form data */
7
- [key: string]: any;
8
- blockType: string;
9
- id: string;
10
- };
11
- export type SerializedInlineBlockNode = Spread<{
12
- children?: never;
13
- fields: InlineBlockFields;
14
- type: 'inlineBlock';
15
- }, SerializedLexicalNode>;
16
5
  export declare class InlineBlockNode extends ServerInlineBlockNode {
17
6
  static clone(node: ServerInlineBlockNode): ServerInlineBlockNode;
18
7
  static getType(): string;
19
8
  static importJSON(serializedNode: SerializedInlineBlockNode): InlineBlockNode;
20
9
  decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element;
21
- exportJSON(): SerializedServerInlineBlockNode;
10
+ exportJSON(): SerializedInlineBlockNode;
22
11
  }
23
12
  export declare function $createInlineBlockNode(fields: Exclude<InlineBlockFields, 'id'>): InlineBlockNode;
24
13
  export declare function $isInlineBlockNode(node: InlineBlockNode | LexicalNode | null | undefined): node is InlineBlockNode;
@@ -1 +1 @@
1
- {"version":3,"file":"InlineBlocksNode.d.ts","sourceRoot":"","sources":["../../../../../src/features/blocks/client/nodes/InlineBlocksNode.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EACb,WAAW,EACX,qBAAqB,EACrB,MAAM,EACP,MAAM,SAAS,CAAA;AAGhB,OAAc,EAAE,KAAK,GAAG,EAAE,MAAM,OAAO,CAAA;AAEvC,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,wCAAwC,CAAA;AAE7F,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAA;AAE9E,MAAM,MAAM,iBAAiB,GAAG;IAC9B,sBAAsB;IACtB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;IAElB,SAAS,EAAE,MAAM,CAAA;IACjB,EAAE,EAAE,MAAM,CAAA;CACX,CAAA;AAQD,MAAM,MAAM,yBAAyB,GAAG,M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yB,GAAG,eAAe;IAK7E,QAAQ,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,GAAG,GAAG,CAAC,OAAO;IAIlE,UAAU,IAAI,yBAAyB;CAGxC;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,OAAO,CAAC,iBAAiB,EAAE,IAAI,CAAC,GAAG,eAAe,CAOhG;AAED,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,eAAe,GAAG,WAAW,GAAG,IAAI,GAAG,SAAS,GACrD,IAAI,IAAI,eAAe,CAEzB"}
@@ -1 +1 @@
1
- {"version":3,"file":"InlineBlocksNode.js","names":["ObjectID","React","ServerInlineBlockNode","InlineBlockComponent","lazy","then","module","default","InlineBlockNode","clone","node","getType","importJSON","serializedNode","$createInlineBlockNode","fields","decorate","editor","config","_jsx","formData","getFields","nodeKey","getKey","exportJSON","id","toHexString","$isInlineBlockNode"],"sources":["../../../../../src/features/blocks/client/nodes/InlineBlocksNode.tsx"],"sourcesContent":["'use client'\nimport type {\n EditorConfig,\n LexicalEditor,\n LexicalNode,\n SerializedLexicalNode,\n Spread,\n} from 'lexical'\n\nimport ObjectID from 'bson-objectid'\nimport React, { type JSX } from 'react'\n\nimport type { SerializedServerInlineBlockNode } from '../../server/nodes/InlineBlocksNode.js'\n\nimport { ServerInlineBlockNode } from '../../server/nodes/InlineBlocksNode.js'\n\nexport type InlineBlockFields = {\n /** Block form data */\n [key: string]: any\n //blockName: string\n blockType: string\n id: string\n}\n\nconst InlineBlockComponent = React.lazy(() =>\n import('../componentInline/index.js').then((module) => ({\n default: module.InlineBlockComponent,\n })),\n)\n\nexport type SerializedInlineBlockNode = Spread<\n {\n children?: never // required so that our typed editor state doesn't automatically add children\n fields: InlineBlockFields\n type: 'inlineBlock'\n },\n SerializedLexicalNode\n>\n\nexport class InlineBlockNode extends ServerInlineBlockNode {\n static clone(node: ServerInlineBlockNode): ServerInlineBlockNode {\n return super.clone(node)\n }\n\n static getType(): string {\n return super.getType()\n }\n\n static importJSON(serializedNode: SerializedInlineBlockNode): InlineBlockNode {\n const node = $createInlineBlockNode(serializedNode.fields)\n return node\n }\n\n decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element {\n return <InlineBlockComponent formData={this.getFields()} nodeKey={this.getKey()} />\n }\n\n exportJSON(): SerializedServerInlineBlockNode {\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"],"mappings":"AAAA;;;AASA,OAAOA,QAAA,MAAc;AACrB,OAAOC,KAAA,MAAyB;AAIhC,SAASC,qBAAqB,QAAQ;AAUtC,MAAMC,oBAAA,gBAAuBF,KAAA,CAAMG,IAAI,CAAC,MACtC,MAAM,CAAC,+BAA+BC,IAAI,CAAEC,MAAA,KAAY;EACtDC,OAAA,EAASD,MAAA,CAAOH;AAClB;AAYF,OAAO,MAAMK,eAAA,SAAwBN,qBAAA;EACnC,OAAOO,MAAMC,IAA2B,EAAyB;IAC/D,OAAO,KAAK,CAACD,KAAA,CAAMC,IAAA;EACrB;EAEA,OAAOC,QAAA,EAAkB;IACvB,OAAO,KAAK,CAACA,OAAA;EACf;EAEA,OAAOC,WAAWC,cAAyC,EAAmB;IAC5E,MAAMH,IAAA,GAAOI,sBAAA,CAAuBD,cAAA,CAAeE,MAAM;IACzD,OAAOL,IAAA;EACT;EAEAM,SAASC,MAAqB,EAAEC,MAAoB,EAAe;IACjE,oBAAOC,IAAA,CAAChB,oBAAA;MAAqBiB,QAAA,EAAU,IAAI,CAACC,SAAS;MAAIC,OAAA,EAAS,IAAI,CAACC,MAAM;;EAC/E;EAEAC,WAAA,EAA8C;IAC5C,OAAO,KAAK,CAACA,UAAA;EACf;AACF;AAEA,OAAO,SAASV,uBAAuBC,MAAwC;EAC7E,OAAO,IAAIP,eAAA,CAAgB;IACzBO,MAAA,EAAQ;MACN,GAAGA,MAAM;MACTU,EAAA,EAAIV,MAAA,EAAQU,EAAA,IAAM,IAAIzB,QAAA,CAASO,OAAO,GAAGmB,WAAW;IACtD;EACF;AACF;AAEA,OAAO,SAASC,mBACdjB,IAAsD;EAEtD,OAAOA,IAAA,YAAgBF,eAAA;AACzB","ignoreList":[]}
1
+ {"version":3,"file":"InlineBlocksNode.js","names":["ObjectID","React","ServerInlineBlockNode","InlineBlockComponent","lazy","then","module","default","InlineBlockNode","clone","node","getType","importJSON","serializedNode","$createInlineBlockNode","fields","decorate","editor","config","_jsx","formData","getFields","nodeKey","getKey","exportJSON","id","toHexString","$isInlineBlockNode"],"sources":["../../../../../src/features/blocks/client/nodes/InlineBlocksNode.tsx"],"sourcesContent":["'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 clone(node: ServerInlineBlockNode): ServerInlineBlockNode {\n return super.clone(node)\n }\n\n static getType(): string {\n return super.getType()\n }\n\n static importJSON(serializedNode: SerializedInlineBlockNode): InlineBlockNode {\n const node = $createInlineBlockNode(serializedNode.fields)\n return node\n }\n\n decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element {\n return <InlineBlockComponent formData={this.getFields()} nodeKey={this.getKey()} />\n }\n\n 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"],"mappings":"AAAA;;;AAGA,OAAOA,QAAA,MAAc;AACrB,OAAOC,KAAA,MAAyB;AAOhC,SAASC,qBAAqB,QAAQ;AAEtC,MAAMC,oBAAA,gBAAuBF,KAAA,CAAMG,IAAI,CAAC,MACtC,MAAM,CAAC,+BAA+BC,IAAI,CAAEC,MAAA,KAAY;EACtDC,OAAA,EAASD,MAAA,CAAOH;AAClB;AAGF,OAAO,MAAMK,eAAA,SAAwBN,qBAAA;EACnC,OAAOO,MAAMC,IAA2B,EAAyB;IAC/D,OAAO,KAAK,CAACD,KAAA,CAAMC,IAAA;EACrB;EAEA,OAAOC,QAAA,EAAkB;IACvB,OAAO,KAAK,CAACA,OAAA;EACf;EAEA,OAAOC,WAAWC,cAAyC,EAAmB;IAC5E,MAAMH,IAAA,GAAOI,sBAAA,CAAuBD,cAAA,CAAeE,MAAM;IACzD,OAAOL,IAAA;EACT;EAEAM,SAASC,MAAqB,EAAEC,MAAoB,EAAe;IACjE,oBAAOC,IAAA,CAAChB,oBAAA;MAAqBiB,QAAA,EAAU,IAAI,CAACC,SAAS;MAAIC,OAAA,EAAS,IAAI,CAACC,MAAM;;EAC/E;EAEAC,WAAA,EAAwC;IACtC,OAAO,KAAK,CAACA,UAAA;EACf;AACF;AAEA,OAAO,SAASV,uBAAuBC,MAAwC;EAC7E,OAAO,IAAIP,eAAA,CAAgB;IACzBO,MAAA,EAAQ;MACN,GAAGA,MAAM;MACTU,EAAA,EAAIV,MAAA,EAAQU,EAAA,IAAM,IAAIzB,QAAA,CAASO,OAAO,GAAGmB,WAAW;IACtD;EACF;AACF;AAEA,OAAO,SAASC,mBACdjB,IAAsD;EAEtD,OAAOA,IAAA,YAAgBF,eAAA;AACzB","ignoreList":[]}
@@ -1,6 +1,6 @@
1
1
  import type { Block } from 'payload';
2
2
  import type { PopulationPromise } from '../../typesServer.js';
3
- import type { SerializedInlineBlockNode } from '../client/nodes/InlineBlocksNode.js';
3
+ import type { SerializedInlineBlockNode } from '../server/nodes/InlineBlocksNode.js';
4
4
  import type { SerializedBlockNode } from './nodes/BlocksNode.js';
5
5
  export declare const blockPopulationPromiseHOC: (blocks: Block[]) => PopulationPromise<SerializedBlockNode | SerializedInlineBlockNode>;
6
6
  //# sourceMappingURL=graphQLPopulationPromise.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"graphQLPopulationPromise.js","names":["recursivelyPopulateFieldsForGraphQL","blockPopulationPromiseHOC","blocks","blockPopulationPromise","context","currentDepth","depth","draft","editorPopulationPromises","fieldPromises","findMany","flattenLocales","node","overrideAccess","populationPromises","req","showHiddenFields","blockFieldData","fields","block","find","slug","blockType","length","data","siblingDoc"],"sources":["../../../../src/features/blocks/server/graphQLPopulationPromise.ts"],"sourcesContent":["import type { Block } from 'payload'\n\nimport type { PopulationPromise } from '../../typesServer.js'\nimport type { SerializedInlineBlockNode } from '../client/nodes/InlineBlocksNode.js'\nimport type { SerializedBlockNode } from './nodes/BlocksNode.js'\n\nimport { recursivelyPopulateFieldsForGraphQL } from '../../../populateGraphQL/recursivelyPopulateFieldsForGraphQL.js'\n\nexport const blockPopulationPromiseHOC = (\n blocks: Block[],\n): PopulationPromise<SerializedBlockNode | SerializedInlineBlockNode> => {\n const blockPopulationPromise: PopulationPromise<\n SerializedBlockNode | SerializedInlineBlockNode\n > = ({\n context,\n currentDepth,\n depth,\n draft,\n editorPopulationPromises,\n fieldPromises,\n findMany,\n flattenLocales,\n node,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n }) => {\n const blockFieldData = node.fields\n\n // find block used in this node\n const block = blocks.find((block) => block.slug === blockFieldData.blockType)\n if (!block || !block?.fields?.length || !blockFieldData) {\n return\n }\n\n recursivelyPopulateFieldsForGraphQL({\n context,\n currentDepth,\n data: blockFieldData,\n depth,\n draft,\n editorPopulationPromises,\n fieldPromises,\n fields: block.fields,\n findMany,\n flattenLocales,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc: blockFieldData,\n })\n }\n\n return blockPopulationPromise\n}\n"],"mappings":"AAMA,SAASA,mCAAmC,QAAQ;AAEpD,OAAO,MAAMC,yBAAA,GACXC,MAAA;EAEA,MAAMC,sBAAA,GAEFA,CAAC;IACHC,OAAO;IACPC,YAAY;IACZC,KAAK;IACLC,KAAK;IACLC,wBAAwB;IACxBC,aAAa;IACbC,QAAQ;IACRC,cAAc;IACdC,IAAI;IACJC,cAAc;IACdC,kBAAkB;IAClBC,GAAG;IACHC;EAAgB,CACjB;IACC,MAAMC,cAAA,GAAiBL,IAAA,CAAKM,MAAM;IAElC;IACA,MAAMC,KAAA,GAAQjB,MAAA,CAAOkB,IAAI,CAAED,KAAA,IAAUA,KAAA,CAAME,IAAI,KAAKJ,cAAA,CAAeK,SAAS;IAC5E,IAAI,CAACH,KAAA,IAAS,CAACA,KAAA,EAAOD,MAAA,EAAQK,MAAA,IAAU,CAACN,cAAA,EAAgB;MACvD;IACF;IAEAjB,mCAAA,CAAoC;MAClCI,OAAA;MACAC,YAAA;MACAmB,IAAA,EAAMP,cAAA;MACNX,KAAA;MACAC,KAAA;MACAC,wBAAA;MACAC,aAAA;MACAS,MAAA,EAAQC,KAAA,CAAMD,MAAM;MACpBR,QAAA;MACAC,cAAA;MACAE,cAAA;MACAC,kBAAA;MACAC,GAAA;MACAC,gBAAA;MACAS,UAAA,EAAYR;IACd;EACF;EAEA,OAAOd,sBAAA;AACT","ignoreList":[]}
1
+ {"version":3,"file":"graphQLPopulationPromise.js","names":["recursivelyPopulateFieldsForGraphQL","blockPopulationPromiseHOC","blocks","blockPopulationPromise","context","currentDepth","depth","draft","editorPopulationPromises","fieldPromises","findMany","flattenLocales","node","overrideAccess","populationPromises","req","showHiddenFields","blockFieldData","fields","block","find","slug","blockType","length","data","siblingDoc"],"sources":["../../../../src/features/blocks/server/graphQLPopulationPromise.ts"],"sourcesContent":["import type { Block } from 'payload'\n\nimport type { PopulationPromise } from '../../typesServer.js'\nimport type { SerializedInlineBlockNode } from '../server/nodes/InlineBlocksNode.js'\nimport type { SerializedBlockNode } from './nodes/BlocksNode.js'\n\nimport { recursivelyPopulateFieldsForGraphQL } from '../../../populateGraphQL/recursivelyPopulateFieldsForGraphQL.js'\n\nexport const blockPopulationPromiseHOC = (\n blocks: Block[],\n): PopulationPromise<SerializedBlockNode | SerializedInlineBlockNode> => {\n const blockPopulationPromise: PopulationPromise<\n SerializedBlockNode | SerializedInlineBlockNode\n > = ({\n context,\n currentDepth,\n depth,\n draft,\n editorPopulationPromises,\n fieldPromises,\n findMany,\n flattenLocales,\n node,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n }) => {\n const blockFieldData = node.fields\n\n // find block used in this node\n const block = blocks.find((block) => block.slug === blockFieldData.blockType)\n if (!block || !block?.fields?.length || !blockFieldData) {\n return\n }\n\n recursivelyPopulateFieldsForGraphQL({\n context,\n currentDepth,\n data: blockFieldData,\n depth,\n draft,\n editorPopulationPromises,\n fieldPromises,\n fields: block.fields,\n findMany,\n flattenLocales,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc: blockFieldData,\n })\n }\n\n return blockPopulationPromise\n}\n"],"mappings":"AAMA,SAASA,mCAAmC,QAAQ;AAEpD,OAAO,MAAMC,yBAAA,GACXC,MAAA;EAEA,MAAMC,sBAAA,GAEFA,CAAC;IACHC,OAAO;IACPC,YAAY;IACZC,KAAK;IACLC,KAAK;IACLC,wBAAwB;IACxBC,aAAa;IACbC,QAAQ;IACRC,cAAc;IACdC,IAAI;IACJC,cAAc;IACdC,kBAAkB;IAClBC,GAAG;IACHC;EAAgB,CACjB;IACC,MAAMC,cAAA,GAAiBL,IAAA,CAAKM,MAAM;IAElC;IACA,MAAMC,KAAA,GAAQjB,MAAA,CAAOkB,IAAI,CAAED,KAAA,IAAUA,KAAA,CAAME,IAAI,KAAKJ,cAAA,CAAeK,SAAS;IAC5E,IAAI,CAACH,KAAA,IAAS,CAACA,KAAA,EAAOD,MAAA,EAAQK,MAAA,IAAU,CAACN,cAAA,EAAgB;MACvD;IACF;IAEAjB,mCAAA,CAAoC;MAClCI,OAAA;MACAC,YAAA;MACAmB,IAAA,EAAMP,cAAA;MACNX,KAAA;MACAC,KAAA;MACAC,wBAAA;MACAC,aAAA;MACAS,MAAA,EAAQC,KAAA,CAAMD,MAAM;MACpBR,QAAA;MACAC,cAAA;MACAE,cAAA;MACAC,kBAAA;MACAC,GAAA;MACAC,gBAAA;MACAS,UAAA,EAAYR;IACd;EACF;EAEA,OAAOd,sBAAA;AACT","ignoreList":[]}
@@ -7,9 +7,9 @@ export type InlineBlockFields<TInlineBlockFields extends JsonObject = JsonObject
7
7
  blockType: string;
8
8
  id: string;
9
9
  } & TInlineBlockFields;
10
- export type SerializedServerInlineBlockNode = Spread<{
10
+ export type SerializedInlineBlockNode<TBlockFields extends JsonObject = JsonObject> = Spread<{
11
11
  children?: never;
12
- fields: InlineBlockFields;
12
+ fields: InlineBlockFields<TBlockFields>;
13
13
  type: 'inlineBlock';
14
14
  }, SerializedLexicalNode>;
15
15
  export declare class ServerInlineBlockNode extends DecoratorNode<null | React.ReactElement> {
@@ -21,13 +21,13 @@ export declare class ServerInlineBlockNode extends DecoratorNode<null | React.Re
21
21
  static clone(node: ServerInlineBlockNode): ServerInlineBlockNode;
22
22
  static getType(): string;
23
23
  static importDOM(): DOMConversionMap<HTMLDivElement> | null;
24
- static importJSON(serializedNode: SerializedServerInlineBlockNode): ServerInlineBlockNode;
24
+ static importJSON(serializedNode: SerializedInlineBlockNode): ServerInlineBlockNode;
25
25
  static isInline(): false;
26
26
  canIndent(): boolean;
27
27
  createDOM(): HTMLSpanElement;
28
28
  decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element | null;
29
29
  exportDOM(): DOMExportOutput;
30
- exportJSON(): SerializedServerInlineBlockNode;
30
+ exportJSON(): SerializedInlineBlockNode;
31
31
  getFields(): InlineBlockFields;
32
32
  getTextContent(): string;
33
33
  isInline(): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"InlineBlocksNode.d.ts","sourceRoot":"","sources":["../../../../../src/features/blocks/server/nodes/InlineBlocksNode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,aAAa,EACb,WAAW,EACX,OAAO,EACP,qBAAqB,EACrB,MAAM,EACP,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACzC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAGhC,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAEvC,MAAM,MAAM,iBAAiB,CAAC,kBAAkB,SAAS,UAAU,GAAG,UAAU,IAAI;IAClF,SAAS,EAAE,MAAM,CAAA;IACjB,EAAE,EAAE,MAAM,CAAA;CACX,GAAG,kBAAkB,CAAA;AAEtB,MAAM,MAAM,+BAA+B,GAAG,MAAM,CAClD;IACE,QAAQ,CAAC,EAAE,KAAK,CAAA;IAChB,MAAM,EAAE,iBAAiB,CAAA;IACzB,IAAI,EAAE,aAAa,CAAA;CACpB,EACD,qBAAqB,CACtB,CAAA;AAED,qBAAa,qBAAsB,SAAQ,aAAa,CAAC,IAAI,GAAG,KAAK,CAAC,YAAY,CAAC;IACjF,QAAQ,EAAE,iBAAiB,CAAA;gBAEf,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE;QAAE,MAAM,EAAE,iBAAiB,CAAC;QAAC,GAAG,CAAC,EAAE,OAAO,CAAA;KAAE;IAKzE,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,qBAAqB,GAAG,qBAAqB;IAOhE,MAAM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iBAAiB,EAAE,IAAI,CAAC,GACvC,qBAAqB,CAOvB;AAED,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,qBAAqB,GAAG,SAAS,GAC3D,IAAI,IAAI,qBAAqB,CAE/B"}
@@ -1 +1 @@
1
- {"version":3,"file":"InlineBlocksNode.js","names":["ObjectID","DecoratorNode","ServerInlineBlockNode","__fields","constructor","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","getLatest","setFields","writable","getWritable","updateDOM","id","default","toHexString","$isServerInlineBlockNode"],"sources":["../../../../../src/features/blocks/server/nodes/InlineBlocksNode.tsx"],"sourcesContent":["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 SerializedServerInlineBlockNode = Spread<\n {\n children?: never // required so that our typed editor state doesn't automatically add children\n fields: InlineBlockFields\n type: 'inlineBlock'\n },\n SerializedLexicalNode\n>\n\nexport class ServerInlineBlockNode extends DecoratorNode<null | React.ReactElement> {\n __fields: InlineBlockFields\n\n constructor({ fields, key }: { fields: InlineBlockFields; key?: NodeKey }) {\n super(key)\n this.__fields = fields\n }\n\n static clone(node: ServerInlineBlockNode): ServerInlineBlockNode {\n return new this({\n fields: node.__fields,\n key: node.__key,\n })\n }\n\n static getType(): string {\n return 'inlineBlock'\n }\n\n static importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {}\n }\n\n static importJSON(serializedNode: SerializedServerInlineBlockNode): 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 createDOM() {\n const element = document.createElement('span')\n element.classList.add('inline-block-container')\n\n return element\n }\n\n decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element | null {\n return null\n }\n\n 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 exportJSON(): SerializedServerInlineBlockNode {\n return {\n type: 'inlineBlock',\n fields: this.getFields(),\n version: 1,\n }\n }\n\n getFields(): InlineBlockFields {\n return this.getLatest().__fields\n }\n\n getTextContent(): string {\n return `Block Field`\n }\n\n isInline() {\n return true\n }\n\n setFields(fields: InlineBlockFields): void {\n const writable = this.getWritable()\n writable.__fields = fields\n }\n\n 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"],"mappings":"AAcA,OAAOA,QAAA,MAAc;AACrB,SAASC,aAAa,QAAQ;AAgB9B,OAAO,MAAMC,qBAAA,SAA8BD,aAAA;EACzCE,QAAA;EAEAC,YAAY;IAAEC,MAAM;IAAEC;EAAG,CAAgD,EAAE;IACzE,KAAK,CAACA,GAAA;IACN,IAAI,CAACH,QAAQ,GAAGE,MAAA;EAClB;EAEA,OAAOE,MAAMC,IAA2B,EAAyB;IAC/D,OAAO,IAAI,IAAI,CAAC;MACdH,MAAA,EAAQG,IAAA,CAAKL,QAAQ;MACrBG,GAAA,EAAKE,IAAA,CAAKC;IACZ;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AAO,IAAIH,qBAAA,CAAsB;IAC/BG,MAAA,EAAQ;MACN,GAAGA,MAAM;MACTmC,EAAA,EAAInC,MAAA,EAAQmC,EAAA,IAAM,IAAIxC,QAAA,CAASyC,OAAO,GAAGC,WAAW;IACtD;EACF;AACF;AAEA,OAAO,SAASC,yBACdnC,IAA4D;EAE5D,OAAOA,IAAA,YAAgBN,qBAAA;AACzB","ignoreList":[]}
1
+ {"version":3,"file":"InlineBlocksNode.js","names":["ObjectID","DecoratorNode","ServerInlineBlockNode","__fields","constructor","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","getLatest","setFields","writable","getWritable","updateDOM","id","default","toHexString","$isServerInlineBlockNode"],"sources":["../../../../../src/features/blocks/server/nodes/InlineBlocksNode.tsx"],"sourcesContent":["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 __fields: InlineBlockFields\n\n constructor({ fields, key }: { fields: InlineBlockFields; key?: NodeKey }) {\n super(key)\n this.__fields = fields\n }\n\n static clone(node: ServerInlineBlockNode): ServerInlineBlockNode {\n return new this({\n fields: node.__fields,\n key: node.__key,\n })\n }\n\n static getType(): string {\n return 'inlineBlock'\n }\n\n static importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {}\n }\n\n static 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 createDOM() {\n const element = document.createElement('span')\n element.classList.add('inline-block-container')\n\n return element\n }\n\n decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element | null {\n return null\n }\n\n 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 exportJSON(): SerializedInlineBlockNode {\n return {\n type: 'inlineBlock',\n fields: this.getFields(),\n version: 1,\n }\n }\n\n getFields(): InlineBlockFields {\n return this.getLatest().__fields\n }\n\n getTextContent(): string {\n return `Block Field`\n }\n\n isInline() {\n return true\n }\n\n setFields(fields: InlineBlockFields): void {\n const writable = this.getWritable()\n writable.__fields = fields\n }\n\n 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"],"mappings":"AAcA,OAAOA,QAAA,MAAc;AACrB,SAASC,aAAa,QAAQ;AAgB9B,OAAO,MAAMC,qBAAA,SAA8BD,aAAA;EACzCE,QAAA;EAEAC,YAAY;IAAEC,MAAM;IAAEC;EAAG,CAAgD,EAAE;IACzE,KAAK,CAACA,GAAA;IACN,IAAI,CAACH,QAAQ,GAAGE,MAAA;EAClB;EAEA,OAAOE,MAAMC,IAA2B,EAAyB;IAC/D,O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AGE,MAAA;EACtB;EAEAkC,UAAA,EAAqB;IACnB,OAAO;EACT;AACF;AAEA,OAAO,SAASzB,6BACdT,MAAwC;EAExC,OAAO,IAAIH,qBAAA,CAAsB;IAC/BG,MAAA,EAAQ;MACN,GAAGA,MAAM;MACTmC,EAAA,EAAInC,MAAA,EAAQmC,EAAA,IAAM,IAAIxC,QAAA,CAASyC,OAAO,GAAGC,WAAW;IACtD;EACF;AACF;AAEA,OAAO,SAASC,yBACdnC,IAA4D;EAE5D,OAAOA,IAAA,YAAgBN,qBAAA;AACzB","ignoreList":[]}
@@ -1,6 +1,6 @@
1
1
  import type { Block } from 'payload';
2
2
  import type { NodeValidation } from '../../typesServer.js';
3
- import type { SerializedInlineBlockNode } from '../client/nodes/InlineBlocksNode.js';
4
3
  import type { SerializedBlockNode } from './nodes/BlocksNode.js';
4
+ import type { SerializedInlineBlockNode } from './nodes/InlineBlocksNode.js';
5
5
  export declare const blockValidationHOC: (blocks: Block[]) => NodeValidation<SerializedBlockNode | SerializedInlineBlockNode>;
6
6
  //# sourceMappingURL=validate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../../src/features/blocks/server/validate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAIpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAA;AACpF,OAAO,KAAK,EAAe,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAE7E,eAAO,MAAM,kBAAkB,WACrB,KAAK,EAAE,KACd,cAAc,CAAC,mBAAmB,GAAG,yBAAyB,CA+ChE,CAAA"}
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../../src/features/blocks/server/validate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAIpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAe,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAC7E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AAE5E,eAAO,MAAM,kBAAkB,WACrB,KAAK,EAAE,KACd,cAAc,CAAC,mBAAmB,GAAG,yBAAyB,CA+ChE,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"validate.js","names":["fieldSchemasToFormState","blockValidationHOC","blocks","node","validation","blockFieldData","fields","options","id","collectionSlug","operation","preferences","req","block","find","slug","blockType","result","data","fieldSchemaMap","undefined","permissions","renderAllFields","schemaPath","errorPaths","fieldKey","concat","length","join"],"sources":["../../../../src/features/blocks/server/validate.ts"],"sourcesContent":["import type { Block } from 'payload'\n\nimport { fieldSchemasToFormState } from '@payloadcms/ui/forms/fieldSchemasToFormState'\n\nimport type { NodeValidation } from '../../typesServer.js'\nimport type { SerializedInlineBlockNode } from '../client/nodes/InlineBlocksNode.js'\nimport type { BlockFields, SerializedBlockNode } from './nodes/BlocksNode.js'\n\nexport const blockValidationHOC = (\n blocks: Block[],\n): NodeValidation<SerializedBlockNode | SerializedInlineBlockNode> => {\n return async ({ node, validation }) => {\n const blockFieldData = node.fields ?? ({} as BlockFields)\n\n const {\n options: { id, collectionSlug, operation, preferences, req },\n } = validation\n\n // find block\n const block = blocks.find((block) => block.slug === blockFieldData.blockType)\n\n // validate block\n if (!block) {\n return 'Block not found'\n }\n\n /**\n * Run fieldSchemasToFormState as that properly validates block and block sub-fields\n */\n\n const result = await fieldSchemasToFormState({\n id,\n collectionSlug,\n data: blockFieldData,\n fields: block.fields,\n fieldSchemaMap: undefined,\n operation: operation === 'create' || operation === 'update' ? operation : 'update',\n permissions: {},\n preferences,\n renderAllFields: false,\n req,\n schemaPath: '',\n })\n\n let errorPaths: string[] = []\n for (const fieldKey in result) {\n if (result[fieldKey].errorPaths) {\n errorPaths = errorPaths.concat(result[fieldKey].errorPaths)\n }\n }\n\n if (errorPaths.length) {\n return 'The following fields are invalid: ' + errorPaths.join(', ')\n }\n\n return true\n }\n}\n"],"mappings":"AAEA,SAASA,uBAAuB,QAAQ;AAMxC,OAAO,MAAMC,kBAAA,GACXC,MAAA;EAEA,OAAO,OAAO;IAAEC,IAAI;IAAEC;EAAU,CAAE;IAChC,MAAMC,cAAA,GAAiBF,IAAA,CAAKG,MAAM,IAAK,CAAC;IAExC,MAAM;MACJC,OAAA,EAAS;QAAEC,EAAE;QAAEC,cAAc;QAAEC,SAAS;QAAEC,WAAW;QAAEC;MAAG;IAAE,CAC7D,GAAGR,UAAA;IAEJ;IACA,MAAMS,KAAA,GAAQX,MAAA,CAAOY,IAAI,CAAED,KAAA,IAAUA,KAAA,CAAME,IAAI,KAAKV,cAAA,CAAeW,SAAS;IAE5E;IACA,IAAI,CAACH,KAAA,EAAO;MACV,OAAO;IACT;IAEA;;;IAIA,MAAMI,MAAA,GAAS,MAAMjB,uBAAA,CAAwB;MAC3CQ,EAAA;MACAC,cAAA;MACAS,IAAA,EAAMb,cAAA;MACNC,MAAA,EAAQO,KAAA,CAAMP,MAAM;MACpBa,cAAA,EAAgBC,SAAA;MAChBV,SAAA,EAAWA,SAAA,KAAc,YAAYA,SAAA,KAAc,WAAWA,SAAA,GAAY;MAC1EW,WAAA,EAAa,CAAC;MACdV,WAAA;MACAW,eAAA,EAAiB;MACjBV,GAAA;MACAW,UAAA,EAAY;IACd;IAEA,IAAIC,UAAA,GAAuB,EAAE;IAC7B,KAAK,MAAMC,QAAA,IAAYR,MAAA,EAAQ;MAC7B,IAAIA,MAAM,CAACQ,QAAA,CAAS,CAACD,UAAU,EAAE;QAC/BA,UAAA,GAAaA,UAAA,CAAWE,MAAM,CAACT,MAAM,CAACQ,QAAA,CAAS,CAACD,UAAU;MAC5D;IACF;IAEA,IAAIA,UAAA,CAAWG,MAAM,EAAE;MACrB,OAAO,uCAAuCH,UAAA,CAAWI,IAAI,CAAC;IAChE;IAEA,OAAO;EACT;AACF","ignoreList":[]}
1
+ {"version":3,"file":"validate.js","names":["fieldSchemasToFormState","blockValidationHOC","blocks","node","validation","blockFieldData","fields","options","id","collectionSlug","operation","preferences","req","block","find","slug","blockType","result","data","fieldSchemaMap","undefined","permissions","renderAllFields","schemaPath","errorPaths","fieldKey","concat","length","join"],"sources":["../../../../src/features/blocks/server/validate.ts"],"sourcesContent":["import type { Block } from 'payload'\n\nimport { fieldSchemasToFormState } from '@payloadcms/ui/forms/fieldSchemasToFormState'\n\nimport type { NodeValidation } from '../../typesServer.js'\nimport type { BlockFields, SerializedBlockNode } from './nodes/BlocksNode.js'\nimport type { SerializedInlineBlockNode } from './nodes/InlineBlocksNode.js'\n\nexport const blockValidationHOC = (\n blocks: Block[],\n): NodeValidation<SerializedBlockNode | SerializedInlineBlockNode> => {\n return async ({ node, validation }) => {\n const blockFieldData = node.fields ?? ({} as BlockFields)\n\n const {\n options: { id, collectionSlug, operation, preferences, req },\n } = validation\n\n // find block\n const block = blocks.find((block) => block.slug === blockFieldData.blockType)\n\n // validate block\n if (!block) {\n return 'Block not found'\n }\n\n /**\n * Run fieldSchemasToFormState as that properly validates block and block sub-fields\n */\n\n const result = await fieldSchemasToFormState({\n id,\n collectionSlug,\n data: blockFieldData,\n fields: block.fields,\n fieldSchemaMap: undefined,\n operation: operation === 'create' || operation === 'update' ? operation : 'update',\n permissions: {},\n preferences,\n renderAllFields: false,\n req,\n schemaPath: '',\n })\n\n let errorPaths: string[] = []\n for (const fieldKey in result) {\n if (result[fieldKey].errorPaths) {\n errorPaths = errorPaths.concat(result[fieldKey].errorPaths)\n }\n }\n\n if (errorPaths.length) {\n return 'The following fields are invalid: ' + errorPaths.join(', ')\n }\n\n return true\n }\n}\n"],"mappings":"AAEA,SAASA,uBAAuB,QAAQ;AAMxC,OAAO,MAAMC,kBAAA,GACXC,MAAA;EAEA,OAAO,OAAO;IAAEC,IAAI;IAAEC;EAAU,CAAE;IAChC,MAAMC,cAAA,GAAiBF,IAAA,CAAKG,MAAM,IAAK,CAAC;IAExC,MAAM;MACJC,OAAA,EAAS;QAAEC,EAAE;QAAEC,cAAc;QAAEC,SAAS;QAAEC,WAAW;QAAEC;MAAG;IAAE,CAC7D,GAAGR,UAAA;IAEJ;IACA,MAAMS,KAAA,GAAQX,MAAA,CAAOY,IAAI,CAAED,KAAA,IAAUA,KAAA,CAAME,IAAI,KAAKV,cAAA,CAAeW,SAAS;IAE5E;IACA,IAAI,CAACH,KAAA,EAAO;MACV,OAAO;IACT;IAEA;;;IAIA,MAAMI,MAAA,GAAS,MAAMjB,uBAAA,CAAwB;MAC3CQ,EAAA;MACAC,cAAA;MACAS,IAAA,EAAMb,cAAA;MACNC,MAAA,EAAQO,KAAA,CAAMP,MAAM;MACpBa,cAAA,EAAgBC,SAAA;MAChBV,SAAA,EAAWA,SAAA,KAAc,YAAYA,SAAA,KAAc,WAAWA,SAAA,GAAY;MAC1EW,WAAA,EAAa,CAAC;MACdV,WAAA;MACAW,eAAA,EAAiB;MACjBV,GAAA;MACAW,UAAA,EAAY;IACd;IAEA,IAAIC,UAAA,GAAuB,EAAE;IAC7B,KAAK,MAAMC,QAAA,IAAYR,MAAA,EAAQ;MAC7B,IAAIA,MAAM,CAACQ,QAAA,CAAS,CAACD,UAAU,EAAE;QAC/BA,UAAA,GAAaA,UAAA,CAAWE,MAAM,CAACT,MAAM,CAACQ,QAAA,CAAS,CAACD,UAAU;MAC5D;IACF;IAEA,IAAIA,UAAA,CAAWG,MAAM,EAAE;MACrB,OAAO,uCAAuCH,UAAA,CAAWI,IAAI,CAAC;IAChE;IAEA,OAAO;EACT;AACF","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  import type { SerializedLineBreakNode as _SerializedLineBreakNode, SerializedTextNode as _SerializedTextNode, SerializedEditorState, SerializedElementNode, SerializedLexicalNode, Spread } from 'lexical';
2
2
  import type { SerializedQuoteNode } from './features/blockquote/server/index.js';
3
- import type { SerializedInlineBlockNode } from './features/blocks/client/nodes/InlineBlocksNode.js';
4
3
  import type { SerializedBlockNode } from './features/blocks/server/nodes/BlocksNode.js';
4
+ import type { SerializedInlineBlockNode } from './features/blocks/server/nodes/InlineBlocksNode.js';
5
5
  import type { SerializedTableCellNode, SerializedTableNode, SerializedTableRowNode } from './features/experimental_table/server/index.js';
6
6
  import type { SerializedHeadingNode } from './features/heading/server/index.js';
7
7
  import type { SerializedHorizontalRuleNode } from './features/horizontalRule/server/nodes/HorizontalRuleNode.js';
@@ -1 +1 @@
1
- {"version":3,"file":"nodeTypes.d.ts","sourceRoot":"","sources":["../src/nodeTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,IAAI,wBAAwB,EACnD,kBAAkB,IAAI,mBAAmB,EACzC,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,MAAM,EACP,MAAM,SAAS,CAAA;AAEhB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAA;AAChF,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,oDAAoD,CAAA;AACnG,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAA;AACvF,OAAO,KAAK,EACV,uBAAuB,EACvB,mBAAmB,EACnB,sBAAsB,EACvB,MAAM,+CAA+C,CAAA;AACtD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAA;AAC/E,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,8DAA8D,CAAA;AAChH,OAAO,KAAK,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AAChG,OAAO,KAAK,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AAClG,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0DAA0D,CAAA;AAC1G,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8CAA8C,CAAA;AAExF,YAA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,4BAA4B,GAC5B,uBAAuB,GACvB,kBAAkB,GAClB,sBAAsB,GACtB,kBAAkB,GAClB,uBAAuB,GACvB,mBAAmB,GACnB,0BAA0B,GAC1B,kBAAkB,GAClB,oBAAoB,CAAA;AAExB,MAAM,MAAM,uBAAuB,CAAC,CAAC,SAAS,qBAAqB,GAAG,qBAAqB,IACzF,gBAAgB,CAAC,gBAAgB,GAAG,CAAC,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"nodeTypes.js","names":[],"sources":["../src/nodeTypes.ts"],"sourcesContent":["import type {\n SerializedLineBreakNode as _SerializedLineBreakNode,\n SerializedTextNode as _SerializedTextNode,\n SerializedEditorState,\n SerializedElementNode,\n SerializedLexicalNode,\n Spread,\n} from 'lexical'\n\nimport type { SerializedQuoteNode } from './features/blockquote/server/index.js'\nimport type { SerializedInlineBlockNode } from './features/blocks/client/nodes/InlineBlocksNode.js'\nimport type { SerializedBlockNode } from './features/blocks/server/nodes/BlocksNode.js'\nimport type {\n SerializedTableCellNode,\n SerializedTableNode,\n SerializedTableRowNode,\n} from './features/experimental_table/server/index.js'\nimport type { SerializedHeadingNode } from './features/heading/server/index.js'\nimport type { SerializedHorizontalRuleNode } from './features/horizontalRule/server/nodes/HorizontalRuleNode.js'\nimport type { SerializedAutoLinkNode, SerializedLinkNode } from './features/link/nodes/types.js'\nimport type { SerializedListItemNode, SerializedListNode } from './features/lists/plugin/index.js'\nimport type { SerializedRelationshipNode } from './features/relationship/server/nodes/RelationshipNode.js'\nimport type { SerializedUploadNode } from './features/upload/server/nodes/UploadNode.js'\n\nexport type {\n SerializedAutoLinkNode,\n SerializedBlockNode,\n SerializedHeadingNode,\n SerializedHorizontalRuleNode,\n SerializedInlineBlockNode,\n SerializedLinkNode,\n SerializedListItemNode,\n SerializedListNode,\n SerializedQuoteNode,\n SerializedRelationshipNode,\n SerializedTableCellNode,\n SerializedTableNode,\n SerializedTableRowNode,\n SerializedUploadNode,\n}\n\nexport type SerializedParagraphNode<T extends SerializedLexicalNode = SerializedLexicalNode> =\n Spread<\n {\n textFormat: number\n type: 'paragraph'\n },\n SerializedElementNode<T>\n >\nexport type SerializedTextNode = Spread<\n {\n children?: never // required so that our typed editor state doesn't automatically add children\n type: 'text'\n },\n _SerializedTextNode\n>\n\nexport type SerializedLineBreakNode = Spread<\n {\n children?: never // required so that our typed editor state doesn't automatically add children\n type: 'linebreak'\n },\n _SerializedLineBreakNode\n>\n\ntype RecursiveNodes<T extends SerializedLexicalNode, Depth extends number = 4> = Depth extends 0\n ? T\n : { children?: RecursiveNodes<T, DecrementDepth<Depth>>[] } & T\n\ntype DecrementDepth<N extends number> = [0, 0, 1, 2, 3, 4][N]\n\nexport type TypedEditorState<T extends SerializedLexicalNode = SerializedLexicalNode> =\n SerializedEditorState<RecursiveNodes<T>>\n\nexport type DefaultNodeTypes =\n | SerializedAutoLinkNode\n //| SerializedBlockNode // Not included by default\n | SerializedHeadingNode\n | SerializedHorizontalRuleNode\n | SerializedLineBreakNode\n | SerializedLinkNode\n | SerializedListItemNode\n | SerializedListNode\n | SerializedParagraphNode\n | SerializedQuoteNode\n | SerializedRelationshipNode\n | SerializedTextNode\n | SerializedUploadNode\n\nexport type DefaultTypedEditorState<T extends SerializedLexicalNode = SerializedLexicalNode> =\n TypedEditorState<DefaultNodeTypes | T>\n"],"mappings":"AAyFA","ignoreList":[]}
1
+ {"version":3,"file":"nodeTypes.js","names":[],"sources":["../src/nodeTypes.ts"],"sourcesContent":["import type {\n SerializedLineBreakNode as _SerializedLineBreakNode,\n SerializedTextNode as _SerializedTextNode,\n SerializedEditorState,\n SerializedElementNode,\n SerializedLexicalNode,\n Spread,\n} from 'lexical'\n\nimport type { SerializedQuoteNode } from './features/blockquote/server/index.js'\nimport type { SerializedBlockNode } from './features/blocks/server/nodes/BlocksNode.js'\nimport type { SerializedInlineBlockNode } from './features/blocks/server/nodes/InlineBlocksNode.js'\nimport type {\n SerializedTableCellNode,\n SerializedTableNode,\n SerializedTableRowNode,\n} from './features/experimental_table/server/index.js'\nimport type { SerializedHeadingNode } from './features/heading/server/index.js'\nimport type { SerializedHorizontalRuleNode } from './features/horizontalRule/server/nodes/HorizontalRuleNode.js'\nimport type { SerializedAutoLinkNode, SerializedLinkNode } from './features/link/nodes/types.js'\nimport type { SerializedListItemNode, SerializedListNode } from './features/lists/plugin/index.js'\nimport type { SerializedRelationshipNode } from './features/relationship/server/nodes/RelationshipNode.js'\nimport type { SerializedUploadNode } from './features/upload/server/nodes/UploadNode.js'\n\nexport type {\n SerializedAutoLinkNode,\n SerializedBlockNode,\n SerializedHeadingNode,\n SerializedHorizontalRuleNode,\n SerializedInlineBlockNode,\n SerializedLinkNode,\n SerializedListItemNode,\n SerializedListNode,\n SerializedQuoteNode,\n SerializedRelationshipNode,\n SerializedTableCellNode,\n SerializedTableNode,\n SerializedTableRowNode,\n SerializedUploadNode,\n}\n\nexport type SerializedParagraphNode<T extends SerializedLexicalNode = SerializedLexicalNode> =\n Spread<\n {\n textFormat: number\n type: 'paragraph'\n },\n SerializedElementNode<T>\n >\nexport type SerializedTextNode = Spread<\n {\n children?: never // required so that our typed editor state doesn't automatically add children\n type: 'text'\n },\n _SerializedTextNode\n>\n\nexport type SerializedLineBreakNode = Spread<\n {\n children?: never // required so that our typed editor state doesn't automatically add children\n type: 'linebreak'\n },\n _SerializedLineBreakNode\n>\n\ntype RecursiveNodes<T extends SerializedLexicalNode, Depth extends number = 4> = Depth extends 0\n ? T\n : { children?: RecursiveNodes<T, DecrementDepth<Depth>>[] } & T\n\ntype DecrementDepth<N extends number> = [0, 0, 1, 2, 3, 4][N]\n\nexport type TypedEditorState<T extends SerializedLexicalNode = SerializedLexicalNode> =\n SerializedEditorState<RecursiveNodes<T>>\n\nexport type DefaultNodeTypes =\n | SerializedAutoLinkNode\n //| SerializedBlockNode // Not included by default\n | SerializedHeadingNode\n | SerializedHorizontalRuleNode\n | SerializedLineBreakNode\n | SerializedLinkNode\n | SerializedListItemNode\n | SerializedListNode\n | SerializedParagraphNode\n | SerializedQuoteNode\n | SerializedRelationshipNode\n | SerializedTextNode\n | SerializedUploadNode\n\nexport type DefaultTypedEditorState<T extends SerializedLexicalNode = SerializedLexicalNode> =\n TypedEditorState<DefaultNodeTypes | T>\n"],"mappings":"AAyFA","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/richtext-lexical",
3
- "version": "3.2.1",
3
+ "version": "3.2.2-canary.380cfb0",
4
4
  "description": "The officially supported Lexical richtext adapter for Payload",
5
5
  "homepage": "https://payloadcms.com",
6
6
  "repository": {
@@ -345,8 +345,8 @@
345
345
  "react-error-boundary": "4.1.1",
346
346
  "ts-essentials": "10.0.3",
347
347
  "uuid": "10.0.0",
348
- "@payloadcms/translations": "3.2.1",
349
- "@payloadcms/ui": "3.2.1"
348
+ "@payloadcms/translations": "3.2.2-canary.380cfb0",
349
+ "@payloadcms/ui": "3.2.2-canary.380cfb0"
350
350
  },
351
351
  "devDependencies": {
352
352
  "@babel/cli": "^7.24.5",
@@ -366,8 +366,8 @@
366
366
  "esbuild-sass-plugin": "3.3.1",
367
367
  "eslint-plugin-react-compiler": "19.0.0-beta-a7bf2bd-20241110",
368
368
  "swc-plugin-transform-remove-imports": "1.15.0",
369
- "payload": "3.2.1",
370
- "@payloadcms/eslint-config": "3.0.0"
369
+ "@payloadcms/eslint-config": "3.0.0",
370
+ "payload": "3.2.2-canary.380cfb0"
371
371
  },
372
372
  "peerDependencies": {
373
373
  "@faceless-ui/modal": "3.0.0-beta.2",
@@ -384,8 +384,8 @@
384
384
  "lexical": "0.20.0",
385
385
  "react": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
386
386
  "react-dom": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
387
- "@payloadcms/next": "3.2.1",
388
- "payload": "3.2.1"
387
+ "@payloadcms/next": "3.2.2-canary.380cfb0",
388
+ "payload": "3.2.2-canary.380cfb0"
389
389
  },
390
390
  "engines": {
391
391
  "node": "^18.20.2 || >=20.9.0"
@@ -1,7 +0,0 @@
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, FormState } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useLexicalNodeSelection } from '@lexical/react/useLexicalNodeSelection'\nimport { mergeRegister } from '@lexical/utils'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n Drawer,\n EditDepthProvider,\n Form,\n formatDrawerSlug,\n FormSubmit,\n RenderFields,\n ShimmerEffect,\n useDocumentInfo,\n useEditDepth,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport {\n $getNodeByKey,\n $getSelection,\n $isNodeSelection,\n CLICK_COMMAND,\n COMMAND_PRIORITY_LOW,\n KEY_BACKSPACE_COMMAND,\n KEY_DELETE_COMMAND,\n} from 'lexical'\nimport { reduceFieldsToValues } from 'payload/shared'\n\nimport './index.scss'\n\nimport { v4 as uuid } from 'uuid'\n\nimport type { InlineBlockFields } from '../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 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.useContext(InlineBlockComponentContext)\n\nexport const InlineBlockComponent: React.FC<Props> = (props) => {\n const { formData, nodeKey } = props\n const [editor] = useLexicalComposerContext()\n const { i18n, t } = useTranslation<object, string>()\n const {\n fieldProps: {\n featureClientSchemaMap,\n initialLexicalFormState,\n permissions,\n readOnly,\n schemaPath,\n },\n uuid: uuidFromContext,\n } = useEditorConfigContext()\n const { getFormState } = useServerFunctions()\n const editDepth = useEditDepth()\n\n const [initialState, setInitialState] = React.useState<false | FormState | undefined>(\n initialLexicalFormState?.[formData.id]?.formState,\n )\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,\n depth: editDepth,\n })\n const { toggleDrawer } = useLexicalDrawer(drawerSlug, true)\n\n const inlineBlockElemElemRef = useRef<HTMLDivElement | null>(null)\n const [isSelected, setSelected, clearSelection] = useLexicalNodeSelection(nodeKey)\n const { id, collectionSlug, getDocPreferences, globalSlug } = useDocumentInfo()\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 = blocksField.blocks[0]\n\n const removeInlineBlock = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey)?.remove()\n })\n }, [editor, nodeKey])\n\n const $onDelete = useCallback(\n (event: KeyboardEvent) => {\n const deleteSelection = $getSelection()\n if (isSelected && $isNodeSelection(deleteSelection)) {\n event.preventDefault()\n editor.update(() => {\n deleteSelection.getNodes().forEach((node) => {\n if ($isInlineBlockNode(node)) {\n node.remove()\n }\n })\n })\n }\n return false\n },\n [editor, isSelected],\n )\n const onClick = useCallback(\n (payload: MouseEvent) => {\n const event = payload\n // Check if inlineBlockElemElemRef.target or anything WITHIN inlineBlockElemElemRef.target was clicked\n if (\n event.target === inlineBlockElemElemRef.current ||\n inlineBlockElemElemRef.current?.contains(event.target as Node)\n ) {\n if (event.shiftKey) {\n setSelected(!isSelected)\n } else {\n if (!isSelected) {\n clearSelection()\n setSelected(true)\n }\n }\n return true\n }\n\n return false\n },\n [isSelected, setSelected, clearSelection],\n )\n\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand<MouseEvent>(CLICK_COMMAND, onClick, COMMAND_PRIORITY_LOW),\n\n editor.registerCommand(KEY_DELETE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW),\n editor.registerCommand(KEY_BACKSPACE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW),\n )\n }, [clearSelection, editor, isSelected, nodeKey, $onDelete, setSelected, onClick])\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 globalSlug,\n operation: 'update',\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: abortController.signal,\n })\n\n if (state) {\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 schemaFieldsPath,\n id,\n formData,\n initialState,\n collectionSlug,\n globalSlug,\n getDocPreferences,\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 formState: prevFormState,\n globalSlug,\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 [getFormState, id, collectionSlug, getDocPreferences, globalSlug, schemaFieldsPath],\n )\n // cleanup effect\n useEffect(() => {\n return () => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [])\n\n /**\n * HANDLE FORM SUBMIT\n */\n const onFormSubmit = useCallback(\n (formState: FormState) => {\n const newData: any = reduceFieldsToValues(formState)\n newData.blockType = formData.blockType\n editor.update(() => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n node.setFields(newData)\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 }: { children: React.ReactNode }) => (\n <div\n className={[\n baseClass,\n baseClass + '-' + formData.blockType,\n isSelected && `${baseClass}--selected`,\n ]\n .filter(Boolean)\n .join(' ')}\n ref={inlineBlockElemElemRef}\n >\n {children}\n </div>\n ),\n [formData.blockType, isSelected],\n )\n\n const Label = useMemo(() => {\n if (CustomLabel) {\n return () => CustomLabel\n } else {\n return () => <div>{getTranslation(clientBlock.labels!.singular, i18n)}</div>\n }\n }, [CustomLabel, clientBlock.labels, i18n])\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 fields={clientBlock.fields}\n initialState={initialState || {}}\n onChange={[onChange]}\n onSubmit={(formState) => {\n onFormSubmit(formState)\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={permissions}\n readOnly={false}\n />\n <FormSubmit>{t('fields:saveChanges')}</FormSubmit>\n </>\n ) : null}\n </Drawer>\n </EditDepthProvider>\n {CustomBlock ? (\n <InlineBlockComponentContext.Provider\n value={{\n EditButton,\n initialState,\n InlineBlockContainer,\n Label,\n nodeKey,\n RemoveButton,\n }}\n >\n {CustomBlock}\n </InlineBlockComponentContext.Provider>\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 {\n EditorConfig,\n LexicalEditor,\n LexicalNode,\n SerializedLexicalNode,\n Spread,\n} from 'lexical'\n\nimport ObjectID from 'bson-objectid'\nimport React, { type JSX } from 'react'\n\nimport type { SerializedServerInlineBlockNode } from '../../server/nodes/InlineBlocksNode.js'\n\nimport { ServerInlineBlockNode } from '../../server/nodes/InlineBlocksNode.js'\n\nexport type InlineBlockFields = {\n /** Block form data */\n [key: string]: any\n //blockName: string\n blockType: string\n id: string\n}\n\nconst InlineBlockComponent = React.lazy(() =>\n import('../componentInline/index.js').then((module) => ({\n default: module.InlineBlockComponent,\n })),\n)\n\nexport type SerializedInlineBlockNode = Spread<\n {\n children?: never // required so that our typed editor state doesn't automatically add children\n fields: InlineBlockFields\n type: 'inlineBlock'\n },\n SerializedLexicalNode\n>\n\nexport class InlineBlockNode extends ServerInlineBlockNode {\n static clone(node: ServerInlineBlockNode): ServerInlineBlockNode {\n return super.clone(node)\n }\n\n static getType(): string {\n return super.getType()\n }\n\n static importJSON(serializedNode: SerializedInlineBlockNode): InlineBlockNode {\n const node = $createInlineBlockNode(serializedNode.fields)\n return node\n }\n\n decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element {\n return <InlineBlockComponent formData={this.getFields()} nodeKey={this.getKey()} />\n }\n\n exportJSON(): SerializedServerInlineBlockNode {\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 SerializedServerInlineBlockNode = Spread<\n {\n children?: never // required so that our typed editor state doesn't automatically add children\n fields: InlineBlockFields\n type: 'inlineBlock'\n },\n SerializedLexicalNode\n>\n\nexport class ServerInlineBlockNode extends DecoratorNode<null | React.ReactElement> {\n __fields: InlineBlockFields\n\n constructor({ fields, key }: { fields: InlineBlockFields; key?: NodeKey }) {\n super(key)\n this.__fields = fields\n }\n\n static clone(node: ServerInlineBlockNode): ServerInlineBlockNode {\n return new this({\n fields: node.__fields,\n key: node.__key,\n })\n }\n\n static getType(): string {\n return 'inlineBlock'\n }\n\n static importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {}\n }\n\n static importJSON(serializedNode: SerializedServerInlineBlockNode): 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 createDOM() {\n const element = document.createElement('span')\n element.classList.add('inline-block-container')\n\n return element\n }\n\n decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element | null {\n return null\n }\n\n 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 exportJSON(): SerializedServerInlineBlockNode {\n return {\n type: 'inlineBlock',\n fields: this.getFields(),\n version: 1,\n }\n }\n\n getFields(): InlineBlockFields {\n return this.getLatest().__fields\n }\n\n getTextContent(): string {\n return `Block Field`\n }\n\n isInline() {\n return true\n }\n\n setFields(fields: InlineBlockFields): void {\n const writable = this.getWritable()\n writable.__fields = fields\n }\n\n 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": "iJAEA,OAAOA,GAASC,iBAAAA,GAAeC,eAAAA,EAAaC,aAAAA,EAAWC,WAAAA,EAASC,UAAAA,OAAc,QAK9E,OAASC,6BAAAA,OAAiC,wCAC1C,OAASC,2BAAAA,OAA+B,yCACxC,OAASC,iBAAAA,OAAqB,iBAC9B,OAASC,kBAAAA,OAAsB,2BAC/B,OACEC,UAAAA,GACAC,UAAAA,GACAC,qBAAAA,GACAC,QAAAA,GACAC,oBAAAA,GACAC,cAAAA,GACAC,gBAAAA,GACAC,iBAAAA,GACAC,mBAAAA,GACAC,gBAAAA,GACAC,sBAAAA,GACAC,kBAAAA,OACK,iBACP,OAASC,kBAAAA,MAAsB,wBAC/B,OACEC,iBAAAA,GACAC,iBAAAA,GACAC,oBAAAA,GACAC,iBAAAA,GACAC,wBAAAA,EACAC,yBAAAA,GACAC,sBAAAA,OACK,UACP,OAASC,wBAAAA,OAA4B,iBAIrC,OAASC,MAAMC,OAAY,gDC9B3B,OAAOC,OAAc,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zB,EAAC0B,GAAA,CACCvB,UAAW,GACX5E,KAAMF,EACNsG,MAAOhI,EAAE,+BAA+BL,GAAUsB,GAAK,OAAS,QAAA,GAAY,CAC1E8F,MAAOrC,GAAoB1E,EAAE,mCAAA,CAC/B,CAAA,WAECX,EACCoI,EAAAQ,GAAA,WACE5B,EAAC6B,GAAA,CACC7C,OAAQzC,EAAYyC,OACpB8C,YAAW,GACXC,gBAAgB,GAChBC,WAAW,GACXC,iBAAkBtD,EAClB3E,YAAaA,GACbC,SAAU,KAEZ+F,EAACkC,GAAA,UAAYvI,EAAE,oBAAA,OAEf,SAGPuB,EACC8E,EAAClH,GAA4BqJ,SAAQ,CACnCC,MAAO,CACLzB,WAAAA,EACA3H,aAAAA,EACA6H,qBAAAA,EACAM,MAAAA,EACA5H,QAAAA,EACAuG,aAAAA,CACF,WAEC5E,IAGHkG,EAACP,EAAA,WACE7H,EAAegH,EAACmB,EAAA,CAAA,CAAA,EAAWnB,EAACqC,GAAA,CAAcC,OAAO,OAAOC,MAAM,SAC9D/I,EAAOgJ,WAAU,EAChBpB,EAAC,MAAA,CAAIjB,UAAW,GAAGtH,CAAA,sBACjBmH,EAACW,EAAA,CAAA,CAAA,EACDX,EAACF,EAAA,CAAA,CAAA,CAAA,IAED,IAAA,MAKd",
6
- "names": ["React", "createContext", "useCallback", "useEffect", "useMemo", "useRef", "useLexicalComposerContext", "useLexicalNodeSelection", "mergeRegister", "getTranslation", "Button", "Drawer", "EditDepthProvider", "Form", "formatDrawerSlug", "FormSubmit", "RenderFields", "ShimmerEffect", "useDocumentInfo", "useEditDepth", "useServerFunctions", "useTranslation", "abortAndIgnore", "$getNodeByKey", "$getSelection", "$isNodeSelection", "CLICK_COMMAND", "COMMAND_PRIORITY_LOW", "KEY_BACKSPACE_COMMAND", "KEY_DELETE_COMMAND", "reduceFieldsToValues", "v4", "uuid", "ObjectID", "React", "ObjectID", "DecoratorNode", "ServerInlineBlockNode", "__fields", "constructor", "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", "getLatest", "setFields", "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", "formData", "getFields", "nodeKey", "getKey", "exportJSON", "id", "ObjectID", "toHexString", "$isInlineBlockNode", "baseClass", "InlineBlockComponentContext", "createContext", "initialState", "useInlineBlockComponentContext", "React", "useContext", "InlineBlockComponent", "props", "formData", "nodeKey", "editor", "useLexicalComposerContext", "i18n", "t", "useTranslation", "fieldProps", "featureClientSchemaMap", "initialLexicalFormState", "permissions", "readOnly", "schemaPath", "uuid", "uuidFromContext", "useEditorConfigContext", "getFormState", "useServerFunctions", "editDepth", "useEditDepth", "setInitialState", "useState", "id", "formState", "CustomLabel", "setCustomLabel", "customComponents", "BlockLabel", "CustomBlock", "setCustomBlock", "Block", "drawerSlug", "formatDrawerSlug", "slug", "depth", "toggleDrawer", "useLexicalDrawer", "inlineBlockElemElemRef", "useRef", "isSelected", "setSelected", "clearSelection", "useLexicalNodeSelection", "collectionSlug", "getDocPreferences", "globalSlug", "useDocumentInfo", "componentMapRenderedBlockPath", "blockType", "clientBlock", "blocks", "removeInlineBlock", "useCallback", "update", "$getNodeByKey", "remove", "$onDelete", "event", "deleteSelection", "$getSelection", "$isNodeSelection", "preventDefault", "getNodes", "forEach", "node", "$isInlineBlockNode", "onClick", "payload", "target", "current", "contains", "shiftKey", "useEffect", "mergeRegister", "registerCommand", "CLICK_COMMAND", "COMMAND_PRIORITY_LOW", "KEY_DELETE_COMMAND", "KEY_BACKSPACE_COMMAND", "blockDisplayName", "labels", "singular", "getTranslation", "onChangeAbortControllerRef", "AbortController", "schemaFieldsPath", "abortController", "state", "data", "docPermissions", "fields", "docPreferences", "operation", "renderAllFields", "signal", "abortAndIgnore", "onChange", "prevFormState", "submit", "controller", "onFormSubmit", "newData", "reduceFieldsToValues", "setFields", "RemoveButton", "useMemo", "_jsx", "Button", "buttonStyle", "className", "disabled", "icon", "e", "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", "Provider", "value", "ShimmerEffect", "height", "width", "isEditable"]
7
- }
@@ -1,2 +0,0 @@
1
- "use client";import{a,b}from"./chunk-WS6E5WE4.js";import"./chunk-2CYU43GM.js";import"./chunk-CUIBIFW2.js";export{b as InlineBlockComponent,a as useInlineBlockComponentContext};
2
- //# sourceMappingURL=componentInline-7YSGAB45.js.map