@payloadcms/richtext-lexical 3.0.0-beta.102 → 3.0.0-beta.104

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- import{createCommand as i}from"lexical";var O=i("INSERT_BLOCK_COMMAND"),x=i("INSERT_INLINE_BLOCK_COMMAND"),I=i("OPEN_INLINE_BLOCK_DRAWER_COMMAND");import{jsx as p}from"react/jsx-runtime";import u from"bson-objectid";import m from"react";import c from"bson-objectid";import{DecoratorNode as l}from"lexical";import{deepCopyObjectSimple as d}from"payload/shared";var r=class extends l{__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 a(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=d(e),s=this.getWritable();s.__fields=n}updateDOM(){return!1}};function a(t){return new r({fields:{...t,id:t?.id||new c.default().toHexString()}})}var f=m.lazy(()=>import("./componentInline-JLMSR7BP.js").then(t=>({default:t.InlineBlockComponent}))),o=class extends r{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return _(e.fields)}decorate(e,n){return p(f,{formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function _(t){return new o({fields:{...t,id:t?.id||new u.default().toHexString()}})}function y(t){return t instanceof o}export{O as a,x as b,I as c,o as d,_ as e,y as f};
2
- //# sourceMappingURL=chunk-7UTZDNYS.js.map
1
+ import{createCommand as i}from"lexical";var O=i("INSERT_BLOCK_COMMAND"),x=i("INSERT_INLINE_BLOCK_COMMAND"),I=i("OPEN_INLINE_BLOCK_DRAWER_COMMAND");import{jsx as p}from"react/jsx-runtime";import u from"bson-objectid";import m from"react";import c from"bson-objectid";import{DecoratorNode as l}from"lexical";import{deepCopyObjectSimple as d}from"payload/shared";var r=class extends l{__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 a(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=d(e),s=this.getWritable();s.__fields=n}updateDOM(){return!1}};function a(t){return new r({fields:{...t,id:t?.id||new c.default().toHexString()}})}var f=m.lazy(()=>import("./componentInline-HAGGWKA7.js").then(t=>({default:t.InlineBlockComponent}))),o=class extends r{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return _(e.fields)}decorate(e,n){return p(f,{formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function _(t){return new o({fields:{...t,id:t?.id||new u.default().toHexString()}})}function y(t){return t instanceof o}export{O as a,x as b,I as c,o as d,_ as e,y as f};
2
+ //# sourceMappingURL=chunk-PY6JO5OH.js.map
@@ -1,2 +1,2 @@
1
1
  "use client";import{b as T}from"./chunk-TXEIKM77.js";import{jsx as f,jsxs as le}from"react/jsx-runtime";import{Collapsible as se,Form as ie,Pill as ne,RenderComponent as ae,SectionTitle as re,ShimmerEffect as ce,useConfig as de,useDocumentInfo as me,useFieldProps as ue,useFormSubmitted as fe,useTranslation as pe}from"@payloadcms/ui";import{useCallback as be,useEffect as he,useMemo as ke,useState as ye}from"react";import{getTranslation as _e}from"@payloadcms/translations";import{getFormState as I}from"@payloadcms/ui/shared";import{v4 as Ce}from"uuid";import{jsx as k,jsxs as B}from"react/jsx-runtime";import{useLexicalComposerContext as q}from"@lexical/react/LexicalComposerContext.js";import{getTranslation as H}from"@payloadcms/translations";import{Button as W,Collapsible as z,ErrorPill as G,Pill as J,RenderComponent as Q,RenderFields as X,SectionTitle as Y,useDocumentInfo as Z,useFormSubmitted as ee,useTranslation as oe}from"@payloadcms/ui";import{dequal as te}from"dequal/lite";import{$getNodeByKey as O}from"lexical";import A,{useCallback as E}from"react";import{c as K}from"react/compiler-runtime";import{useAllFormFields as V}from"@payloadcms/ui";import{reduceFieldsToValues as D}from"payload/shared";import{useEffect as M}from"react";function w({fields:i}){for(let e in i){let o=i[e];Array.isArray(o.rows)&&"value"in o&&(o.disableFormData=!0)}return i}var j=i=>{let e=K(8),{onChange:o}=i,[l]=V(),d,s;e[0]!==l?(s=w({fields:l}),d=D(s,!0),e[0]=l,e[1]=d,e[2]=s):(d=e[1],s=e[2]);let m=d,t,a;return e[3]!==o||e[4]!==s||e[5]!==m?(t=()=>{o&&o({fullFieldsWithValues:s,newFormData:m})},a=[m,o,s],e[3]=o,e[4]=s,e[5]=m,e[6]=t,e[7]=a):(t=e[6],a=e[7]),M(t,a),null};function L(i){for(let e in i){let o=i[e];Array.isArray(o)&&!o?.length?delete i[e]:o&&typeof o=="object"?L(o):o==null&&delete i[e]}}var U=i=>{let{baseClass:e,clientBlock:o,field:l,formSchema:d,nodeKey:s,schemaPath:m}=i,{formData:t}=i,{i18n:a}=oe(),[u]=q(),{getDocPreferences:x,setDocFieldPreferences:P}=Z(),[p,N]=A.useState(()=>{let r=!1;return x().then(c=>{let h=c?.fields[l.name]?.collapsed;h&&h.includes(t.id)&&(r=!0,N(!0))}),r}),F=ee(),[n,S]=A.useState(0),C=F&&n>0,$=[`${e}__row`,C?`${e}__row--has-errors`:`${e}__row--no-errors`].filter(Boolean).join(" "),R=E(({fullFieldsWithValues:r,newFormData:c})=>{if(c.id=t.id,c.blockType=t.blockType,L(c),L(t),te(t,c)||setTimeout(()=>{u.update(()=>{let _=O(s);_&&(t=c,_.setFields(c))})},0),F){let _=0;for(let h of Object.values(r))h?.valid===!1&&_++;S(_)}},[u,s,F,t]),v=E(r=>{x().then(c=>{let h=c?.fields[l.name]?.collapsed,g=h&&h?.length?h:[];r?g.includes(t.id)||g.push(t.id):g.includes(t.id)&&g.splice(g.indexOf(t.id),1),P(l.name,{collapsed:g,hello:"hi"})})},[x,l.name,P,t.id]),b=E(()=>{u.update(()=>{O(s).remove()})},[u,s]);return B(A.Fragment,{children:[k(z,{className:$,collapsibleStyle:C?"error":"default",header:o?.admin?.components?.Label?k(Q,{clientProps:{blockKind:"lexicalBlock",formData:t},mappedComponent:o.admin.components.Label}):B("div",{className:`${e}__block-header`,children:[B("div",{children:[k(J,{className:`${e}__block-pill ${e}__block-pill-${t?.blockType}`,pillStyle:"white",children:typeof o?.labels.singular=="string"?H(o?.labels.singular,a):o.slug}),k(Y,{path:"blockName",readOnly:l?.admin?.readOnly}),C&&k(G,{count:n,i18n:a,withMessage:!0})]}),u.isEditable()&&k(W,{buttonStyle:"icon-label",className:`${e}__removeButton`,disabled:l?.admin?.readOnly,icon:"x",onClick:r=>{r.preventDefault(),b()},round:!0,tooltip:"Remove Block"})]}),isCollapsed:p,onToggle:r=>{v(r),N(r)},children:k(X,{className:`${e}__fields`,fields:d,forceRender:!0,margins:"small",path:"",readOnly:!1,schemaPath:m})},0),k(j,{onChange:R})]})};var y="lexical-block",We=i=>{let{formData:e,nodeKey:o}=i,{config:l}=de(),d=fe(),{id:s}=me(),{path:m,schemaPath:t}=ue(),{field:a}=T(),[u,x]=ye(!1),{field:{richTextComponentMap:P}}=T(),p=`${t}.lexical_internal_feature.blocks.lexical_blocks.lexical_blocks.${e.blockType}`,n=P.get("lexical_internal_feature.blocks.fields.lexical_blocks")[0].blocks.find(v=>v.slug===e.blockType);he(()=>{e&&(async()=>{let b=await I({apiRoute:l.routes.api,body:{id:s,data:e,operation:"update",schemaPath:p},serverURL:l.serverURL});b&&(b.blockName={initialValue:"",passesCondition:!0,valid:!0,value:e.blockName},x(b))})()},[l.routes.api,l.serverURL,p,s]);let S=be(async({formState:v})=>{let b=await I({apiRoute:l.routes.api,body:{id:s,formState:v,operation:"update",schemaPath:p},serverURL:l.serverURL});return b.blockName={initialValue:"",passesCondition:!0,valid:!0,value:e.blockName},b},[l.routes.api,l.serverURL,s,p,e.blockName]),{i18n:C}=pe(),$=[`${y}__row`,`${y}__row--no-errors`].filter(Boolean).join(" "),R=ke(()=>n&&u!==!1?f(ie,{beforeSubmit:[S],fields:n.fields,initialState:u,onChange:[S],submitted:d,uuid:Ce(),children:f(U,{baseClass:y,clientBlock:n,field:a,formData:e,formSchema:n.fields,nodeKey:o,path:`${m}.lexical_internal_feature.blocks.${e.blockType}`,schemaPath:p})}):f(se,{className:$,collapsibleStyle:"default",header:n?.admin?.components?.Label?f(ae,{clientProps:{blockKind:"lexicalBlock",formData:e},mappedComponent:n.admin.components.Label}):f("div",{className:`${y}__block-header`,children:le("div",{children:[f(ne,{className:`${y}__block-pill ${y}__block-pill-${e?.blockType}`,pillStyle:"white",children:n&&typeof n.labels.singular=="string"?_e(n.labels.singular,C):n.slug}),f(re,{path:"blockName",readOnly:a?.admin?.readOnly})]})}),children:f(ce,{height:"35vh"})},0),[n,u,S,d,a,o,m,p,$,C]);return f("div",{className:y+" "+y+"-"+e.blockType,children:R})};export{We as BlockComponent};
2
- //# sourceMappingURL=component-LHFD5Z33.js.map
2
+ //# sourceMappingURL=component-OVIYSCND.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/features/blocks/client/component/index.tsx", "../../../src/features/blocks/client/component/BlockContent.tsx", "../../../src/features/blocks/client/component/FormSavePlugin.tsx", "../../../src/features/blocks/client/component/removeEmptyArrayValues.ts"],
4
+ "sourcesContent": ["'use client'\n\nimport type { FormProps } from '@payloadcms/ui'\n\nimport {\n Collapsible,\n Form,\n Pill,\n RenderComponent,\n SectionTitle,\n ShimmerEffect,\n useConfig,\n useDocumentInfo,\n useFieldProps,\n useFormSubmitted,\n useTranslation,\n} from '@payloadcms/ui'\nimport React, { useCallback, useEffect, useMemo, useState } from 'react'\n\nconst baseClass = 'lexical-block'\nimport type { BlocksFieldClient, FormState } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { getFormState } from '@payloadcms/ui/shared'\nimport { v4 as uuid } from 'uuid'\n\nimport type { BlockFields } from '../../server/nodes/BlocksNode.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport { BlockContent } from './BlockContent.js'\nimport './index.scss'\n\ntype Props = {\n readonly children?: React.ReactNode\n readonly formData: BlockFields\n readonly nodeKey?: string\n}\n\nexport const BlockComponent: React.FC<Props> = (props) => {\n const { formData, nodeKey } = props\n const { config } = useConfig()\n const submitted = useFormSubmitted()\n const { id } = useDocumentInfo()\n const { path, schemaPath } = useFieldProps()\n const { field: parentLexicalRichTextField } = useEditorConfigContext()\n\n const [initialState, setInitialState] = useState<false | FormState>(false)\n const {\n field: { richTextComponentMap },\n } = useEditorConfigContext()\n\n const schemaFieldsPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_blocks.lexical_blocks.${formData.blockType}`\n\n const componentMapRenderedBlockPath = `lexical_internal_feature.blocks.fields.lexical_blocks`\n const blocksField: BlocksFieldClient = richTextComponentMap.get(componentMapRenderedBlockPath)[0]\n\n const clientBlock = blocksField.blocks.find((block) => block.slug === formData.blockType)\n\n // Field Schema\n useEffect(() => {\n const awaitInitialState = async () => {\n const state = await getFormState({\n apiRoute: config.routes.api,\n body: {\n id,\n data: formData,\n operation: 'update',\n schemaPath: schemaFieldsPath,\n },\n serverURL: config.serverURL,\n })\n\n if (state) {\n state.blockName = {\n initialValue: '',\n passesCondition: true,\n valid: true,\n value: formData.blockName,\n }\n\n setInitialState(state)\n }\n }\n\n if (formData) {\n void awaitInitialState()\n }\n }, [config.routes.api, config.serverURL, schemaFieldsPath, id]) // DO NOT ADD FORMDATA HERE! Adding formData will kick you out of sub block editors while writing.\n\n const onChange: FormProps['onChange'][0] = useCallback(\n async ({ formState: prevFormState }) => {\n const formState = await getFormState({\n apiRoute: config.routes.api,\n body: {\n id,\n formState: prevFormState,\n operation: 'update',\n schemaPath: schemaFieldsPath,\n },\n serverURL: config.serverURL,\n })\n\n formState.blockName = {\n initialValue: '',\n passesCondition: true,\n valid: true,\n value: formData.blockName,\n }\n\n return formState\n },\n\n [config.routes.api, config.serverURL, id, schemaFieldsPath, formData.blockName],\n )\n const { i18n } = useTranslation()\n\n const classNames = [`${baseClass}__row`, `${baseClass}__row--no-errors`].filter(Boolean).join(' ')\n\n // Memoized Form JSX\n const formContent = useMemo(() => {\n return clientBlock && initialState !== false ? (\n <Form\n beforeSubmit={[onChange]}\n fields={clientBlock.fields}\n initialState={initialState}\n onChange={[onChange]}\n submitted={submitted}\n uuid={uuid()}\n >\n <BlockContent\n baseClass={baseClass}\n clientBlock={clientBlock}\n field={parentLexicalRichTextField}\n formData={formData}\n formSchema={clientBlock.fields}\n nodeKey={nodeKey}\n path={`${path}.lexical_internal_feature.blocks.${formData.blockType}`}\n schemaPath={schemaFieldsPath}\n />\n </Form>\n ) : (\n <Collapsible\n className={classNames}\n collapsibleStyle=\"default\"\n header={\n clientBlock?.admin?.components?.Label ? (\n <RenderComponent\n clientProps={{ blockKind: 'lexicalBlock', formData }}\n mappedComponent={clientBlock.admin.components.Label}\n />\n ) : (\n <div className={`${baseClass}__block-header`}>\n <div>\n <Pill\n className={`${baseClass}__block-pill ${baseClass}__block-pill-${formData?.blockType}`}\n pillStyle=\"white\"\n >\n {clientBlock && typeof clientBlock.labels.singular === 'string'\n ? getTranslation(clientBlock.labels.singular, i18n)\n : clientBlock.slug}\n </Pill>\n <SectionTitle\n path=\"blockName\"\n readOnly={parentLexicalRichTextField?.admin?.readOnly}\n />\n </div>\n </div>\n )\n }\n key={0}\n >\n <ShimmerEffect height=\"35vh\" />\n </Collapsible>\n )\n }, [\n clientBlock,\n initialState,\n onChange,\n submitted,\n parentLexicalRichTextField,\n nodeKey,\n path,\n schemaFieldsPath,\n classNames,\n i18n,\n ])\n\n return <div className={baseClass + ' ' + baseClass + '-' + formData.blockType}>{formContent}</div>\n}\n", "'use client'\nimport type { ClientBlock, ClientField, CollapsedPreferences, FormState } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n Collapsible,\n ErrorPill,\n Pill,\n RenderComponent,\n RenderFields,\n SectionTitle,\n useDocumentInfo,\n useFormSubmitted,\n useTranslation,\n} from '@payloadcms/ui'\nimport { dequal } from 'dequal/lite'\nimport { $getNodeByKey } from 'lexical'\nimport React, { useCallback } from 'react'\n\nimport type { LexicalRichTextFieldProps } from '../../../../types.js'\nimport type { BlockFields } from '../../server/nodes/BlocksNode.js'\nimport type { BlockNode } from '../nodes/BlocksNode.js'\n\nimport { FormSavePlugin } from './FormSavePlugin.js'\n\ntype Props = {\n baseClass: string\n clientBlock: ClientBlock\n field: LexicalRichTextFieldProps['field']\n formData: BlockFields\n formSchema: ClientField[]\n nodeKey: string\n path: string\n schemaPath: string\n}\n\n// Recursively remove all undefined values from even being present in formData, as they will\n// cause isDeepEqual to return false if, for example, formData has a key that fields.data\n// does not have, even if it's undefined.\n// Currently, this happens if a block has another sub-blocks field. Inside formData, that sub-blocks field has an undefined blockName property.\n// Inside of fields.data however, that sub-blocks blockName property does not exist at all.\nfunction removeUndefinedAndNullAndEmptyArraysRecursively(obj: object) {\n for (const key in obj) {\n const value = obj[key]\n if (Array.isArray(value) && !value?.length) {\n delete obj[key]\n } else if (value && typeof value === 'object') {\n removeUndefinedAndNullAndEmptyArraysRecursively(value)\n } else if (value === undefined || value === null) {\n delete obj[key]\n }\n }\n}\n\n/**\n * The actual content of the Block. This should be INSIDE a Form component,\n * scoped to the block. All format operations in here are thus scoped to the block's form, and\n * not the whole document.\n */\nexport const BlockContent: React.FC<Props> = (props) => {\n const { baseClass, clientBlock, field, formSchema, nodeKey, schemaPath } = props\n let { formData } = props\n\n const { i18n } = useTranslation()\n const [editor] = useLexicalComposerContext()\n // Used for saving collapsed to preferences (and gettin' it from there again)\n // Remember, these preferences are scoped to the whole document, not just this form. This\n // is important to consider for the data path used in setDocFieldPreferences\n const { getDocPreferences, setDocFieldPreferences } = useDocumentInfo()\n\n const [isCollapsed, setIsCollapsed] = React.useState<boolean>(() => {\n let initialState = false\n\n void getDocPreferences().then((currentDocPreferences) => {\n const currentFieldPreferences = currentDocPreferences?.fields[field.name]\n\n const collapsedArray = currentFieldPreferences?.collapsed\n\n if (collapsedArray && collapsedArray.includes(formData.id)) {\n initialState = true\n setIsCollapsed(true)\n }\n })\n return initialState\n })\n\n const hasSubmitted = useFormSubmitted()\n\n const [errorCount, setErrorCount] = React.useState(0)\n\n const fieldHasErrors = hasSubmitted && errorCount > 0\n\n const classNames = [\n `${baseClass}__row`,\n fieldHasErrors ? `${baseClass}__row--has-errors` : `${baseClass}__row--no-errors`,\n ]\n .filter(Boolean)\n .join(' ')\n\n const onFormChange = useCallback(\n ({\n fullFieldsWithValues,\n newFormData,\n }: {\n fullFieldsWithValues: FormState\n newFormData: BlockFields\n }) => {\n newFormData.id = formData.id\n newFormData.blockType = formData.blockType\n\n removeUndefinedAndNullAndEmptyArraysRecursively(newFormData)\n removeUndefinedAndNullAndEmptyArraysRecursively(formData)\n\n // Only update if the data has actually changed. Otherwise, we may be triggering an unnecessary value change,\n // which would trigger the \"Leave without saving\" dialog unnecessarily\n if (!dequal(formData, newFormData)) {\n // Running this in the next tick in the meantime fixes this issue: https://github.com/payloadcms/payload/issues/4108\n // I don't know why. When this is called immediately, it might focus out of a nested lexical editor field if an update is made there.\n // My hypothesis is that the nested editor might not have fully finished its update cycle yet. By updating in the next tick, we\n // ensure that the nested editor has finished its update cycle before we update the block node.\n setTimeout(() => {\n editor.update(() => {\n const node: BlockNode = $getNodeByKey(nodeKey)\n if (node) {\n formData = newFormData\n node.setFields(newFormData)\n }\n })\n }, 0)\n }\n\n // update error count\n if (hasSubmitted) {\n let rowErrorCount = 0\n for (const formField of Object.values(fullFieldsWithValues)) {\n if (formField?.valid === false) {\n rowErrorCount++\n }\n }\n setErrorCount(rowErrorCount)\n }\n },\n [editor, nodeKey, hasSubmitted, formData],\n )\n\n const onCollapsedChange = useCallback(\n (changedCollapsed: boolean) => {\n void getDocPreferences().then((currentDocPreferences) => {\n const currentFieldPreferences = currentDocPreferences?.fields[field.name]\n\n const collapsedArray = currentFieldPreferences?.collapsed\n\n const newCollapsed: CollapsedPreferences =\n collapsedArray && collapsedArray?.length ? collapsedArray : []\n\n if (changedCollapsed) {\n if (!newCollapsed.includes(formData.id)) {\n newCollapsed.push(formData.id)\n }\n } else {\n if (newCollapsed.includes(formData.id)) {\n newCollapsed.splice(newCollapsed.indexOf(formData.id), 1)\n }\n }\n\n setDocFieldPreferences(field.name, {\n collapsed: newCollapsed,\n hello: 'hi',\n })\n })\n },\n [getDocPreferences, field.name, setDocFieldPreferences, formData.id],\n )\n\n const removeBlock = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey).remove()\n })\n }, [editor, nodeKey])\n\n return (\n <React.Fragment>\n <Collapsible\n className={classNames}\n collapsibleStyle={fieldHasErrors ? 'error' : 'default'}\n header={\n clientBlock?.admin?.components?.Label ? (\n <RenderComponent\n clientProps={{ blockKind: 'lexicalBlock', formData }}\n mappedComponent={clientBlock.admin.components.Label}\n />\n ) : (\n <div className={`${baseClass}__block-header`}>\n <div>\n <Pill\n className={`${baseClass}__block-pill ${baseClass}__block-pill-${formData?.blockType}`}\n pillStyle=\"white\"\n >\n {typeof clientBlock?.labels.singular === 'string'\n ? getTranslation(clientBlock?.labels.singular, i18n)\n : clientBlock.slug}\n </Pill>\n <SectionTitle path=\"blockName\" readOnly={field?.admin?.readOnly} />\n {fieldHasErrors && <ErrorPill count={errorCount} i18n={i18n} withMessage />}\n </div>\n {editor.isEditable() && (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__removeButton`}\n disabled={field?.admin?.readOnly}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeBlock()\n }}\n round\n tooltip=\"Remove Block\"\n />\n )}\n </div>\n )\n }\n isCollapsed={isCollapsed}\n key={0}\n onToggle={(incomingCollapsedState) => {\n onCollapsedChange(incomingCollapsedState)\n setIsCollapsed(incomingCollapsedState)\n }}\n >\n <RenderFields\n className={`${baseClass}__fields`}\n fields={formSchema}\n forceRender\n margins=\"small\"\n path=\"\" // Leaving path empty makes it so field values are not prefixed / scoped by the entire schemaPath. e.g. we can access \"myField\" instead of \"someLexicalField.feature.blocks.someArrayB\" // TODO: Could there be any implications leaving path different than schemaPath?\n readOnly={false}\n schemaPath={schemaPath} // Having the correct schemaPath here allows sub-fields (like array > addRow) to run correct form-state calls and retrieve their needed form state from the server\n />\n </Collapsible>\n\n <FormSavePlugin onChange={onFormChange} />\n </React.Fragment>\n )\n}\n", "'use client'\nimport type { Data, FormState } from 'payload'\nimport type React from 'react'\n\nimport { useAllFormFields } from '@payloadcms/ui'\nimport { reduceFieldsToValues } from 'payload/shared'\nimport { useEffect } from 'react'\n\nimport { removeEmptyArrayValues } from './removeEmptyArrayValues.js'\n\ntype Props = {\n onChange?: ({\n fullFieldsWithValues,\n newFormData,\n }: {\n fullFieldsWithValues: FormState\n newFormData: Data\n }) => void\n}\n\nexport const FormSavePlugin: React.FC<Props> = (props) => {\n const { onChange } = props\n\n const [_fields] = useAllFormFields()\n\n const fields = removeEmptyArrayValues({ fields: _fields })\n\n // Pass in fields, and indicate if you'd like to \"unflatten\" field data.\n // The result below will reflect the data stored in the form at the given time\n const newFormData = reduceFieldsToValues(fields, true)\n\n useEffect(() => {\n if (onChange) {\n onChange({ fullFieldsWithValues: fields, newFormData })\n }\n }, [newFormData, onChange, fields])\n\n return null\n}\n", "'use client'\nimport type { FormState } from 'payload'\n\n/**\n * By default, if an array field is empty, it will be included in the form state with a value of 0.\n * We do not need this behavior here, By setting `disableFormData` to true, we can prevent the field from being included in the form state\n * like that.\n * @param fields form state\n */\nexport function removeEmptyArrayValues({ fields }: { fields: FormState }): FormState {\n for (const key in fields) {\n const field = fields[key]\n if (Array.isArray(field.rows) && 'value' in field) {\n field.disableFormData = true\n }\n }\n return fields\n}\n"],
5
+ "mappings": "wGAIA,OACEA,eAAAA,GACAC,QAAAA,GACAC,QAAAA,GACAC,mBAAAA,GACAC,gBAAAA,GACAC,iBAAAA,GACAC,aAAAA,GACAC,mBAAAA,GACAC,iBAAAA,GACAC,oBAAAA,GACAC,kBAAAA,OACK,iBACP,OAAgBC,eAAAA,GAAaC,aAAAA,GAAWC,WAAAA,GAASC,YAAAA,OAAgB,QAKjE,OAASC,kBAAAA,OAAsB,2BAC/B,OAASC,gBAAAA,MAAoB,wBAC7B,OAASC,MAAMC,OAAY,yDCrB3B,OAASC,6BAAAA,MAAiC,2CAC1C,OAASC,kBAAAA,MAAsB,2BAC/B,OACEC,UAAAA,EACAC,eAAAA,EACAC,aAAAA,EACAC,QAAAA,EACAC,mBAAAA,EACAC,gBAAAA,EACAC,gBAAAA,EACAC,mBAAAA,EACAC,oBAAAA,GACAC,kBAAAA,OACK,iBACP,OAASC,UAAAA,OAAc,cACvB,OAASC,iBAAAA,MAAqB,UAC9B,OAAOC,GAASC,eAAAA,MAAmB,QCnBnC,OAAAC,KAAAC,MAAA,yBAIA,OAASC,oBAAAA,MAAwB,iBACjC,OAASC,wBAAAA,MAA4B,iBACrC,OAASC,aAAAA,MAAiB,QCGnB,SAASC,EAAuB,CAAEC,OAAAA,CAAM,EAAyB,CACtE,QAAWC,KAAOD,EAAQ,CACxB,IAAME,EAAQF,EAAOC,CAAA,EACjBE,MAAMC,QAAQF,EAAMG,IAAI,GAAK,UAAWH,IAC1CA,EAAMI,gBAAkB,GAE5B,CACA,OAAON,CACT,CDG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AaA,EACbT,MAAOC,EACPZ,SAAUA,EACV2D,WAAYvC,EAAYoC,OACxBvD,QAASA,EACTO,KAAM,GAAGA,CAAA,oCAAwCR,EAASmB,SAAS,GACnEV,WAAYS,MAIhBmC,EAACO,GAAA,CACCC,UAAWd,EACXe,iBAAiB,UACjBC,OACE3C,GAAa4C,OAAOC,YAAYC,MAC9Bb,EAACc,GAAA,CACCC,YAAa,CAAEC,UAAW,eAAgBrE,SAAAA,CAAS,EACnDsE,gBAAiBlD,EAAY4C,MAAMC,WAAWC,QAGhDb,EAAC,MAAA,CAAIQ,UAAW,GAAGhE,CAAA,0BACjB0E,GAAC,MAAA,WACClB,EAACmB,GAAA,CACCX,UAAW,GAAGhE,CAAA,gBAAyBA,CAAA,gBAAyBG,GAAUmB,SAAA,GAC1EsD,UAAU,iBAETrD,GAAe,OAAOA,EAAYsD,OAAOC,UAAa,SACnDC,GAAexD,EAAYsD,OAAOC,SAAU9B,CAAA,EAC5CzB,EAAYK,OAElB4B,EAACwB,GAAA,CACCrE,KAAK,YACLsE,SAAUlE,GAA4BoD,OAAOc,yBAQvDzB,EAAC0B,GAAA,CAAcC,OAAO,UAFjB,CAAA,EAKR,CACD5D,EACAN,EACA2B,EACArC,EACAQ,EACAX,EACAO,EACAU,EACA6B,EACAF,CAAA,CACD,EAED,OAAOQ,EAAC,MAAA,CAAIQ,UAAWhE,EAAY,IAAMA,EAAY,IAAMG,EAASmB,mBAAYgC,GAClF",
6
+ "names": ["Collapsible", "Form", "Pill", "RenderComponent", "SectionTitle", "ShimmerEffect", "useConfig", "useDocumentInfo", "useFieldProps", "useFormSubmitted", "useTranslation", "useCallback", "useEffect", "useMemo", "useState", "getTranslation", "getFormState", "v4", "uuid", "useLexicalComposerContext", "getTranslation", "Button", "Collapsible", "ErrorPill", "Pill", "RenderComponent", "RenderFields", "SectionTitle", "useDocumentInfo", "useFormSubmitted", "useTranslation", "dequal", "$getNodeByKey", "React", "useCallback", "c", "_c", "useAllFormFields", "reduceFieldsToValues", "useEffect", "removeEmptyArrayValues", "fields", "key", "field", "Array", "isArray", "rows", "disableFormData", "FormSavePlugin", "props", "$", "_c", "onChange", "_fields", "useAllFormFields", "t0", "fields", "removeEmptyArrayValues", "reduceFieldsToValues", "newFormData", "t1", "t2", "fullFieldsWithValues", "useEffect", "removeUndefinedAndNullAndEmptyArraysRecursively", "obj", "key", "value", "Array", "isArray", "length", "BlockContent", "props", "baseClass", "clientBlock", "field", "formSchema", "nodeKey", "schemaPath", "formData", "i18n", "useTranslation", "editor", "useLexicalComposerContext", "getDocPreferences", "setDocFieldPreferences", "useDocumentInfo", "isCollapsed", "setIsCollapsed", "React", "useState", "initialState", "then", "currentDocPreferences", "collapsedArray", "fields", "name", "collapsed", "includes", "id", "hasSubmitted", "useFormSubmitted", "errorCount", "setErrorCount", "fieldHasErrors", "classNames", "filter", "Boolean", "join", "onFormChange", "useCallback", "fullFieldsWithValues", "newFormData", "blockType", "dequal", "setTimeout", "update", "node", "$getNodeByKey", "setFields", "rowErrorCount", "formField", "Object", "values", "valid", "onCollapsedChange", "changedCollapsed", "newCollapsed", "push", "splice", "indexOf", "hello", "removeBlock", "remove", "_jsxs", "Fragment", "_jsx", "Collapsible", "className", "collapsibleStyle", "header", "admin", "components", "Label", "RenderComponent", "clientProps", "blockKind", "mappedComponent", "Pill", "pillStyle", "labels", "singular", "getTranslation", "slug", "SectionTitle", "path", "readOnly", "ErrorPill", "count", "withMessage", "isEditable", "Button", "buttonStyle", "disabled", "icon", "onClick", "e", "preventDefault", "round", "tooltip", "onToggle", "incomingCollapsedState", "RenderFields", "forceRender", "margins", "FormSavePlugin", "onChange", "baseClass", "BlockComponent", "props", "formData", "nodeKey", "config", "useConfig", "submitted", "useFormSubmitted", "id", "useDocumentInfo", "path", "schemaPath", "useFieldProps", "field", "parentLexicalRichTextField", "useEditorConfigContext", "initialState", "setInitialState", "useState", "richTextComponentMap", "schemaFieldsPath", "blockType", "clientBlock", "get", "blocks", "find", "block", "slug", "useEffect", "state", "getFormState", "apiRoute", "routes", "api", "body", "data", "operation", "serverURL", "blockName", "initialValue", "passesCondition", "valid", "value", "onChange", "useCallback", "formState", "prevFormState", "i18n", "useTranslation", "classNames", "filter", "Boolean", "join", "formContent", "useMemo", "_jsx", "Form", "beforeSubmit", "fields", "uuid", "BlockContent", "formSchema", "Collapsible", "className", "collapsibleStyle", "header", "admin", "components", "Label", "RenderComponent", "clientProps", "blockKind", "mappedComponent", "_jsxs", "Pill", "pillStyle", "labels", "singular", "getTranslation", "SectionTitle", "readOnly", "ShimmerEffect", "height"]
7
+ }
@@ -1,2 +1,2 @@
1
- "use client";import{c as N,f as x}from"./chunk-7UTZDNYS.js";import{b as p}from"./chunk-TXEIKM77.js";import{jsx as a,jsxs as E}from"react/jsx-runtime";import{useCallback as f,useEffect as I,useRef as K}from"react";import{useLexicalComposerContext as L}from"@lexical/react/LexicalComposerContext";import{useLexicalNodeSelection as S}from"@lexical/react/useLexicalNodeSelection";import{mergeRegister as $}from"@lexical/utils";import{getTranslation as M}from"@payloadcms/translations";import{Button as v,RenderComponent as h,useTranslation as A}from"@payloadcms/ui";import{$getNodeByKey as D,$getSelection as T,$isNodeSelection as P,CLICK_COMMAND as j,COMMAND_PRIORITY_LOW as b,KEY_BACKSPACE_COMMAND as Y,KEY_DELETE_COMMAND as z}from"lexical";var s="inline-block",le=y=>{let{formData:r,nodeKey:o}=y,[e]=L(),{i18n:C,t:k}=A(),{field:_}=p(),m=K(null),[l,c,d]=S(o),{field:{richTextComponentMap:O}}=p(),t=O.get("lexical_internal_feature.blocks.fields.lexical_inline_blocks")[0].blocks.find(n=>n.slug===r.blockType),R=f(()=>{e.update(()=>{D(o).remove()})},[e,o]),u=f(n=>{if(l&&P(T())){n.preventDefault();let i=D(o);if(x(i))return i.remove(),!0}return!1},[l,o]),g=f(n=>{let i=n;return i.target===m.current||m.current?.contains(i.target)?(i.shiftKey?c(!l):l||(d(),c(!0)),!0):!1},[l,c,d]);I(()=>$(e.registerCommand(j,g,b),e.registerCommand(z,u,b),e.registerCommand(Y,u,b)),[d,e,l,o,u,c,g]);let B=t?.labels?.singular?M(t.labels.singular,C):t.slug;return E("div",{className:[s,s+"-"+r.blockType,l&&`${s}--selected`].filter(Boolean).join(" "),ref:m,children:[t?.admin?.components?.Label?a(h,{clientProps:{blockKind:"lexicalInlineBlock",formData:r},mappedComponent:t.admin.components.Label}):a("div",{children:M(t.labels?.singular,C)}),e.isEditable()&&E("div",{className:`${s}__actions`,children:[a(v,{buttonStyle:"icon-label",className:`${s}__editButton`,disabled:_?.admin?.readOnly,el:"div",icon:"edit",onClick:()=>{e.dispatchCommand(N,{fields:r,nodeKey:o})},round:!0,size:"small",tooltip:k("lexical:blocks:inlineBlocks:edit",{label:B})}),a(v,{buttonStyle:"icon-label",className:`${s}__removeButton`,disabled:_?.admin?.readOnly,icon:"x",onClick:n=>{n.preventDefault(),R()},round:!0,size:"small",tooltip:k("lexical:blocks:inlineBlocks:remove",{label:B})})]})]})};export{le as InlineBlockComponent};
2
- //# sourceMappingURL=componentInline-JLMSR7BP.js.map
1
+ "use client";import{c as N,f as x}from"./chunk-PY6JO5OH.js";import{b as p}from"./chunk-TXEIKM77.js";import{jsx as a,jsxs as E}from"react/jsx-runtime";import{useCallback as f,useEffect as I,useRef as K}from"react";import{useLexicalComposerContext as L}from"@lexical/react/LexicalComposerContext";import{useLexicalNodeSelection as S}from"@lexical/react/useLexicalNodeSelection";import{mergeRegister as $}from"@lexical/utils";import{getTranslation as M}from"@payloadcms/translations";import{Button as v,RenderComponent as h,useTranslation as A}from"@payloadcms/ui";import{$getNodeByKey as D,$getSelection as T,$isNodeSelection as P,CLICK_COMMAND as j,COMMAND_PRIORITY_LOW as b,KEY_BACKSPACE_COMMAND as Y,KEY_DELETE_COMMAND as z}from"lexical";var s="inline-block",le=y=>{let{formData:r,nodeKey:o}=y,[e]=L(),{i18n:C,t:k}=A(),{field:_}=p(),m=K(null),[l,c,d]=S(o),{field:{richTextComponentMap:O}}=p(),t=O.get("lexical_internal_feature.blocks.fields.lexical_inline_blocks")[0].blocks.find(n=>n.slug===r.blockType),R=f(()=>{e.update(()=>{D(o).remove()})},[e,o]),u=f(n=>{if(l&&P(T())){n.preventDefault();let i=D(o);if(x(i))return i.remove(),!0}return!1},[l,o]),g=f(n=>{let i=n;return i.target===m.current||m.current?.contains(i.target)?(i.shiftKey?c(!l):l||(d(),c(!0)),!0):!1},[l,c,d]);I(()=>$(e.registerCommand(j,g,b),e.registerCommand(z,u,b),e.registerCommand(Y,u,b)),[d,e,l,o,u,c,g]);let B=t?.labels?.singular?M(t.labels.singular,C):t.slug;return E("div",{className:[s,s+"-"+r.blockType,l&&`${s}--selected`].filter(Boolean).join(" "),ref:m,children:[t?.admin?.components?.Label?a(h,{clientProps:{blockKind:"lexicalInlineBlock",formData:r},mappedComponent:t.admin.components.Label}):a("div",{children:M(t.labels?.singular,C)}),e.isEditable()&&E("div",{className:`${s}__actions`,children:[a(v,{buttonStyle:"icon-label",className:`${s}__editButton`,disabled:_?.admin?.readOnly,el:"div",icon:"edit",onClick:()=>{e.dispatchCommand(N,{fields:r,nodeKey:o})},round:!0,size:"small",tooltip:k("lexical:blocks:inlineBlocks:edit",{label:B})}),a(v,{buttonStyle:"icon-label",className:`${s}__removeButton`,disabled:_?.admin?.readOnly,icon:"x",onClick:n=>{n.preventDefault(),R()},round:!0,size:"small",tooltip:k("lexical:blocks:inlineBlocks:remove",{label:B})})]})]})};export{le as InlineBlockComponent};
2
+ //# sourceMappingURL=componentInline-HAGGWKA7.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/features/blocks/client/componentInline/index.tsx"],
4
+ "sourcesContent": ["'use client'\n\nimport React, { useCallback, useEffect, useRef } from 'react'\nconst baseClass = 'inline-block'\n\nimport type { BlocksFieldClient } 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 { Button, RenderComponent, useTranslation } from '@payloadcms/ui'\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'\n\nimport type { InlineBlockFields } from '../nodes/InlineBlocksNode.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport { $isInlineBlockNode } from '../nodes/InlineBlocksNode.js'\nimport { OPEN_INLINE_BLOCK_DRAWER_COMMAND } from '../plugin/commands.js'\nimport './index.scss'\n\ntype Props = {\n readonly formData: InlineBlockFields\n readonly nodeKey?: string\n}\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 { field } = useEditorConfigContext()\n const inlineBlockElemElemRef = useRef<HTMLDivElement | null>(null)\n const [isSelected, setSelected, clearSelection] = useLexicalNodeSelection(nodeKey)\n\n const {\n field: { richTextComponentMap },\n } = useEditorConfigContext()\n\n const componentMapRenderedBlockPath = `lexical_internal_feature.blocks.fields.lexical_inline_blocks`\n const blocksField: BlocksFieldClient = richTextComponentMap.get(componentMapRenderedBlockPath)[0]\n const clientBlock = blocksField.blocks.find((block) => block.slug === formData.blockType)\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 if (isSelected && $isNodeSelection($getSelection())) {\n event.preventDefault()\n const node = $getNodeByKey(nodeKey)\n if ($isInlineBlockNode(node)) {\n node.remove()\n return true\n }\n }\n return false\n },\n [isSelected, nodeKey],\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 return (\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 {clientBlock?.admin?.components?.Label ? (\n <RenderComponent\n clientProps={{ blockKind: 'lexicalInlineBlock', formData }}\n mappedComponent={clientBlock.admin.components.Label}\n />\n ) : (\n <div>{getTranslation(clientBlock.labels?.singular, i18n)}</div>\n )}\n {editor.isEditable() && (\n <div className={`${baseClass}__actions`}>\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__editButton`}\n disabled={field?.admin?.readOnly}\n el=\"div\"\n icon=\"edit\"\n onClick={() => {\n editor.dispatchCommand(OPEN_INLINE_BLOCK_DRAWER_COMMAND, {\n fields: formData,\n nodeKey,\n })\n }}\n round\n size=\"small\"\n tooltip={t('lexical:blocks:inlineBlocks:edit', { label: blockDisplayName })}\n />\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__removeButton`}\n disabled={field?.admin?.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 </div>\n )}\n </div>\n )\n}\n"],
5
+ "mappings": "sJAEA,OAAgBA,eAAAA,EAAaC,aAAAA,EAAWC,UAAAA,MAAc,QAKtD,OAASC,6BAAAA,MAAiC,wCAC1C,OAASC,2BAAAA,MAA+B,yCACxC,OAASC,iBAAAA,MAAqB,iBAC9B,OAASC,kBAAAA,MAAsB,2BAC/B,OAASC,UAAAA,EAAQC,mBAAAA,EAAiBC,kBAAAA,MAAsB,iBACxD,OACEC,iBAAAA,EACAC,iBAAAA,EACAC,oBAAAA,EACAC,iBAAAA,EACAC,wBAAAA,EACAC,yBAAAA,EACAC,sBAAAA,MACK,UAjBP,IAAMC,EAAY,eA+BLC,GAAyCC,GAAA,CACpD,GAAM,CAAEC,SAAAA,EAAUC,QAAAA,CAAO,EAAKF,EACxB,CAACG,CAAA,EAAUC,EAAA,EACX,CAAEC,KAAAA,EAAMC,EAAAA,CAAC,EAAKC,EAAA,EACd,CAAEC,MAAAA,CAAK,EAAKC,EAAA,EACZC,EAAyBC,EAA8B,IAAA,EACvD,CAACC,EAAYC,EAAaC,CAAA,EAAkBC,EAAwBb,CAAA,EAEpE,CACJM,MAAO,CAAEQ,qBAAAA,CAAoB,CAAE,EAC7BP,EAAA,EAIEQ,EADiCD,EAAqBE,IADtB,8DAC0B,EAA+B,CAAA,EAC/DC,OAAOC,KAAMC,GAAUA,EAAMC,OAASrB,EAASsB,SAAS,EAElFC,EAAoBC,EAAY,IAAA,CACpCtB,EAAOuB,OAAO,IAAA,CACZC,EAAczB,CAAA,EAAS0B,OAAM,CAC/B,CAAA,CACF,EAAG,CAACzB,EAAQD,CAAA,CAAQ,EAEd2B,EAAYJ,EACfK,GAAA,CACC,GAAIlB,GAAcmB,EAAiBC,EAAA,CAAA,EAAkB,CACnDF,EAAMG,eAAc,EACpB,IAAMC,EAAOP,EAAczB,CAAA,EAC3B,G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9D,GAAOmD,OAAOY,SACxBC,GAAG,MACHC,KAAK,OACLrC,QAASA,IAAA,CACPjC,EAAOuE,gBAAgBC,EAAkC,CACvDC,OAAQ3E,EACRC,QAAAA,CACF,CAAA,CACF,EACA2E,MAAK,GACLC,KAAK,QACLC,QAASzE,EAAE,mCAAoC,CAAE0E,MAAO/B,CAAiB,CAAA,IAE3Ea,EAACM,EAAA,CACCC,YAAY,aACZf,UAAW,GAAGxD,CAAA,iBACdwE,SAAU9D,GAAOmD,OAAOY,SACxBE,KAAK,IACLrC,QAAU6C,GAAA,CACRA,EAAEhD,eAAc,EAChBT,EAAA,CACF,EACAqD,MAAK,GACLC,KAAK,QACLC,QAASzE,EAAE,qCAAsC,CAAE0E,MAAO/B,CAAiB,CAAA,SAMvF",
6
+ "names": ["useCallback", "useEffect", "useRef", "useLexicalComposerContext", "useLexicalNodeSelection", "mergeRegister", "getTranslation", "Button", "RenderComponent", "useTranslation", "$getNodeByKey", "$getSelection", "$isNodeSelection", "CLICK_COMMAND", "COMMAND_PRIORITY_LOW", "KEY_BACKSPACE_COMMAND", "KEY_DELETE_COMMAND", "baseClass", "InlineBlockComponent", "props", "formData", "nodeKey", "editor", "useLexicalComposerContext", "i18n", "t", "useTranslation", "field", "useEditorConfigContext", "inlineBlockElemElemRef", "useRef", "isSelected", "setSelected", "clearSelection", "useLexicalNodeSelection", "richTextComponentMap", "clientBlock", "get", "blocks", "find", "block", "slug", "blockType", "removeInlineBlock", "useCallback", "update", "$getNodeByKey", "remove", "$onDelete", "event", "$isNodeSelection", "$getSelection", "preventDefault", "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", "_jsxs", "className", "filter", "Boolean", "join", "ref", "admin", "components", "Label", "_jsx", "RenderComponent", "clientProps", "blockKind", "mappedComponent", "isEditable", "Button", "buttonStyle", "disabled", "readOnly", "el", "icon", "dispatchCommand", "OPEN_INLINE_BLOCK_DRAWER_COMMAND", "fields", "round", "size", "tooltip", "label", "e"]
7
+ }
@@ -1,6 +1,6 @@
1
- "use client";import{a as vt,b as il,c as ll,d as sl,f as al,h as cl}from"./chunk-GK7ZKYHL.js";import{a as Ne,b as At,c as ke,d as Do,e as Oo}from"./chunk-7UTZDNYS.js";import{a as Le,b as Ye,c as Xe,d as Je}from"./chunk-PECDZEZY.js";import{a as Ie,b as Re,c as Se,d as Ft}from"./chunk-GTKNWSQW.js";import{a as ae,b as qe,c as ye,d as Me,e as ve,f as Dt}from"./chunk-366OGJYE.js";import{a as nl,b as $}from"./chunk-TXEIKM77.js";function G(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{jsx as ul}from"react/jsx-runtime";import{createHeadlessEditor as dl}from"@lexical/headless";import{useTableCell as ml}from"@payloadcms/ui";import{$getRoot as pl}from"lexical";import fl,{useEffect as hl,useMemo as gl}from"react";var Po={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",codeHighlight:{atrule:"LexicalEditorTheme__tokenAttr",attr:"LexicalEditorTheme__tokenAttr",boolean:"LexicalEditorTheme__tokenProperty",builtin:"LexicalEditorTheme__tokenSelector",cdata:"LexicalEditorTheme__tokenComment",char:"LexicalEditorTheme__tokenSelector",class:"LexicalEditorTheme__tokenFunction","class-name":"LexicalEditorTheme__tokenFunction",comment:"LexicalEditorTheme__tokenComment",constant:"LexicalEditorTheme__tokenProperty",deleted:"LexicalEditorTheme__tokenProperty",doctype:"LexicalEditorTheme__tokenComment",entity:"LexicalEditorTheme__tokenOperator",function:"LexicalEditorTheme__tokenFunction",important:"LexicalEditorTheme__tokenVariable",inserted:"LexicalEditorTheme__tokenSelector",keyword:"LexicalEditorTheme__tokenAttr",namespace:"LexicalEditorTheme__tokenVariable",number:"LexicalEditorTheme__tokenProperty",operator:"LexicalEditorTheme__tokenOperator",prolog:"LexicalEditorTheme__tokenComment",property:"LexicalEditorTheme__tokenProperty",punctuation:"LexicalEditorTheme__tokenPunctuation",regex:"LexicalEditorTheme__tokenVariable",selector:"LexicalEditorTheme__tokenSelector",string:"LexicalEditorTheme__tokenSelector",symbol:"LexicalEditorTheme__tokenProperty",tag:"LexicalEditorTheme__tokenProperty",url:"LexicalEditorTheme__tokenOperator",variable:"LexicalEditorTheme__tokenVariable"},embedBlock:{base:"LexicalEditorTheme__embedBlock",focus:"LexicalEditorTheme__embedBlockFocus"},hashtag:"LexicalEditorTheme__hashtag",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",indent:"LexicalEditorTheme__indent",inlineImage:"LexicalEditor__inline-image",link:"LexicalEditorTheme__link",list:{checklist:"LexicalEditorTheme__checklist",listitem:"LexicalEditorTheme__listItem",listitemChecked:"LexicalEditorTheme__listItemChecked",listitemUnchecked:"LexicalEditorTheme__listItemUnchecked",nested:{listitem:"LexicalEditorTheme__nestedListItem"},olDepth:["LexicalEditorTheme__ol1","LexicalEditorTheme__ol2","LexicalEditorTheme__ol3","LexicalEditorTheme__ol4","LexicalEditorTheme__ol5"],ul:"LexicalEditorTheme__ul"},ltr:"LexicalEditorTheme__ltr",mark:"LexicalEditorTheme__mark",markOverlap:"LexicalEditorTheme__markOverlap",paragraph:"LexicalEditorTheme__paragraph",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",rtl:"LexicalEditorTheme__rtl",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellEditing:"LexicalEditorTheme__tableCellEditing",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellPrimarySelected:"LexicalEditorTheme__tableCellPrimarySelected",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableCellSortedIndicator:"LexicalEditorTheme__tableCellSortedIndicator",tableResizeRuler:"LexicalEditorTheme__tableCellResizeRuler",tableSelected:"LexicalEditorTheme__tableSelected",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"editor-upload"};var Ae={namespace:"lexical",theme:Po};function Qe({unSanitizedEditorConfig:t}){for(let r of t.features)if(!r?.clientFeatureProps?.featureKey||r?.clientFeatureProps?.order===void 0||r?.clientFeatureProps?.order===null)throw new Error("A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected.");t.features=t.features.sort((r,i)=>r.clientFeatureProps.order-i.clientFeatureProps.order);let e=new Map;for(let r of t.features)e.set(r.clientFeatureProps.featureKey,r);let o=new Map,n=0;for(let r of t.features){let i=typeof r.feature=="function"?r.feature({featureProviderMap:e,resolvedFeatures:o,unSanitizedEditorConfig:t}):r.feature;i.key=r.clientFeatureProps.featureKey,i.order=n,o.set(r.clientFeatureProps.featureKey,i),n++}return o}var $o=t=>{let e={enabledFeatures:[],hooks:{load:[],save:[]},markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}};if(!t?.size)return e;t.forEach(o=>{if(o.hooks&&(o.hooks?.load?.length&&(e.hooks.load=e.hooks.load.concat(o.hooks.load)),o.hooks?.save?.length&&(e.hooks.save=e.hooks.save.concat(o.hooks.save))),o.providers?.length&&(e.providers=e.providers.concat(o.providers)),o.nodes?.length&&(e.nodes=e.nodes.concat(o.nodes)),o.plugins?.length&&o.plugins.forEach((n,r)=>{e.plugins.push({clientProps:o.sanitizedClientFeatureProps,Component:n.Component,key:o.key+r,position:n.position})}),o.toolbarInline?.groups?.length)for(let n of o.toolbarInline.groups){let r=e.toolbarInline.groups.find(i=>i.key===n.key);r?e.toolbarInline.groups=e.toolbarInline.groups.filter(i=>i.key!==n.key):r={...n,items:[]},n?.items?.length&&(r.items=r.items.concat(n.items)),e.toolbarInline?.groups.push(r)}if(o.toolbarFixed?.groups?.length)for(let n of o.toolbarFixed.groups){let r=e.toolbarFixed.groups.find(i=>i.key===n.key);r?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(i=>i.key!==n.key):r={...n,items:[]},n?.items?.length&&(r.items=r.items.concat(n.items)),e.toolbarFixed?.groups.push(r)}if(o.slashMenu?.groups){o.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(o.slashMenu.dynamicGroups));for(let n of o.slashMenu.groups){let r=e.slashMenu.groups.find(i=>i.key===n.key);r?e.slashMenu.groups=e.slashMenu.groups.filter(i=>i.key!==n.key):r={...n,items:[]},n?.items?.length&&(r.items=r.items.concat(n.items)),e.slashMenu.groups.push(r)}}o.markdownTransformers?.length&&(e.markdownTransformers=e.markdownTransformers.concat(o.markdownTransformers)),e.enabledFeatures.push(o.key)}),e.toolbarInline.groups.sort((o,n)=>o.order&&n.order?o.order-n.order:o.order?-1:n.order?1:0),e.toolbarFixed.groups.sort((o,n)=>o.order&&n.order?o.order-n.order:o.order?-1:n.order?1:0);for(let o of e.toolbarInline.groups)o.items.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0);for(let o of e.toolbarFixed.groups)o.items.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0);return e};function Fe(t,e,o){return{admin:o,features:$o(t),lexical:e,resolvedFeatureMap:t}}var Cl=t=>{let{admin:e,field:{richTextComponentMap:o},lexicalEditorConfig:n}=t,[r,i]=fl.useState("Loading..."),{cellData:l}=ml(),s=gl(()=>{let a=o.get("features"),c=[];for(let m of a)c.push(m.clientFeature(m.clientFeatureProps));let u=n||Ae,d=Qe({unSanitizedEditorConfig:{features:c,lexical:u}});return Fe(d,u)},[o,n]);return s.admin=e,hl(()=>{let a=l;if(a==null||!s){i("");return}if(s?.features?.hooks?.load?.length&&s.features.hooks.load.forEach(d=>{a=d({incomingEditorState:a})}),!a||typeof a!="object"){i("");return}if(Array.isArray(a)&&!("root"in a)){i("");return}if("jsonContent"in a){i("");return}let c=dl({namespace:s.lexical.namespace,nodes:vt({editorConfig:s}),theme:s.lexical.theme});c.setEditorState(c.parseEditorState(a));let u=c.getEditorState().read(()=>pl().getTextContent())||"";i(u)},[l,s]),ul("span",{children:r})};import{$isElementNode as ie,$isRangeSelection as tt,FORMAT_ELEMENT_COMMAND as ot}from"lexical";import{jsx as Ot,jsxs as xl}from"react/jsx-runtime";import"react";var Ho=()=>xl("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:[Ot("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ot("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ot("path",{d:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Pt,jsxs as bl}from"react/jsx-runtime";import"react";var Bo=()=>bl("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:[Pt("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Pt("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Pt("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as $t,jsxs as _l}from"react/jsx-runtime";import"react";var et=()=>_l("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:[$t("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),$t("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),$t("path",{d:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Ht,jsxs as Tl}from"react/jsx-runtime";import"react";var jo=()=>Tl("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:[Ht("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ht("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ht("path",{d:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});var S=t=>o=>{let n={clientFeatureProps:o};if(typeof t=="function")n.feature=({featureProviderMap:r,resolvedFeatures:i,unSanitizedEditorConfig:l})=>{let s=t({featureProviderMap:r,props:o,resolvedFeatures:i,unSanitizedEditorConfig:l});return s.sanitizedClientFeatureProps===null&&(s.sanitizedClientFeatureProps=o),s};else{let r={...t};r.sanitizedClientFeatureProps=o,n.feature=r}return n};var Go=t=>({type:"dropdown",ChildComponent:et,items:t,key:"align",order:30});var Uo=[Go([{ChildComponent:et,isActive:({selection:t})=>{if(!tt(t))return!1;for(let e of t.getNodes()){if(ie(e)&&e.getFormatType()==="left")continue;let o=e.getParent();if(!(ie(o)&&o.getFormatType()==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(ot,"left")},order:1},{ChildComponent:Ho,isActive:({selection:t})=>{if(!tt(t))return!1;for(let e of t.getNodes()){if(ie(e)&&e.getFormatType()==="center")continue;let o=e.getParent();if(!(ie(o)&&o.getFormatType()==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(ot,"center")},order:2},{ChildComponent:jo,isActive:({selection:t})=>{if(!tt(t))return!1;for(let e of t.getNodes()){if(ie(e)&&e.getFormatType()==="right")continue;let o=e.getParent();if(!(ie(o)&&o.getFormatType()==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(ot,"right")},order:3},{ChildComponent:Bo,isActive:({selection:t})=>{if(!tt(t))return!1;for(let e of t.getNodes()){if(ie(e)&&e.getFormatType()==="justify")continue;let o=e.getParent();if(!(ie(o)&&o.getFormatType()==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(ot,"justify")},order:4}])],El=S({toolbarFixed:{groups:Uo},toolbarInline:{groups:Uo}});import{$createQuoteNode as Xo,$isQuoteNode as Zo,QuoteNode as Ll}from"@lexical/rich-text";import{$setBlocksType as Jo}from"@lexical/selection";import{$getSelection as qo,$isRangeSelection as Il}from"lexical";import{jsx as Wo}from"react/jsx-runtime";import"react";var Bt=()=>Wo("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:Wo("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 Vo}from"react/jsx-runtime";import"react";var De=()=>Vo("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:Vo("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 W=t=>({type:"dropdown",ChildComponent:De,items:t,key:"text",order:25});import{$createQuoteNode as wl,$isQuoteNode as Ko,QuoteNode as Nl}from"@lexical/rich-text";import{$createLineBreakNode as kl}from"lexical";var zo={type:"element",dependencies:[Nl],export:(t,e)=>{if(!Ko(t))return null;let o=e(t).split(`
1
+ "use client";import{a as vt,b as il,c as ll,d as sl,f as al,h as cl}from"./chunk-GK7ZKYHL.js";import{a as Ne,b as At,c as ke,d as Do,e as Oo}from"./chunk-PY6JO5OH.js";import{a as Le,b as Ye,c as Xe,d as Je}from"./chunk-PECDZEZY.js";import{a as Ie,b as Re,c as Se,d as Ft}from"./chunk-GTKNWSQW.js";import{a as ae,b as qe,c as ye,d as Me,e as ve,f as Dt}from"./chunk-366OGJYE.js";import{a as nl,b as $}from"./chunk-TXEIKM77.js";function G(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{jsx as ul}from"react/jsx-runtime";import{createHeadlessEditor as dl}from"@lexical/headless";import{useTableCell as ml}from"@payloadcms/ui";import{$getRoot as pl}from"lexical";import fl,{useEffect as hl,useMemo as gl}from"react";var Po={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",codeHighlight:{atrule:"LexicalEditorTheme__tokenAttr",attr:"LexicalEditorTheme__tokenAttr",boolean:"LexicalEditorTheme__tokenProperty",builtin:"LexicalEditorTheme__tokenSelector",cdata:"LexicalEditorTheme__tokenComment",char:"LexicalEditorTheme__tokenSelector",class:"LexicalEditorTheme__tokenFunction","class-name":"LexicalEditorTheme__tokenFunction",comment:"LexicalEditorTheme__tokenComment",constant:"LexicalEditorTheme__tokenProperty",deleted:"LexicalEditorTheme__tokenProperty",doctype:"LexicalEditorTheme__tokenComment",entity:"LexicalEditorTheme__tokenOperator",function:"LexicalEditorTheme__tokenFunction",important:"LexicalEditorTheme__tokenVariable",inserted:"LexicalEditorTheme__tokenSelector",keyword:"LexicalEditorTheme__tokenAttr",namespace:"LexicalEditorTheme__tokenVariable",number:"LexicalEditorTheme__tokenProperty",operator:"LexicalEditorTheme__tokenOperator",prolog:"LexicalEditorTheme__tokenComment",property:"LexicalEditorTheme__tokenProperty",punctuation:"LexicalEditorTheme__tokenPunctuation",regex:"LexicalEditorTheme__tokenVariable",selector:"LexicalEditorTheme__tokenSelector",string:"LexicalEditorTheme__tokenSelector",symbol:"LexicalEditorTheme__tokenProperty",tag:"LexicalEditorTheme__tokenProperty",url:"LexicalEditorTheme__tokenOperator",variable:"LexicalEditorTheme__tokenVariable"},embedBlock:{base:"LexicalEditorTheme__embedBlock",focus:"LexicalEditorTheme__embedBlockFocus"},hashtag:"LexicalEditorTheme__hashtag",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",indent:"LexicalEditorTheme__indent",inlineImage:"LexicalEditor__inline-image",link:"LexicalEditorTheme__link",list:{checklist:"LexicalEditorTheme__checklist",listitem:"LexicalEditorTheme__listItem",listitemChecked:"LexicalEditorTheme__listItemChecked",listitemUnchecked:"LexicalEditorTheme__listItemUnchecked",nested:{listitem:"LexicalEditorTheme__nestedListItem"},olDepth:["LexicalEditorTheme__ol1","LexicalEditorTheme__ol2","LexicalEditorTheme__ol3","LexicalEditorTheme__ol4","LexicalEditorTheme__ol5"],ul:"LexicalEditorTheme__ul"},ltr:"LexicalEditorTheme__ltr",mark:"LexicalEditorTheme__mark",markOverlap:"LexicalEditorTheme__markOverlap",paragraph:"LexicalEditorTheme__paragraph",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",rtl:"LexicalEditorTheme__rtl",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellEditing:"LexicalEditorTheme__tableCellEditing",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellPrimarySelected:"LexicalEditorTheme__tableCellPrimarySelected",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableCellSortedIndicator:"LexicalEditorTheme__tableCellSortedIndicator",tableResizeRuler:"LexicalEditorTheme__tableCellResizeRuler",tableSelected:"LexicalEditorTheme__tableSelected",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"editor-upload"};var Ae={namespace:"lexical",theme:Po};function Qe({unSanitizedEditorConfig:t}){for(let r of t.features)if(!r?.clientFeatureProps?.featureKey||r?.clientFeatureProps?.order===void 0||r?.clientFeatureProps?.order===null)throw new Error("A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected.");t.features=t.features.sort((r,i)=>r.clientFeatureProps.order-i.clientFeatureProps.order);let e=new Map;for(let r of t.features)e.set(r.clientFeatureProps.featureKey,r);let o=new Map,n=0;for(let r of t.features){let i=typeof r.feature=="function"?r.feature({featureProviderMap:e,resolvedFeatures:o,unSanitizedEditorConfig:t}):r.feature;i.key=r.clientFeatureProps.featureKey,i.order=n,o.set(r.clientFeatureProps.featureKey,i),n++}return o}var $o=t=>{let e={enabledFeatures:[],hooks:{load:[],save:[]},markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}};if(!t?.size)return e;t.forEach(o=>{if(o.hooks&&(o.hooks?.load?.length&&(e.hooks.load=e.hooks.load.concat(o.hooks.load)),o.hooks?.save?.length&&(e.hooks.save=e.hooks.save.concat(o.hooks.save))),o.providers?.length&&(e.providers=e.providers.concat(o.providers)),o.nodes?.length&&(e.nodes=e.nodes.concat(o.nodes)),o.plugins?.length&&o.plugins.forEach((n,r)=>{e.plugins.push({clientProps:o.sanitizedClientFeatureProps,Component:n.Component,key:o.key+r,position:n.position})}),o.toolbarInline?.groups?.length)for(let n of o.toolbarInline.groups){let r=e.toolbarInline.groups.find(i=>i.key===n.key);r?e.toolbarInline.groups=e.toolbarInline.groups.filter(i=>i.key!==n.key):r={...n,items:[]},n?.items?.length&&(r.items=r.items.concat(n.items)),e.toolbarInline?.groups.push(r)}if(o.toolbarFixed?.groups?.length)for(let n of o.toolbarFixed.groups){let r=e.toolbarFixed.groups.find(i=>i.key===n.key);r?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(i=>i.key!==n.key):r={...n,items:[]},n?.items?.length&&(r.items=r.items.concat(n.items)),e.toolbarFixed?.groups.push(r)}if(o.slashMenu?.groups){o.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(o.slashMenu.dynamicGroups));for(let n of o.slashMenu.groups){let r=e.slashMenu.groups.find(i=>i.key===n.key);r?e.slashMenu.groups=e.slashMenu.groups.filter(i=>i.key!==n.key):r={...n,items:[]},n?.items?.length&&(r.items=r.items.concat(n.items)),e.slashMenu.groups.push(r)}}o.markdownTransformers?.length&&(e.markdownTransformers=e.markdownTransformers.concat(o.markdownTransformers)),e.enabledFeatures.push(o.key)}),e.toolbarInline.groups.sort((o,n)=>o.order&&n.order?o.order-n.order:o.order?-1:n.order?1:0),e.toolbarFixed.groups.sort((o,n)=>o.order&&n.order?o.order-n.order:o.order?-1:n.order?1:0);for(let o of e.toolbarInline.groups)o.items.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0);for(let o of e.toolbarFixed.groups)o.items.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0);return e};function Fe(t,e,o){return{admin:o,features:$o(t),lexical:e,resolvedFeatureMap:t}}var Cl=t=>{let{admin:e,field:{richTextComponentMap:o},lexicalEditorConfig:n}=t,[r,i]=fl.useState("Loading..."),{cellData:l}=ml(),s=gl(()=>{let a=o.get("features"),c=[];for(let m of a)c.push(m.clientFeature(m.clientFeatureProps));let u=n||Ae,d=Qe({unSanitizedEditorConfig:{features:c,lexical:u}});return Fe(d,u)},[o,n]);return s.admin=e,hl(()=>{let a=l;if(a==null||!s){i("");return}if(s?.features?.hooks?.load?.length&&s.features.hooks.load.forEach(d=>{a=d({incomingEditorState:a})}),!a||typeof a!="object"){i("");return}if(Array.isArray(a)&&!("root"in a)){i("");return}if("jsonContent"in a){i("");return}let c=dl({namespace:s.lexical.namespace,nodes:vt({editorConfig:s}),theme:s.lexical.theme});c.setEditorState(c.parseEditorState(a));let u=c.getEditorState().read(()=>pl().getTextContent())||"";i(u)},[l,s]),ul("span",{children:r})};import{$isElementNode as ie,$isRangeSelection as tt,FORMAT_ELEMENT_COMMAND as ot}from"lexical";import{jsx as Ot,jsxs as xl}from"react/jsx-runtime";import"react";var Ho=()=>xl("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:[Ot("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ot("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ot("path",{d:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Pt,jsxs as bl}from"react/jsx-runtime";import"react";var Bo=()=>bl("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:[Pt("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Pt("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Pt("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as $t,jsxs as _l}from"react/jsx-runtime";import"react";var et=()=>_l("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:[$t("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),$t("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),$t("path",{d:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Ht,jsxs as Tl}from"react/jsx-runtime";import"react";var jo=()=>Tl("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:[Ht("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ht("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ht("path",{d:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});var S=t=>o=>{let n={clientFeatureProps:o};if(typeof t=="function")n.feature=({featureProviderMap:r,resolvedFeatures:i,unSanitizedEditorConfig:l})=>{let s=t({featureProviderMap:r,props:o,resolvedFeatures:i,unSanitizedEditorConfig:l});return s.sanitizedClientFeatureProps===null&&(s.sanitizedClientFeatureProps=o),s};else{let r={...t};r.sanitizedClientFeatureProps=o,n.feature=r}return n};var Go=t=>({type:"dropdown",ChildComponent:et,items:t,key:"align",order:30});var Uo=[Go([{ChildComponent:et,isActive:({selection:t})=>{if(!tt(t))return!1;for(let e of t.getNodes()){if(ie(e)&&e.getFormatType()==="left")continue;let o=e.getParent();if(!(ie(o)&&o.getFormatType()==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(ot,"left")},order:1},{ChildComponent:Ho,isActive:({selection:t})=>{if(!tt(t))return!1;for(let e of t.getNodes()){if(ie(e)&&e.getFormatType()==="center")continue;let o=e.getParent();if(!(ie(o)&&o.getFormatType()==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(ot,"center")},order:2},{ChildComponent:jo,isActive:({selection:t})=>{if(!tt(t))return!1;for(let e of t.getNodes()){if(ie(e)&&e.getFormatType()==="right")continue;let o=e.getParent();if(!(ie(o)&&o.getFormatType()==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(ot,"right")},order:3},{ChildComponent:Bo,isActive:({selection:t})=>{if(!tt(t))return!1;for(let e of t.getNodes()){if(ie(e)&&e.getFormatType()==="justify")continue;let o=e.getParent();if(!(ie(o)&&o.getFormatType()==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(ot,"justify")},order:4}])],El=S({toolbarFixed:{groups:Uo},toolbarInline:{groups:Uo}});import{$createQuoteNode as Xo,$isQuoteNode as Zo,QuoteNode as Ll}from"@lexical/rich-text";import{$setBlocksType as Jo}from"@lexical/selection";import{$getSelection as qo,$isRangeSelection as Il}from"lexical";import{jsx as Wo}from"react/jsx-runtime";import"react";var Bt=()=>Wo("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:Wo("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 Vo}from"react/jsx-runtime";import"react";var De=()=>Vo("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:Vo("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 W=t=>({type:"dropdown",ChildComponent:De,items:t,key:"text",order:25});import{$createQuoteNode as wl,$isQuoteNode as Ko,QuoteNode as Nl}from"@lexical/rich-text";import{$createLineBreakNode as kl}from"lexical";var zo={type:"element",dependencies:[Nl],export:(t,e)=>{if(!Ko(t))return null;let o=e(t).split(`
2
2
  `),n=[];for(let r of o)n.push("> "+r);return n.join(`
3
- `)},regExp:/^>\s/,replace:(t,e,o,n)=>{if(n){let i=t.getPreviousSibling();if(Ko(i)){i.splice(i.getChildrenSize(),0,[kl(),...e]),i.select(0,0),t.remove();return}}let r=wl();r.append(...e),t.replace(r),r.select(0,0)}};var Yo=[W([{ChildComponent:Bt,isActive:({selection:t})=>{if(!Il(t))return!1;for(let e of t.getNodes())if(!Zo(e)&&!Zo(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=qo();Jo(e,()=>Xo())})},order:20}])],Rl=S({markdownTransformers:[zo],nodes:[Ll],slashMenu:{groups:[G([{Icon:Bt,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=qo();Jo(e,()=>Xo())})}}])]},toolbarFixed:{groups:Yo},toolbarInline:{groups:Yo}});import{getTranslation as lt}from"@payloadcms/translations";import{jsx as jt,jsxs as Sl}from"react/jsx-runtime";import"react";var rt=()=>Sl("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:[jt("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),jt("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),jt("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as Qo}from"react/jsx-runtime";import"react";var nt=()=>Qo("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:Qo("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 Fl}from"react/jsx-runtime";import Dl from"bson-objectid";import Ol from"react";import{DecoratorBlockNode as yl}from"@lexical/react/LexicalDecoratorBlockNode.js";import Ml from"bson-objectid";import{deepCopyObjectSimple as vl}from"payload/shared";var Oe=class extends yl{__fields;constructor({fields:e,format:o,key:n}){super(o,n),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=Al(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=vl(e),n=this.getWritable();n.__fields=o}};function Al(t){return new Oe({fields:{...t,id:t?.id||new Ml.default().toHexString()}})}var Pl=Ol.lazy(()=>import("./component-LHFD5Z33.js").then(t=>({default:t.BlockComponent}))),X=class extends Oe{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 Fl(Pl,{formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function it(t){return new X({fields:{...t,id:t?.id||new Dl.default().toHexString()}})}function $l(t){return t instanceof X}import{c as Hl}from"react/compiler-runtime";import{jsx as Bl}from"react/jsx-runtime";import{useLexicalComposerContext as jl}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Gl,$wrapNodeInElement as Ul,mergeRegister as Wl}from"@lexical/utils";import{getTranslation as Vl}from"@payloadcms/translations";import{formatDrawerSlug as Kl,useEditDepth as zl,useFieldProps as Zl,useModal as Yl,useTranslation as Xl}from"@payloadcms/ui";import{$createParagraphNode as Jl,$getNodeByKey as ql,$getPreviousSelection as Ql,$getSelection as er,$insertNodes as es,$isParagraphNode as tr,$isRangeSelection as or,$isRootOrShadowRoot as ts,COMMAND_PRIORITY_EDITOR as Gt}from"lexical";import{useEffect as os,useState as Ut}from"react";var rr=()=>{let t=Hl(25),[e]=jl(),{closeModal:o,toggleModal:n}=Yl(),[r,i]=Ut(null),[l,s]=Ut(""),[a,c]=Ut(null),{i18n:u,t:d}=Xl(),{schemaPath:m}=Zl(),{uuid:p}=$(),h=zl(),C="lexical-inlineBlocks-create-"+p,_;t[0]!==C||t[1]!==h?(_=Kl({slug:C,depth:h}),t[0]=C,t[1]=h,t[2]=_):_=t[2];let T=_,{field:A}=$(),{richTextComponentMap:v}=A,b,E;if(t[3]!==e||t[4]!==a||t[5]!==n||t[6]!==T?(b=()=>{if(!e.hasNodes([X]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return Wl(e.registerCommand(Ne,w=>(e.update(()=>{let g=er()||Ql();if(or(g)){let f=it(w);Gl(f);let{focus:k}=g,L=k.getNode();tr(L)&&L.getTextContentSize()===0&&L.getParent().getChildren().filter(N=>tr(N)).length>1&&L.remove()}}),!0),Gt),e.registerCommand(At,w=>{if(a){let f=ql(a);return f?(f.setFields(w),c(null),!0):!1}let g=Oo(w);return es([g]),ts(g.getParentOrThrow())&&Ul(g,Jl).selectEnd(),!0},Gt),e.registerCommand(ke,w=>{let{fields:g,nodeKey:f}=w;if(i(g??null),c(f??null),s(g?.blockType??""),f)return n(T),!0;let k;return k=null,e.getEditorState().read(()=>{let L=er();or(L)&&(k=L)}),k&&n(T),!0},Gt))},E=[e,a,n,T],t[3]=e,t[4]=a,t[5]=n,t[6]=T,t[7]=b,t[8]=E):(b=t[7],E=t[8]),os(b,E),!r)return null;let x=`${m}.lexical_internal_feature.blocks.lexical_inline_blocks.lexical_inline_blocks.${r?.blockType}`,I="lexical_internal_feature.blocks.fields.lexical_inline_blocks",y,R;if(t[9]!==v||t[10]!==r||t[11]!==u||t[12]!==d||t[13]!==o||t[14]!==T||t[15]!==l||t[16]!==e||t[17]!==x){R=Symbol.for("react.early_return_sentinel");e:{let w=v.has(I)?v.get(I)[0]:null,g=w?w.blocks.find(L=>L.slug===r?.blockType):null;if(!w){R=null;break e}let f=g?.labels?.singular?Vl(g?.labels?.singular,u):g?.slug,k;t[20]!==o||t[21]!==T||t[22]!==l||t[23]!==e?(k=(L,N)=>{o(T),N&&(N.blockType=l,e.dispatchCommand(At,N))},t[20]=o,t[21]=T,t[22]=l,t[23]=e,t[24]=k):k=t[24],y=Bl(ae,{data:r,drawerSlug:T,drawerTitle:d(`lexical:blocks:inlineBlocks:${r?.id?"edit":"create"}`,{label:f??d("lexical:blocks:inlineBlocks:label")}),featureKey:"blocks",fieldMapOverride:g?.fields,handleDrawerSubmit:k,schemaFieldsPathOverride:x,schemaPathSuffix:r?.blockType})}t[9]=v,t[10]=r,t[11]=u,t[12]=d,t[13]=o,t[14]=T,t[15]=l,t[16]=e,t[17]=x,t[18]=y,t[19]=R}else y=t[18],R=t[19];return R!==Symbol.for("react.early_return_sentinel")?R:y};var rs=S(({props:t})=>({nodes:[X,Do],plugins:[{Component:rr,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:[t.clientBlockSlugs?.length?{items:t.clientBlockSlugs.map(e=>({Icon:rt,key:"block-"+e,keywords:["block","blocks",e],label:({i18n:o,richTextComponentMap:n})=>{let l=n.get("lexical_internal_feature.blocks.fields.lexical_blocks")[0].blocks.find(a=>a.slug===e);return l.labels.singular?lt(l.labels.singular,o):l.slug},onSelect:({editor:o})=>{o.dispatchCommand(Ne,{id:null,blockName:"",blockType:e})}})),key:"blocks",label:({i18n:e})=>e.t("lexical:blocks:label")}:null,t.clientInlineBlockSlugs?.length?{items:t.clientInlineBlockSlugs.map(e=>({Icon:nt,key:"inlineBlocks-"+e,keywords:["inlineBlock","inline block",e],label:({i18n:o,richTextComponentMap:n})=>{let l=n.get("lexical_internal_feature.blocks.fields.lexical_inline_blocks")[0].blocks.find(a=>a.slug===e);return l.labels.singular?lt(l.labels.singular,o):l.slug},onSelect:({editor:o})=>{o.dispatchCommand(ke,{fields:{id:null,blockName:"",blockType:e}})}})),key:"inlineBlocks",label:({i18n:e})=>e.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[t.clientBlockSlugs?.length?{type:"dropdown",ChildComponent:rt,items:t.clientBlockSlugs.map((e,o)=>({ChildComponent:rt,isActive:void 0,key:"block-"+e,label:({i18n:n,richTextComponentMap:r})=>{let s=r.get("lexical_internal_feature.blocks.fields.lexical_blocks")[0].blocks.find(c=>c.slug===e);return s.labels.singular?lt(s.labels.singular,n):s.slug},onSelect:({editor:n})=>{n.dispatchCommand(Ne,{id:null,blockName:"",blockType:e})},order:o})),key:"blocks",order:20}:null,t.clientInlineBlockSlugs?.length?{type:"dropdown",ChildComponent:nt,items:t.clientInlineBlockSlugs.map((e,o)=>({ChildComponent:nt,isActive:void 0,key:"inlineBlock-"+e,label:({i18n:n,richTextComponentMap:r})=>{let s=r.get("lexical_internal_feature.blocks.fields.lexical_inline_blocks")[0].blocks.find(c=>c.slug===e);return s.labels.singular?lt(s.labels.singular,n):s.slug},onSelect:({editor:n})=>{n.dispatchCommand(ke,{fields:{blockType:e}})},order:o})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}));import{jsx as ue,jsxs as Kt}from"react/jsx-runtime";import{useLexicalComposerContext as ls}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as ss,$createTextNode as as,$getRoot as cs}from"lexical";import*as ar from"react";import{useCallback as ce,useEffect as Wt,useLayoutEffect as ir,useRef as Vt,useState as st}from"react";var K=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";var ns=K&&"documentMode"in document?document.documentMode:null,nr=K&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),U1=K&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),W1=K&&"InputEvent"in window&&!ns?"getTargetRanges"in new window.InputEvent("input"):!1,V1=K&&/Version\/[\d.].*Safari/.test(navigator.userAgent),K1=K&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,z1=K&&/Android/.test(navigator.userAgent),Z1=K&&/Win/.test(navigator.platform),is=K&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Y1=K&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!is;var us=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)},ds=(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)},ms=t=>{let o=((n,r)=>{switch(n){case"click":return` await page.mouse.click(${r.x}, ${r.y});`;case"press":return` await page.keyboard.press('${r}');`;case"keydown":return` await page.keyboard.keydown('${r}');`;case"keyup":return` await page.keyboard.keyup('${r}');`;case"type":return` await page.keyboard.type('${r}');`;case"selectAll":return" await selectAll(page);";case"snapshot":return` await assertHTMLSnapshot(page);
3
+ `)},regExp:/^>\s/,replace:(t,e,o,n)=>{if(n){let i=t.getPreviousSibling();if(Ko(i)){i.splice(i.getChildrenSize(),0,[kl(),...e]),i.select(0,0),t.remove();return}}let r=wl();r.append(...e),t.replace(r),r.select(0,0)}};var Yo=[W([{ChildComponent:Bt,isActive:({selection:t})=>{if(!Il(t))return!1;for(let e of t.getNodes())if(!Zo(e)&&!Zo(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=qo();Jo(e,()=>Xo())})},order:20}])],Rl=S({markdownTransformers:[zo],nodes:[Ll],slashMenu:{groups:[G([{Icon:Bt,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=qo();Jo(e,()=>Xo())})}}])]},toolbarFixed:{groups:Yo},toolbarInline:{groups:Yo}});import{getTranslation as lt}from"@payloadcms/translations";import{jsx as jt,jsxs as Sl}from"react/jsx-runtime";import"react";var rt=()=>Sl("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:[jt("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),jt("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),jt("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as Qo}from"react/jsx-runtime";import"react";var nt=()=>Qo("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:Qo("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 Fl}from"react/jsx-runtime";import Dl from"bson-objectid";import Ol from"react";import{DecoratorBlockNode as yl}from"@lexical/react/LexicalDecoratorBlockNode.js";import Ml from"bson-objectid";import{deepCopyObjectSimple as vl}from"payload/shared";var Oe=class extends yl{__fields;constructor({fields:e,format:o,key:n}){super(o,n),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=Al(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=vl(e),n=this.getWritable();n.__fields=o}};function Al(t){return new Oe({fields:{...t,id:t?.id||new Ml.default().toHexString()}})}var Pl=Ol.lazy(()=>import("./component-OVIYSCND.js").then(t=>({default:t.BlockComponent}))),X=class extends Oe{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 Fl(Pl,{formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function it(t){return new X({fields:{...t,id:t?.id||new Dl.default().toHexString()}})}function $l(t){return t instanceof X}import{c as Hl}from"react/compiler-runtime";import{jsx as Bl}from"react/jsx-runtime";import{useLexicalComposerContext as jl}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Gl,$wrapNodeInElement as Ul,mergeRegister as Wl}from"@lexical/utils";import{getTranslation as Vl}from"@payloadcms/translations";import{formatDrawerSlug as Kl,useEditDepth as zl,useFieldProps as Zl,useModal as Yl,useTranslation as Xl}from"@payloadcms/ui";import{$createParagraphNode as Jl,$getNodeByKey as ql,$getPreviousSelection as Ql,$getSelection as er,$insertNodes as es,$isParagraphNode as tr,$isRangeSelection as or,$isRootOrShadowRoot as ts,COMMAND_PRIORITY_EDITOR as Gt}from"lexical";import{useEffect as os,useState as Ut}from"react";var rr=()=>{let t=Hl(25),[e]=jl(),{closeModal:o,toggleModal:n}=Yl(),[r,i]=Ut(null),[l,s]=Ut(""),[a,c]=Ut(null),{i18n:u,t:d}=Xl(),{schemaPath:m}=Zl(),{uuid:p}=$(),h=zl(),C="lexical-inlineBlocks-create-"+p,_;t[0]!==C||t[1]!==h?(_=Kl({slug:C,depth:h}),t[0]=C,t[1]=h,t[2]=_):_=t[2];let T=_,{field:A}=$(),{richTextComponentMap:v}=A,b,E;if(t[3]!==e||t[4]!==a||t[5]!==n||t[6]!==T?(b=()=>{if(!e.hasNodes([X]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return Wl(e.registerCommand(Ne,w=>(e.update(()=>{let g=er()||Ql();if(or(g)){let f=it(w);Gl(f);let{focus:k}=g,L=k.getNode();tr(L)&&L.getTextContentSize()===0&&L.getParent().getChildren().filter(N=>tr(N)).length>1&&L.remove()}}),!0),Gt),e.registerCommand(At,w=>{if(a){let f=ql(a);return f?(f.setFields(w),c(null),!0):!1}let g=Oo(w);return es([g]),ts(g.getParentOrThrow())&&Ul(g,Jl).selectEnd(),!0},Gt),e.registerCommand(ke,w=>{let{fields:g,nodeKey:f}=w;if(i(g??null),c(f??null),s(g?.blockType??""),f)return n(T),!0;let k;return k=null,e.getEditorState().read(()=>{let L=er();or(L)&&(k=L)}),k&&n(T),!0},Gt))},E=[e,a,n,T],t[3]=e,t[4]=a,t[5]=n,t[6]=T,t[7]=b,t[8]=E):(b=t[7],E=t[8]),os(b,E),!r)return null;let x=`${m}.lexical_internal_feature.blocks.lexical_inline_blocks.lexical_inline_blocks.${r?.blockType}`,I="lexical_internal_feature.blocks.fields.lexical_inline_blocks",y,R;if(t[9]!==v||t[10]!==r||t[11]!==u||t[12]!==d||t[13]!==o||t[14]!==T||t[15]!==l||t[16]!==e||t[17]!==x){R=Symbol.for("react.early_return_sentinel");e:{let w=v.has(I)?v.get(I)[0]:null,g=w?w.blocks.find(L=>L.slug===r?.blockType):null;if(!w){R=null;break e}let f=g?.labels?.singular?Vl(g?.labels?.singular,u):g?.slug,k;t[20]!==o||t[21]!==T||t[22]!==l||t[23]!==e?(k=(L,N)=>{o(T),N&&(N.blockType=l,e.dispatchCommand(At,N))},t[20]=o,t[21]=T,t[22]=l,t[23]=e,t[24]=k):k=t[24],y=Bl(ae,{data:r,drawerSlug:T,drawerTitle:d(`lexical:blocks:inlineBlocks:${r?.id?"edit":"create"}`,{label:f??d("lexical:blocks:inlineBlocks:label")}),featureKey:"blocks",fieldMapOverride:g?.fields,handleDrawerSubmit:k,schemaFieldsPathOverride:x,schemaPathSuffix:r?.blockType})}t[9]=v,t[10]=r,t[11]=u,t[12]=d,t[13]=o,t[14]=T,t[15]=l,t[16]=e,t[17]=x,t[18]=y,t[19]=R}else y=t[18],R=t[19];return R!==Symbol.for("react.early_return_sentinel")?R:y};var rs=S(({props:t})=>({nodes:[X,Do],plugins:[{Component:rr,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:[t.clientBlockSlugs?.length?{items:t.clientBlockSlugs.map(e=>({Icon:rt,key:"block-"+e,keywords:["block","blocks",e],label:({i18n:o,richTextComponentMap:n})=>{let l=n.get("lexical_internal_feature.blocks.fields.lexical_blocks")[0].blocks.find(a=>a.slug===e);return l.labels.singular?lt(l.labels.singular,o):l.slug},onSelect:({editor:o})=>{o.dispatchCommand(Ne,{id:null,blockName:"",blockType:e})}})),key:"blocks",label:({i18n:e})=>e.t("lexical:blocks:label")}:null,t.clientInlineBlockSlugs?.length?{items:t.clientInlineBlockSlugs.map(e=>({Icon:nt,key:"inlineBlocks-"+e,keywords:["inlineBlock","inline block",e],label:({i18n:o,richTextComponentMap:n})=>{let l=n.get("lexical_internal_feature.blocks.fields.lexical_inline_blocks")[0].blocks.find(a=>a.slug===e);return l.labels.singular?lt(l.labels.singular,o):l.slug},onSelect:({editor:o})=>{o.dispatchCommand(ke,{fields:{id:null,blockName:"",blockType:e}})}})),key:"inlineBlocks",label:({i18n:e})=>e.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[t.clientBlockSlugs?.length?{type:"dropdown",ChildComponent:rt,items:t.clientBlockSlugs.map((e,o)=>({ChildComponent:rt,isActive:void 0,key:"block-"+e,label:({i18n:n,richTextComponentMap:r})=>{let s=r.get("lexical_internal_feature.blocks.fields.lexical_blocks")[0].blocks.find(c=>c.slug===e);return s.labels.singular?lt(s.labels.singular,n):s.slug},onSelect:({editor:n})=>{n.dispatchCommand(Ne,{id:null,blockName:"",blockType:e})},order:o})),key:"blocks",order:20}:null,t.clientInlineBlockSlugs?.length?{type:"dropdown",ChildComponent:nt,items:t.clientInlineBlockSlugs.map((e,o)=>({ChildComponent:nt,isActive:void 0,key:"inlineBlock-"+e,label:({i18n:n,richTextComponentMap:r})=>{let s=r.get("lexical_internal_feature.blocks.fields.lexical_inline_blocks")[0].blocks.find(c=>c.slug===e);return s.labels.singular?lt(s.labels.singular,n):s.slug},onSelect:({editor:n})=>{n.dispatchCommand(ke,{fields:{blockType:e}})},order:o})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}));import{jsx as ue,jsxs as Kt}from"react/jsx-runtime";import{useLexicalComposerContext as ls}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as ss,$createTextNode as as,$getRoot as cs}from"lexical";import*as ar from"react";import{useCallback as ce,useEffect as Wt,useLayoutEffect as ir,useRef as Vt,useState as st}from"react";var K=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";var ns=K&&"documentMode"in document?document.documentMode:null,nr=K&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),U1=K&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),W1=K&&"InputEvent"in window&&!ns?"getTargetRanges"in new window.InputEvent("input"):!1,V1=K&&/Version\/[\d.].*Safari/.test(navigator.userAgent),K1=K&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,z1=K&&/Android/.test(navigator.userAgent),Z1=K&&/Win/.test(navigator.platform),is=K&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Y1=K&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!is;var us=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)},ds=(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)},ms=t=>{let o=((n,r)=>{switch(n){case"click":return` await page.mouse.click(${r.x}, ${r.y});`;case"press":return` await page.keyboard.press('${r}');`;case"keydown":return` await page.keyboard.keydown('${r}');`;case"keyup":return` await page.keyboard.keyup('${r}');`;case"type":return` await page.keyboard.type('${r}');`;case"selectAll":return" await selectAll(page);";case"snapshot":return` await assertHTMLSnapshot(page);
4
4
  await assertSelection(page, {
5
5
  anchorPath: [${r.anchorPath.toString()}],
6
6
  anchorOffset: ${r.anchorOffset},