@payloadcms/richtext-lexical 3.0.0-beta.68 → 3.0.0-beta.69
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.
- package/dist/exports/client/{chunk-PKQTLDGV.js → chunk-KTD7OXVC.js} +2 -2
- package/dist/exports/client/{chunk-PKQTLDGV.js.map → chunk-KTD7OXVC.js.map} +1 -1
- package/dist/exports/client/{componentInline-AMT6UPR7.js → componentInline-3JDU4HVQ.js} +2 -2
- package/dist/exports/client/index.js +1 -1
- package/dist/exports/client/index.js.map +2 -2
- package/dist/features/blocks/nodes/InlineBlocksNode.js.map +1 -1
- package/dist/features/blocks/plugin/index.d.ts.map +1 -1
- package/dist/features/blocks/plugin/index.js.map +1 -1
- package/dist/field/index.js +8 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/populateGraphQL/populateLexicalPopulationPromises.js.map +1 -1
- package/package.json +9 -9
- /package/dist/exports/client/{componentInline-AMT6UPR7.js.map → componentInline-3JDU4HVQ.js.map} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createCommand as o}from"lexical";var
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{createCommand as o}from"lexical";var I=o("INSERT_BLOCK_COMMAND"),u=o("INSERT_INLINE_BLOCK_COMMAND"),k=o("OPEN_INLINE_BLOCK_DRAWER_COMMAND");import r from"bson-objectid";import{DecoratorNode as d}from"lexical";import{deepCopyObjectSimple as c}from"payload/shared";import s from"react";import{jsx as m}from"react/jsx-runtime";var a=s.lazy(()=>import("./componentInline-3JDU4HVQ.js").then(t=>({default:t.InlineBlockComponent}))),i=class t extends d{__fields;constructor({fields:e,key:n}){super(n),this.__fields=e}static clone(e){return new t({fields:e.__fields,key:e.__key})}static getType(){return"inlineBlock"}static importDOM(){return{}}static importJSON(e){return p(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 m(a,{formData:this.getFields(),nodeKey:this.getKey()})}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=c(e),l=this.getWritable();l.__fields=n}updateDOM(){return!1}};function p(t){return new i({fields:{...t,id:t?.id||new r.default().toHexString()}})}function y(t){return t instanceof i}export{I as a,u as b,k as c,i as d,p as e,y as f};
|
|
2
|
+
//# sourceMappingURL=chunk-KTD7OXVC.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/features/blocks/plugin/commands.ts", "../../../src/features/blocks/nodes/InlineBlocksNode.tsx"],
|
|
4
|
-
"sourcesContent": ["import type { LexicalCommand } from 'lexical'\n\nimport { createCommand } from 'lexical'\n\nimport type { InsertBlockPayload } from './index.js'\n\nexport const INSERT_BLOCK_COMMAND: LexicalCommand<InsertBlockPayload> =\n createCommand('INSERT_BLOCK_COMMAND')\n\nexport const INSERT_INLINE_BLOCK_COMMAND: LexicalCommand<Partial<InsertBlockPayload>> =\n createCommand('INSERT_INLINE_BLOCK_COMMAND')\n\nexport const OPEN_INLINE_BLOCK_DRAWER_COMMAND: LexicalCommand<{\n fields: Partial<InsertBlockPayload>\n nodeKey?: string\n}> = createCommand('OPEN_INLINE_BLOCK_DRAWER_COMMAND')\n", "import type {\n DOMConversionMap,\n DOMExportOutput,\n EditorConfig,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n SerializedLexicalNode,\n Spread,\n} from 'lexical'\n\nimport ObjectID from 'bson-objectid'\nimport { DecoratorNode } from 'lexical'\nimport { deepCopyObjectSimple } from 'payload/shared'\nimport React, { type JSX } from 'react'\n\nexport type InlineBlockFields = {\n /** Block form data */\n [key: string]: any\n //blockName: string\n blockType: string\n id: string\n}\n\nconst InlineBlockComponent = React.lazy(() =>\n import('../componentInline/index.js').then((module) => ({\n default: module.InlineBlockComponent,\n })),\n)\n\nexport type SerializedInlineBlockNode = Spread<\n {\n children?: never // required so that our typed editor state doesn't automatically add children\n fields: InlineBlockFields\n type: 'inlineBlock'\n },\n SerializedLexicalNode\n>\n\nexport class InlineBlockNode extends DecoratorNode<React.ReactElement> {\n __fields: InlineBlockFields\n\n constructor({ fields, key }: { fields: InlineBlockFields; key?: NodeKey }) {\n super(key)\n this.__fields = fields\n }\n\n static clone(node: InlineBlockNode): InlineBlockNode {\n return new InlineBlockNode({\n fields: node.__fields,\n key: node.__key,\n })\n }\n\n static getType(): string {\n return 'inlineBlock'\n }\n\n static importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {}\n }\n\n static importJSON(serializedNode: SerializedInlineBlockNode): InlineBlockNode {\n const node = $createInlineBlockNode(serializedNode.fields)\n return node\n }\n\n static isInline(): false {\n return false\n }\n canIndent() {\n return true\n }\n\n createDOM() {\n const element = document.createElement('span')\n element.classList.add('inline-block-container')\n\n return element\n }\n\n decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element {\n return <InlineBlockComponent formData={this.getFields()} nodeKey={this.getKey()} />\n }\n\n exportDOM(): DOMExportOutput {\n const element = document.createElement('span')\n element.classList.add('inline-block-container')\n\n const text = document.createTextNode(this.getTextContent())\n element.append(text)\n return { element }\n }\n\n exportJSON(): SerializedInlineBlockNode {\n return {\n type: 'inlineBlock',\n fields: this.getFields(),\n version: 1,\n }\n }\n\n getFields(): InlineBlockFields {\n return this.getLatest().__fields\n }\n\n getTextContent(): string {\n return `Block Field`\n }\n\n isInline() {\n return true\n }\n\n setFields(fields: InlineBlockFields): void {\n const fieldsCopy = deepCopyObjectSimple(fields)
|
|
4
|
+
"sourcesContent": ["import type { LexicalCommand } from 'lexical'\n\nimport { createCommand } from 'lexical'\n\nimport type { InsertBlockPayload } from './index.js'\n\nexport const INSERT_BLOCK_COMMAND: LexicalCommand<InsertBlockPayload> =\n createCommand('INSERT_BLOCK_COMMAND')\n\nexport const INSERT_INLINE_BLOCK_COMMAND: LexicalCommand<Partial<InsertBlockPayload>> =\n createCommand('INSERT_INLINE_BLOCK_COMMAND')\n\nexport const OPEN_INLINE_BLOCK_DRAWER_COMMAND: LexicalCommand<{\n fields: Partial<InsertBlockPayload>\n nodeKey?: string\n}> = createCommand('OPEN_INLINE_BLOCK_DRAWER_COMMAND')\n", "import type {\n DOMConversionMap,\n DOMExportOutput,\n EditorConfig,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n SerializedLexicalNode,\n Spread,\n} from 'lexical'\n\nimport ObjectID from 'bson-objectid'\nimport { DecoratorNode } from 'lexical'\nimport { deepCopyObjectSimple } from 'payload/shared'\nimport React, { type JSX } from 'react'\n\nexport type InlineBlockFields = {\n /** Block form data */\n [key: string]: any\n //blockName: string\n blockType: string\n id: string\n}\n\nconst InlineBlockComponent = React.lazy(() =>\n import('../componentInline/index.js').then((module) => ({\n default: module.InlineBlockComponent,\n })),\n)\n\nexport type SerializedInlineBlockNode = Spread<\n {\n children?: never // required so that our typed editor state doesn't automatically add children\n fields: InlineBlockFields\n type: 'inlineBlock'\n },\n SerializedLexicalNode\n>\n\nexport class InlineBlockNode extends DecoratorNode<React.ReactElement> {\n __fields: InlineBlockFields\n\n constructor({ fields, key }: { fields: InlineBlockFields; key?: NodeKey }) {\n super(key)\n this.__fields = fields\n }\n\n static clone(node: InlineBlockNode): InlineBlockNode {\n return new InlineBlockNode({\n fields: node.__fields,\n key: node.__key,\n })\n }\n\n static getType(): string {\n return 'inlineBlock'\n }\n\n static importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {}\n }\n\n static importJSON(serializedNode: SerializedInlineBlockNode): InlineBlockNode {\n const node = $createInlineBlockNode(serializedNode.fields)\n return node\n }\n\n static isInline(): false {\n return false\n }\n canIndent() {\n return true\n }\n\n createDOM() {\n const element = document.createElement('span')\n element.classList.add('inline-block-container')\n\n return element\n }\n\n decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element {\n return <InlineBlockComponent formData={this.getFields()} nodeKey={this.getKey()} />\n }\n\n exportDOM(): DOMExportOutput {\n const element = document.createElement('span')\n element.classList.add('inline-block-container')\n\n const text = document.createTextNode(this.getTextContent())\n element.append(text)\n return { element }\n }\n\n exportJSON(): SerializedInlineBlockNode {\n return {\n type: 'inlineBlock',\n fields: this.getFields(),\n version: 1,\n }\n }\n\n getFields(): InlineBlockFields {\n return this.getLatest().__fields\n }\n\n getTextContent(): string {\n return `Block Field`\n }\n\n isInline() {\n return true\n }\n\n setFields(fields: InlineBlockFields): void {\n const fieldsCopy = deepCopyObjectSimple(fields)\n\n const writable = this.getWritable()\n writable.__fields = fieldsCopy\n }\n\n updateDOM(): boolean {\n return false\n }\n}\n\nexport function $createInlineBlockNode(fields: Exclude<InlineBlockFields, 'id'>): InlineBlockNode {\n return new InlineBlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\n },\n })\n}\n\nexport function $isInlineBlockNode(\n node: InlineBlockNode | LexicalNode | null | undefined,\n): node is InlineBlockNode {\n return node instanceof InlineBlockNode\n}\n"],
|
|
5
5
|
"mappings": "AAEA,OAAS,iBAAAA,MAAqB,UAIvB,IAAMC,EACXD,EAAc,sBAAsB,EAEzBE,EACXF,EAAc,6BAA6B,EAEhCG,EAGRH,EAAc,kCAAkC,ECJrD,OAAOI,MAAc,gBACrB,OAAS,iBAAAC,MAAqB,UAC9B,OAAS,wBAAAC,MAA4B,iBACrC,OAAOC,MAAyB,QAoErB,cAAAC,MAAA,oBA1DX,IAAMC,EAAuBF,EAAM,KAAK,IACtC,OAAO,+BAA6B,EAAE,KAAMG,IAAY,CACtD,QAASA,EAAO,oBAClB,EAAE,CACJ,EAWaC,EAAN,MAAMC,UAAwBP,CAAkC,CACrE,SAEA,YAAY,CAAE,OAAAQ,EAAQ,IAAAC,CAAI,EAAiD,CACzE,MAAMA,CAAG,EACT,KAAK,SAAWD,CAClB,CAEA,OAAO,MAAME,EAAwC,CACnD,OAAO,IAAIH,EAAgB,CACzB,OAAQG,EAAK,SACb,IAAKA,EAAK,KACZ,CAAC,CACH,CAEA,OAAO,SAAkB,CACvB,MAAO,aACT,CAEA,OAAO,WAAqD,CAC1D,MAAO,CAAC,CACV,CAEA,OAAO,WAAWC,EAA4D,CAE5E,OADaC,EAAuBD,EAAe,MAAM,CAE3D,CAEA,OAAO,UAAkB,CACvB,MAAO,EACT,CACA,WAAY,CACV,MAAO,EACT,CAEA,WAAY,CACV,IAAME,EAAU,SAAS,cAAc,MAAM,EAC7C,OAAAA,EAAQ,UAAU,IAAI,wBAAwB,EAEvCA,CACT,CAEA,SAASC,EAAuBC,EAAmC,CACjE,OAAOZ,EAACC,EAAA,CAAqB,SAAU,KAAK,UAAU,EAAG,QAAS,KAAK,OAAO,EAAG,CACnF,CAEA,WAA6B,CAC3B,IAAMS,EAAU,SAAS,cAAc,MAAM,EAC7CA,EAAQ,UAAU,IAAI,wBAAwB,EAE9C,IAAMG,EAAO,SAAS,eAAe,KAAK,eAAe,CAAC,EAC1D,OAAAH,EAAQ,OAAOG,CAAI,EACZ,CAAE,QAAAH,CAAQ,CACnB,CAEA,YAAwC,CACtC,MAAO,CACL,KAAM,cACN,OAAQ,KAAK,UAAU,EACvB,QAAS,CACX,CACF,CAEA,WAA+B,CAC7B,OAAO,KAAK,UAAU,EAAE,QAC1B,CAEA,gBAAyB,CACvB,MAAO,aACT,CAEA,UAAW,CACT,MAAO,EACT,CAEA,UAAUL,EAAiC,CACzC,IAAMS,EAAahB,EAAqBO,CAAM,EAExCU,EAAW,KAAK,YAAY,EAClCA,EAAS,SAAWD,CACtB,CAEA,WAAqB,CACnB,MAAO,EACT,CACF,EAEO,SAASL,EAAuBJ,EAA2D,CAChG,OAAO,IAAIF,EAAgB,CACzB,OAAQ,CACN,GAAGE,EACH,GAAIA,GAAQ,IAAM,IAAIT,EAAS,QAAQ,EAAE,YAAY,CACvD,CACF,CAAC,CACH,CAEO,SAASoB,EACdT,EACyB,CACzB,OAAOA,aAAgBJ,CACzB",
|
|
6
6
|
"names": ["createCommand", "INSERT_BLOCK_COMMAND", "INSERT_INLINE_BLOCK_COMMAND", "OPEN_INLINE_BLOCK_DRAWER_COMMAND", "ObjectID", "DecoratorNode", "deepCopyObjectSimple", "React", "jsx", "InlineBlockComponent", "module", "InlineBlockNode", "_InlineBlockNode", "fields", "key", "node", "serializedNode", "$createInlineBlockNode", "element", "editor", "config", "text", "fieldsCopy", "writable", "$isInlineBlockNode"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{c as N,f as E}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=componentInline-
|
|
1
|
+
"use client";import{c as N,f as E}from"./chunk-KTD7OXVC.js";import{b as y}from"./chunk-QZIAQPM7.js";import{useCallback as p,useEffect as P,useRef as R}from"react";import{useLexicalComposerContext as S}from"@lexical/react/LexicalComposerContext";import{useLexicalNodeSelection as $}from"@lexical/react/useLexicalNodeSelection";import{mergeRegister as x}from"@lexical/utils";import{getTranslation as _}from"@payloadcms/translations";import{Button as D,useTranslation as A}from"@payloadcms/ui";import{$getNodeByKey as M,$getSelection as F,$isNodeSelection as T,CLICK_COMMAND as j,COMMAND_PRIORITY_LOW as f,KEY_BACKSPACE_COMMAND as z,KEY_DELETE_COMMAND as Y}from"lexical";import{jsx as c,jsxs as I}from"react/jsx-runtime";var i="inline-block",Z=K=>{let{formData:r,nodeKey:o}=K,[e]=S(),{i18n:C,t:k}=A(),{editorConfig:O,field:b}=y(),m=R(null),[t,a,d]=$(o),s=O?.resolvedFeatureMap?.get("blocks")?.sanitizedClientFeatureProps?.reducedInlineBlocks?.find(l=>l.slug===r?.blockType),L=p(()=>{e.update(()=>{M(o).remove()})},[e,o]),u=p(l=>{if(t&&T(F())){l.preventDefault();let n=M(o);if(E(n))return n.remove(),!0}return!1},[t,o]),B=p(l=>{let n=l;return n.target===m.current||m.current?.contains(n.target)?(n.shiftKey?a(!t):t||(d(),a(!0)),!0):!1},[t,a,d]);P(()=>x(e.registerCommand(j,B,f),e.registerCommand(Y,u,f),e.registerCommand(z,u,f)),[d,e,t,o,u,a,B]);let g=s?.LabelComponent,v=s.labels.singular?_(s.labels.singular,C):s.slug;return I("div",{className:[i,i+"-"+r.blockType,t&&`${i}--selected`].filter(Boolean).join(" "),ref:m,children:[g?c(g,{blockKind:"lexicalInlineBlock",formData:r}):c("div",{children:_(s.labels.singular,C)}),e.isEditable()&&I("div",{className:`${i}__actions`,children:[c(D,{buttonStyle:"icon-label",className:`${i}__editButton`,disabled:b?.readOnly,el:"div",icon:"edit",onClick:()=>{e.dispatchCommand(N,{fields:r,nodeKey:o})},round:!0,size:"small",tooltip:k("lexical:blocks:inlineBlocks:edit",{label:v})}),c(D,{buttonStyle:"icon-label",className:`${i}__removeButton`,disabled:b?.readOnly,icon:"x",onClick:l=>{l.preventDefault(),L()},round:!0,size:"small",tooltip:k("lexical:blocks:inlineBlocks:remove",{label:v})})]})]})};export{Z as InlineBlockComponent};
|
|
2
|
+
//# sourceMappingURL=componentInline-3JDU4HVQ.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use client";import{a as It,c as ll,e as sl,f as al,g as cl,h as dl}from"./chunk-EBB2CEB6.js";import{a as Ne,b as Ft,c as ke,d as Ho,e as Bo}from"./chunk-PKQTLDGV.js";import{a as we,b as Ze,c as Xe,d as Je}from"./chunk-Q5DYR7MH.js";import{a as _e,b as Re,c as Se,d as Mt}from"./chunk-HO42U3IJ.js";import{a as le,b as Ye,c as ve,d as Ie,e as Fe,f as Pt}from"./chunk-SFUMQAVE.js";import{a as il,b as G}from"./chunk-QZIAQPM7.js";function B(e){return{items:e,key:"basic",label:({i18n:t})=>t.t("lexical:general:slashMenuBasicGroupLabel")}}import{createHeadlessEditor as ul}from"@lexical/headless";import{useClientFunctions as pl,useTableCell as ml}from"@payloadcms/ui";import{$getRoot as fl}from"lexical";import At,{useEffect as Uo,useState as Dt}from"react";var $o={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 Me={namespace:"lexical",theme:$o};function qe({clientFunctions:e,schemaPath:t,unSanitizedEditorConfig:o}){for(let l of o.features)if(!l?.clientFeatureProps?.featureKey||l?.clientFeatureProps?.order===void 0||l?.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.");o.features=o.features.sort((l,s)=>l.clientFeatureProps.order-s.clientFeatureProps.order);let r=new Map(o.features.map(l=>[l.clientFeatureProps.featureKey,l])),n=new Map,i=0;for(let l of o.features){let s={};Object.entries(e).forEach(([c,d])=>{if(c.startsWith(`lexicalFeature.${t}.${l.clientFeatureProps.featureKey}.components.`)){let u=c.split(`${t}.${l.clientFeatureProps.featureKey}.components.`)[1];s[u]=d}});let a=typeof l.feature=="function"?l.feature({clientFunctions:s,featureProviderMap:r,resolvedFeatures:n,unSanitizedEditorConfig:o}):l.feature;n.set(l.clientFeatureProps.featureKey,{...a,key:l.clientFeatureProps.featureKey,order:i}),i++}return n}var Go=e=>{let t={enabledFeatures:[],hooks:{load:[],save:[]},markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}};if(!e?.size)return t;e.forEach(o=>{if(o.hooks&&(o.hooks?.load?.length&&(t.hooks.load=t.hooks.load.concat(o.hooks.load)),o.hooks?.save?.length&&(t.hooks.save=t.hooks.save.concat(o.hooks.save))),o.providers?.length&&(t.providers=t.providers.concat(o.providers)),o.nodes?.length&&(t.nodes=t.nodes.concat(o.nodes)),o.plugins?.length&&o.plugins.forEach((r,n)=>{t.plugins.push({Component:r.Component,clientProps:o.sanitizedClientFeatureProps,key:o.key+n,position:r.position})}),o.toolbarInline?.groups?.length)for(let r of o.toolbarInline.groups){let n=t.toolbarInline.groups.find(i=>i.key===r.key);n?t.toolbarInline.groups=t.toolbarInline.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),t.toolbarInline?.groups.push(n)}if(o.toolbarFixed?.groups?.length)for(let r of o.toolbarFixed.groups){let n=t.toolbarFixed.groups.find(i=>i.key===r.key);n?t.toolbarFixed.groups=t.toolbarFixed.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),t.toolbarFixed?.groups.push(n)}if(o.slashMenu?.groups){o.slashMenu.dynamicGroups?.length&&(t.slashMenu.dynamicGroups=t.slashMenu.dynamicGroups.concat(o.slashMenu.dynamicGroups));for(let r of o.slashMenu.groups){let n=t.slashMenu.groups.find(i=>i.key===r.key);n?t.slashMenu.groups=t.slashMenu.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),t.slashMenu.groups.push(n)}}o.markdownTransformers?.length&&(t.markdownTransformers=t.markdownTransformers.concat(o.markdownTransformers)),t.enabledFeatures.push(o.key)}),t.toolbarInline.groups.sort((o,r)=>o.order&&r.order?o.order-r.order:o.order?-1:r.order?1:0),t.toolbarFixed.groups.sort((o,r)=>o.order&&r.order?o.order-r.order:o.order?-1:r.order?1:0);for(let o of t.toolbarInline.groups)o.items.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);for(let o of t.toolbarFixed.groups)o.items.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);return t};function Pe(e,t,o){return{admin:o,features:Go(t),lexical:e,resolvedFeatureMap:t}}import{jsx as Wo,jsxs as Cl}from"react/jsx-runtime";var gl=e=>{let{admin:t,lexicalEditorConfig:o,richTextComponentMap:r}=e,[n,i]=At.useState("Loading..."),{cellData:l,cellProps:{schemaPath:s}}=ml(),a=pl(),[c,d]=Dt(!1),[u,m]=Dt([]),[f,C]=Dt(null),g=r.get("features").sort((b,S)=>b.order-S.order),x=0;for(let b of g){let S=Array.from(r.keys()).filter(I=>I.startsWith(`feature.${b.key}.components.`));x+=1,x+=S.length}return Uo(()=>{if(!c){let b=[],S=0;if(Object.entries(a).forEach(([I,T])=>{I.startsWith(`lexicalFeature.${s}.`)&&(I.includes(".lexical_internal_components.")||b.push(T),S++)}),S===x){m(b),d(!0);let I=qe({clientFunctions:a,schemaPath:s,unSanitizedEditorConfig:{features:b,lexical:o}});C(Pe(o||Me,I,t))}}},[t,g,c,a,s,g.length,u,f,o,r,x]),Uo(()=>{if(!c)return;let b=l;if(b==null||!c||!f){i("");return}if(f?.features?.hooks?.load?.length&&f.features.hooks.load.forEach(T=>{b=T({incomingEditorState:b})}),!b||typeof b!="object"){i("");return}if(Array.isArray(b)&&!("root"in b)){i("");return}if("jsonContent"in b){i("");return}let S=ul({namespace:f.lexical.namespace,nodes:It({editorConfig:f}),theme:f.lexical.theme});S.setEditorState(S.parseEditorState(b));let I=S.getEditorState().read(()=>fl().getTextContent())||"";i(I)},[l,o,c,f]),c?Wo("span",{children:n}):Wo(At.Fragment,{children:Array.isArray(g)&&g.map(b=>{let I=Array.from(r.keys()).filter(T=>T.startsWith(`lexical_internal_feature.${b.key}.lexical_internal_components.`)).map(T=>r.get(T));return Cl(At.Fragment,{children:[I?.length?I.map(T=>T):null,b.ClientFeature]},b.key)})})};import{$isElementNode as ne,$isRangeSelection as et,FORMAT_ELEMENT_COMMAND as tt}from"lexical";import{jsx as Ot,jsxs as hl}from"react/jsx-runtime";var zo=()=>hl("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 Ht,jsxs as xl}from"react/jsx-runtime";var Vo=()=>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:[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:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Bt,jsxs as bl}from"react/jsx-runtime";var Qe=()=>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:[Bt("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Bt("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Bt("path",{d:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as $t,jsxs as Tl}from"react/jsx-runtime";var Ko=()=>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:[$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:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{useAddClientFunction as El,useFieldProps as yl,useTableCell as Ll}from"@payloadcms/ui";var jo=(e,t)=>{let{schemaPath:o}=yl(),i=Ll()?.cellProps?.schemaPath||o;El(`lexicalFeature.${i}.${e}`,t)};var Gt=e=>t=>(jo(t.featureKey,e(t)),null);var E=e=>Gt(o=>{let r={clientFeatureProps:o};return typeof e=="function"?r.feature=({clientFunctions:n,featureProviderMap:i,resolvedFeatures:l,unSanitizedEditorConfig:s})=>{let a=e({clientFunctions:n,featureProviderMap:i,props:o,resolvedFeatures:l,unSanitizedEditorConfig:s});return a.sanitizedClientFeatureProps===null&&(a.sanitizedClientFeatureProps=o),a}:(e.sanitizedClientFeatureProps=o,r.feature=e),r});var Zo=e=>({type:"dropdown",ChildComponent:Qe,items:e,key:"align",order:30});var Xo=[Zo([{ChildComponent:Qe,isActive:({selection:e})=>{if(!et(e))return!1;for(let t of e.getNodes()){if(ne(t)&&t.getFormatType()==="left")continue;let o=t.getParent();if(!(ne(o)&&o.getFormatType()==="left"))return!1}return!0},key:"alignLeft",label:({i18n:e})=>e.t("lexical:align:alignLeftLabel"),onSelect:({editor:e})=>{e.dispatchCommand(tt,"left")},order:1},{ChildComponent:zo,isActive:({selection:e})=>{if(!et(e))return!1;for(let t of e.getNodes()){if(ne(t)&&t.getFormatType()==="center")continue;let o=t.getParent();if(!(ne(o)&&o.getFormatType()==="center"))return!1}return!0},key:"alignCenter",label:({i18n:e})=>e.t("lexical:align:alignCenterLabel"),onSelect:({editor:e})=>{e.dispatchCommand(tt,"center")},order:2},{ChildComponent:Ko,isActive:({selection:e})=>{if(!et(e))return!1;for(let t of e.getNodes()){if(ne(t)&&t.getFormatType()==="right")continue;let o=t.getParent();if(!(ne(o)&&o.getFormatType()==="right"))return!1}return!0},key:"alignRight",label:({i18n:e})=>e.t("lexical:align:alignRightLabel"),onSelect:({editor:e})=>{e.dispatchCommand(tt,"right")},order:3},{ChildComponent:Vo,isActive:({selection:e})=>{if(!et(e))return!1;for(let t of e.getNodes()){if(ne(t)&&t.getFormatType()==="justify")continue;let o=t.getParent();if(!(ne(o)&&o.getFormatType()==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:e})=>e.t("lexical:align:alignJustifyLabel"),onSelect:({editor:e})=>{e.dispatchCommand(tt,"justify")},order:4}])],Nl=E({toolbarFixed:{groups:Xo},toolbarInline:{groups:Xo}});import{$createQuoteNode as or,$isQuoteNode as er,QuoteNode as Rl}from"@lexical/rich-text";import{$setBlocksType as rr}from"@lexical/selection";import{$getSelection as nr,$isRangeSelection as Sl}from"lexical";import{jsx as Jo}from"react/jsx-runtime";var Ut=()=>Jo("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:Jo("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 Yo}from"react/jsx-runtime";var Ae=()=>Yo("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:Yo("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 z=e=>({type:"dropdown",ChildComponent:Ae,items:e,key:"text",order:25});import{$createQuoteNode as kl,$isQuoteNode as qo,QuoteNode as wl}from"@lexical/rich-text";import{$createLineBreakNode as _l}from"lexical";var Qo={type:"element",dependencies:[wl],export:(e,t)=>{if(!qo(e))return null;let o=t(e).split(`
|
|
1
|
+
"use client";import{a as It,c as ll,e as sl,f as al,g as cl,h as dl}from"./chunk-EBB2CEB6.js";import{a as Ne,b as Ft,c as ke,d as Ho,e as Bo}from"./chunk-KTD7OXVC.js";import{a as we,b as Ze,c as Xe,d as Je}from"./chunk-Q5DYR7MH.js";import{a as _e,b as Re,c as Se,d as Mt}from"./chunk-HO42U3IJ.js";import{a as le,b as Ye,c as ve,d as Ie,e as Fe,f as Pt}from"./chunk-SFUMQAVE.js";import{a as il,b as G}from"./chunk-QZIAQPM7.js";function B(e){return{items:e,key:"basic",label:({i18n:t})=>t.t("lexical:general:slashMenuBasicGroupLabel")}}import{createHeadlessEditor as ul}from"@lexical/headless";import{useClientFunctions as pl,useTableCell as ml}from"@payloadcms/ui";import{$getRoot as fl}from"lexical";import At,{useEffect as Uo,useState as Dt}from"react";var $o={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 Me={namespace:"lexical",theme:$o};function qe({clientFunctions:e,schemaPath:t,unSanitizedEditorConfig:o}){for(let l of o.features)if(!l?.clientFeatureProps?.featureKey||l?.clientFeatureProps?.order===void 0||l?.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.");o.features=o.features.sort((l,s)=>l.clientFeatureProps.order-s.clientFeatureProps.order);let r=new Map(o.features.map(l=>[l.clientFeatureProps.featureKey,l])),n=new Map,i=0;for(let l of o.features){let s={};Object.entries(e).forEach(([c,d])=>{if(c.startsWith(`lexicalFeature.${t}.${l.clientFeatureProps.featureKey}.components.`)){let u=c.split(`${t}.${l.clientFeatureProps.featureKey}.components.`)[1];s[u]=d}});let a=typeof l.feature=="function"?l.feature({clientFunctions:s,featureProviderMap:r,resolvedFeatures:n,unSanitizedEditorConfig:o}):l.feature;n.set(l.clientFeatureProps.featureKey,{...a,key:l.clientFeatureProps.featureKey,order:i}),i++}return n}var Go=e=>{let t={enabledFeatures:[],hooks:{load:[],save:[]},markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}};if(!e?.size)return t;e.forEach(o=>{if(o.hooks&&(o.hooks?.load?.length&&(t.hooks.load=t.hooks.load.concat(o.hooks.load)),o.hooks?.save?.length&&(t.hooks.save=t.hooks.save.concat(o.hooks.save))),o.providers?.length&&(t.providers=t.providers.concat(o.providers)),o.nodes?.length&&(t.nodes=t.nodes.concat(o.nodes)),o.plugins?.length&&o.plugins.forEach((r,n)=>{t.plugins.push({Component:r.Component,clientProps:o.sanitizedClientFeatureProps,key:o.key+n,position:r.position})}),o.toolbarInline?.groups?.length)for(let r of o.toolbarInline.groups){let n=t.toolbarInline.groups.find(i=>i.key===r.key);n?t.toolbarInline.groups=t.toolbarInline.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),t.toolbarInline?.groups.push(n)}if(o.toolbarFixed?.groups?.length)for(let r of o.toolbarFixed.groups){let n=t.toolbarFixed.groups.find(i=>i.key===r.key);n?t.toolbarFixed.groups=t.toolbarFixed.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),t.toolbarFixed?.groups.push(n)}if(o.slashMenu?.groups){o.slashMenu.dynamicGroups?.length&&(t.slashMenu.dynamicGroups=t.slashMenu.dynamicGroups.concat(o.slashMenu.dynamicGroups));for(let r of o.slashMenu.groups){let n=t.slashMenu.groups.find(i=>i.key===r.key);n?t.slashMenu.groups=t.slashMenu.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),t.slashMenu.groups.push(n)}}o.markdownTransformers?.length&&(t.markdownTransformers=t.markdownTransformers.concat(o.markdownTransformers)),t.enabledFeatures.push(o.key)}),t.toolbarInline.groups.sort((o,r)=>o.order&&r.order?o.order-r.order:o.order?-1:r.order?1:0),t.toolbarFixed.groups.sort((o,r)=>o.order&&r.order?o.order-r.order:o.order?-1:r.order?1:0);for(let o of t.toolbarInline.groups)o.items.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);for(let o of t.toolbarFixed.groups)o.items.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);return t};function Pe(e,t,o){return{admin:o,features:Go(t),lexical:e,resolvedFeatureMap:t}}import{jsx as Wo,jsxs as Cl}from"react/jsx-runtime";var gl=e=>{let{admin:t,lexicalEditorConfig:o,richTextComponentMap:r}=e,[n,i]=At.useState("Loading..."),{cellData:l,cellProps:{schemaPath:s}}=ml(),a=pl(),[c,d]=Dt(!1),[u,m]=Dt([]),[f,C]=Dt(null),g=r.get("features").sort((b,S)=>b.order-S.order),x=0;for(let b of g){let S=Array.from(r.keys()).filter(I=>I.startsWith(`feature.${b.key}.components.`));x+=1,x+=S.length}return Uo(()=>{if(!c){let b=[],S=0;if(Object.entries(a).forEach(([I,T])=>{I.startsWith(`lexicalFeature.${s}.`)&&(I.includes(".lexical_internal_components.")||b.push(T),S++)}),S===x){m(b),d(!0);let I=qe({clientFunctions:a,schemaPath:s,unSanitizedEditorConfig:{features:b,lexical:o}});C(Pe(o||Me,I,t))}}},[t,g,c,a,s,g.length,u,f,o,r,x]),Uo(()=>{if(!c)return;let b=l;if(b==null||!c||!f){i("");return}if(f?.features?.hooks?.load?.length&&f.features.hooks.load.forEach(T=>{b=T({incomingEditorState:b})}),!b||typeof b!="object"){i("");return}if(Array.isArray(b)&&!("root"in b)){i("");return}if("jsonContent"in b){i("");return}let S=ul({namespace:f.lexical.namespace,nodes:It({editorConfig:f}),theme:f.lexical.theme});S.setEditorState(S.parseEditorState(b));let I=S.getEditorState().read(()=>fl().getTextContent())||"";i(I)},[l,o,c,f]),c?Wo("span",{children:n}):Wo(At.Fragment,{children:Array.isArray(g)&&g.map(b=>{let I=Array.from(r.keys()).filter(T=>T.startsWith(`lexical_internal_feature.${b.key}.lexical_internal_components.`)).map(T=>r.get(T));return Cl(At.Fragment,{children:[I?.length?I.map(T=>T):null,b.ClientFeature]},b.key)})})};import{$isElementNode as ne,$isRangeSelection as et,FORMAT_ELEMENT_COMMAND as tt}from"lexical";import{jsx as Ot,jsxs as hl}from"react/jsx-runtime";var zo=()=>hl("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 Ht,jsxs as xl}from"react/jsx-runtime";var Vo=()=>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:[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:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Bt,jsxs as bl}from"react/jsx-runtime";var Qe=()=>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:[Bt("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Bt("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Bt("path",{d:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as $t,jsxs as Tl}from"react/jsx-runtime";var Ko=()=>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:[$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:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{useAddClientFunction as El,useFieldProps as yl,useTableCell as Ll}from"@payloadcms/ui";var jo=(e,t)=>{let{schemaPath:o}=yl(),i=Ll()?.cellProps?.schemaPath||o;El(`lexicalFeature.${i}.${e}`,t)};var Gt=e=>t=>(jo(t.featureKey,e(t)),null);var E=e=>Gt(o=>{let r={clientFeatureProps:o};return typeof e=="function"?r.feature=({clientFunctions:n,featureProviderMap:i,resolvedFeatures:l,unSanitizedEditorConfig:s})=>{let a=e({clientFunctions:n,featureProviderMap:i,props:o,resolvedFeatures:l,unSanitizedEditorConfig:s});return a.sanitizedClientFeatureProps===null&&(a.sanitizedClientFeatureProps=o),a}:(e.sanitizedClientFeatureProps=o,r.feature=e),r});var Zo=e=>({type:"dropdown",ChildComponent:Qe,items:e,key:"align",order:30});var Xo=[Zo([{ChildComponent:Qe,isActive:({selection:e})=>{if(!et(e))return!1;for(let t of e.getNodes()){if(ne(t)&&t.getFormatType()==="left")continue;let o=t.getParent();if(!(ne(o)&&o.getFormatType()==="left"))return!1}return!0},key:"alignLeft",label:({i18n:e})=>e.t("lexical:align:alignLeftLabel"),onSelect:({editor:e})=>{e.dispatchCommand(tt,"left")},order:1},{ChildComponent:zo,isActive:({selection:e})=>{if(!et(e))return!1;for(let t of e.getNodes()){if(ne(t)&&t.getFormatType()==="center")continue;let o=t.getParent();if(!(ne(o)&&o.getFormatType()==="center"))return!1}return!0},key:"alignCenter",label:({i18n:e})=>e.t("lexical:align:alignCenterLabel"),onSelect:({editor:e})=>{e.dispatchCommand(tt,"center")},order:2},{ChildComponent:Ko,isActive:({selection:e})=>{if(!et(e))return!1;for(let t of e.getNodes()){if(ne(t)&&t.getFormatType()==="right")continue;let o=t.getParent();if(!(ne(o)&&o.getFormatType()==="right"))return!1}return!0},key:"alignRight",label:({i18n:e})=>e.t("lexical:align:alignRightLabel"),onSelect:({editor:e})=>{e.dispatchCommand(tt,"right")},order:3},{ChildComponent:Vo,isActive:({selection:e})=>{if(!et(e))return!1;for(let t of e.getNodes()){if(ne(t)&&t.getFormatType()==="justify")continue;let o=t.getParent();if(!(ne(o)&&o.getFormatType()==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:e})=>e.t("lexical:align:alignJustifyLabel"),onSelect:({editor:e})=>{e.dispatchCommand(tt,"justify")},order:4}])],Nl=E({toolbarFixed:{groups:Xo},toolbarInline:{groups:Xo}});import{$createQuoteNode as or,$isQuoteNode as er,QuoteNode as Rl}from"@lexical/rich-text";import{$setBlocksType as rr}from"@lexical/selection";import{$getSelection as nr,$isRangeSelection as Sl}from"lexical";import{jsx as Jo}from"react/jsx-runtime";var Ut=()=>Jo("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:Jo("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 Yo}from"react/jsx-runtime";var Ae=()=>Yo("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:Yo("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 z=e=>({type:"dropdown",ChildComponent:Ae,items:e,key:"text",order:25});import{$createQuoteNode as kl,$isQuoteNode as qo,QuoteNode as wl}from"@lexical/rich-text";import{$createLineBreakNode as _l}from"lexical";var Qo={type:"element",dependencies:[wl],export:(e,t)=>{if(!qo(e))return null;let o=t(e).split(`
|
|
2
2
|
`),r=[];for(let n of o)r.push("> "+n);return r.join(`
|
|
3
3
|
`)},regExp:/^>\s/,replace:(e,t,o,r)=>{if(r){let i=e.getPreviousSibling();if(qo(i)){i.splice(i.getChildrenSize(),0,[_l(),...t]),i.select(0,0),e.remove();return}}let n=kl();n.append(...t),e.replace(n),n.select(0,0)}};var tr=[z([{ChildComponent:Ut,isActive:({selection:e})=>{if(!Sl(e))return!1;for(let t of e.getNodes())if(!er(t)&&!er(t.getParent()))return!1;return!0},key:"blockquote",label:({i18n:e})=>e.t("lexical:blockquote:label"),onSelect:({editor:e})=>{e.update(()=>{let t=nr();rr(t,()=>or())})},order:20}])],vl=E({markdownTransformers:[Qo],nodes:[Rl],slashMenu:{groups:[B([{Icon:Ut,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:e})=>e.t("lexical:blockquote:label"),onSelect:({editor:e})=>{e.update(()=>{let t=nr();rr(t,()=>or())})}}])]},toolbarFixed:{groups:tr},toolbarInline:{groups:tr}});import{getTranslation as lt}from"@payloadcms/translations";import{jsx as Wt,jsxs as Il}from"react/jsx-runtime";var ot=()=>Il("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:[Wt("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),Wt("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),Wt("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as ir}from"react/jsx-runtime";var rt=()=>ir("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:ir("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{DecoratorBlockNode as Fl}from"@lexical/react/LexicalDecoratorBlockNode.js";import Ml from"bson-objectid";import{deepCopyObjectSimple as Pl}from"payload/shared";import Al from"react";import{jsx as Hl}from"react/jsx-runtime";var Dl=Al.lazy(()=>import("./component-TYPMHBL7.js").then(e=>({default:e.BlockComponent}))),J=class e extends Fl{__fields;constructor({fields:t,format:o,key:r}){super(o,r),this.__fields=t}static clone(t){return new e({fields:t.__fields,format:t.__format,key:t.__key})}static getType(){return"block"}static importDOM(){return{}}static importJSON(t){t.version===1&&(t={...t,fields:{...t.fields.data},version:2});let o=nt(t.fields);return o.setFormat(t.format),o}static isInline(){return!1}decorate(t,o){return Hl(Dl,{formData:this.getFields(),nodeKey:this.getKey()})}exportDOM(){let t=document.createElement("div"),o=document.createTextNode(this.getTextContent());return t.append(o),{element:t}}exportJSON(){return{...super.exportJSON(),type:"block",fields:this.getFields(),version:2}}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}setFields(t){let o=Pl(t),r=this.getWritable();r.__fields=o}};function nt(e){return new J({fields:{...e,id:e?.id||new Ml.default().toHexString()}})}function Ol(e){return e instanceof J}import{useLexicalComposerContext as Bl}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as $l,$wrapNodeInElement as Gl,mergeRegister as Ul}from"@lexical/utils";import{getTranslation as Wl}from"@payloadcms/translations";import{useModal as zl,useTranslation as Vl}from"@payloadcms/ui";import{$createParagraphNode as Kl,$getNodeByKey as jl,$getPreviousSelection as Zl,$getSelection as lr,$insertNodes as Xl,$isParagraphNode as sr,$isRangeSelection as ar,$isRootOrShadowRoot as Jl,COMMAND_PRIORITY_EDITOR as zt}from"lexical";import{useEffect as Yl,useState as Vt}from"react";import{jsx as ql}from"react/jsx-runtime";var it="lexical-inlineBlocks-create",cr=()=>{let[e]=Bl(),{closeModal:t,toggleModal:o}=zl(),[r,n]=Vt(null),[i,l]=Vt(""),[s,a]=Vt(null),{i18n:c,t:d}=Vl(),{editorConfig:u}=G(),m=u?.resolvedFeatureMap?.get("blocks")?.sanitizedClientFeatureProps?.reducedInlineBlocks?.find(C=>C.slug===r?.blockType);Yl(()=>{if(!e.hasNodes([J]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return Ul(e.registerCommand(Ne,C=>(e.update(()=>{let g=lr()||Zl();if(ar(g)){let x=nt(C);$l(x);let{focus:b}=g,S=b.getNode();sr(S)&&S.getTextContentSize()===0&&S.getParent().getChildren().filter(I=>sr(I)).length>1&&S.remove()}}),!0),zt),e.registerCommand(Ft,C=>{if(s){let x=jl(s);return x?(x.setFields(C),a(null),!0):!1}let g=Bo(C);return Xl([g]),Jl(g.getParentOrThrow())&&Gl(g,Kl).selectEnd(),!0},zt),e.registerCommand(ke,({fields:C,nodeKey:g})=>{if(n(C??null),a(g??null),l(C?.blockType??""),g)return o(it),!0;let x=null;return e.getEditorState().read(()=>{let b=lr();ar(b)&&(x=b)}),x&&o(it),!0},zt))},[e,s,o]);let f=m?.labels?.singular?Wl(m?.labels?.singular,c):m?.slug;return ql(le,{data:r,drawerSlug:it,drawerTitle:d(`lexical:blocks:inlineBlocks:${r?.id?"edit":"create"}`,{label:f??d("lexical:blocks:inlineBlocks:label")}),featureKey:"blocks",handleDrawerSubmit:(C,g)=>{t(it),g&&(g.blockType=i,e.dispatchCommand(Ft,g))},schemaPathSuffix:r?.blockType})};var Ql=E(({props:e})=>({nodes:[J,Ho],plugins:[{Component:cr,position:"normal"}],sanitizedClientFeatureProps:e,slashMenu:{groups:[e.reducedBlocks?.length?{items:e.reducedBlocks.map(t=>({Icon:ot,key:"block-"+t.slug,keywords:["block","blocks",t.slug],label:({i18n:o})=>t.labels.singular?lt(t.labels.singular,o):t.slug,onSelect:({editor:o})=>{o.dispatchCommand(Ne,{id:null,blockName:"",blockType:t.slug})}})),key:"blocks",label:({i18n:t})=>t.t("lexical:blocks:label")}:null,e.reducedInlineBlocks?.length?{items:e.reducedInlineBlocks.map(t=>({Icon:rt,key:"inlineBlocks-"+t.slug,keywords:["inlineBlock","inline block",t.slug],label:({i18n:o})=>t.labels.singular?lt(t.labels.singular,o):t.slug,onSelect:({editor:o})=>{o.dispatchCommand(ke,{fields:{id:null,blockName:"",blockType:t.slug}})}})),key:"inlineBlocks",label:({i18n:t})=>t.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[e.reducedBlocks?.length?{type:"dropdown",ChildComponent:ot,items:e.reducedBlocks.map((t,o)=>({ChildComponent:ot,isActive:void 0,key:"block-"+t.slug,label:({i18n:r})=>t.labels.singular?lt(t.labels.singular,r):t.slug,onSelect:({editor:r})=>{r.dispatchCommand(Ne,{id:null,blockName:"",blockType:t.slug})},order:o})),key:"blocks",order:20}:null,e.reducedInlineBlocks?.length?{type:"dropdown",ChildComponent:rt,items:e.reducedInlineBlocks.map((t,o)=>({ChildComponent:rt,isActive:void 0,key:"inlineBlock-"+t.slug,label:({i18n:r})=>t.labels.singular?lt(t.labels.singular,r):t.slug,onSelect:({editor:r})=>{r.dispatchCommand(ke,{fields:{blockType:t.slug}})},order:o})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}));import{useLexicalComposerContext as os}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as rs,$createTextNode as ns,$getRoot as is}from"lexical";import*as fr from"react";import{useCallback as se,useEffect as Kt,useLayoutEffect as ur,useRef as jt,useState as st}from"react";var K=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";var es=K&&"documentMode"in document?document.documentMode:null,dr=K&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Zf=K&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Xf=K&&"InputEvent"in window&&!es?"getTargetRanges"in new window.InputEvent("input"):!1,Jf=K&&/Version\/[\d.].*Safari/.test(navigator.userAgent),Yf=K&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,qf=K&&/Android/.test(navigator.userAgent),Qf=K&&/Win/.test(navigator.platform),ts=K&&/^(?=.*Chrome).*/i.test(navigator.userAgent),e1=K&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!ts;import{jsx as ae,jsxs as Zt}from"react/jsx-runtime";var ls=e=>{let t=document.createElement("textarea");t.value=e||"",t.style.position="absolute",t.style.opacity="0",document.body?.appendChild(t),t.focus(),t.select();try{let o=document.execCommand("copy");console.log(o)}catch(o){console.error(o)}document.body?.removeChild(t)},ss=(e,t)=>{let o=document.createElement("a");o.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(t||"")),o.setAttribute("download",e),o.style.display="none",document.body?.appendChild(o),o.click(),document.body?.removeChild(o)},as=e=>{let o=((r,n)=>{switch(r){case"click":return` await page.mouse.click(${n.x}, ${n.y});`;case"press":return` await page.keyboard.press('${n}');`;case"keydown":return` await page.keyboard.keydown('${n}');`;case"keyup":return` await page.keyboard.keyup('${n}');`;case"type":return` await page.keyboard.type('${n}');`;case"selectAll":return" await selectAll(page);";case"snapshot":return` await assertHTMLSnapshot(page);
|
|
4
4
|
await assertSelection(page, {
|