@payloadcms/richtext-lexical 3.0.0-beta.70 → 3.0.0-beta.72
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/{Field-6VQ73D3D.js → Field-YNHIDK3D.js} +2 -2
- package/dist/exports/client/Field-YNHIDK3D.js.map +7 -0
- package/dist/exports/client/{RelationshipComponent-FFJCVTWM.js → RelationshipComponent-ZR2OCBGL.js} +2 -2
- package/dist/exports/client/bundled.css +1 -1
- package/dist/exports/client/{chunk-HO42U3IJ.js → chunk-6QXGZYUK.js} +2 -2
- package/dist/exports/client/{chunk-SFUMQAVE.js → chunk-IPCJ5EVK.js} +2 -2
- package/dist/exports/client/{chunk-QZIAQPM7.js → chunk-IWZVO3AI.js} +2 -2
- package/dist/exports/client/chunk-IWZVO3AI.js.map +7 -0
- package/dist/exports/client/{chunk-KTD7OXVC.js → chunk-VUVXZJJR.js} +2 -2
- package/dist/exports/client/{component-5K355FZZ.js → component-D4GWDXK5.js} +2 -2
- package/dist/exports/client/{component-TYPMHBL7.js → component-KA7FDRMA.js} +2 -2
- package/dist/exports/client/component-KA7FDRMA.js.map +7 -0
- package/dist/exports/client/{componentInline-3JDU4HVQ.js → componentInline-6EKPZSCV.js} +2 -2
- package/dist/exports/client/index.js +3 -3
- package/dist/exports/client/index.js.map +2 -2
- package/dist/features/blocks/component/BlockContent.d.ts +1 -2
- package/dist/features/blocks/component/BlockContent.d.ts.map +1 -1
- package/dist/features/blocks/component/BlockContent.js.map +1 -1
- package/dist/features/blocks/feature.client.d.ts +1 -2
- package/dist/features/blocks/feature.client.d.ts.map +1 -1
- package/dist/features/blocks/feature.client.js.map +1 -1
- package/dist/features/typesServer.d.ts +1 -1
- package/dist/features/typesServer.d.ts.map +1 -1
- package/dist/features/typesServer.js.map +1 -1
- package/dist/field/Field.d.ts +1 -1
- package/dist/field/Field.d.ts.map +1 -1
- package/dist/field/Field.js.map +1 -1
- package/dist/field/index.d.ts +1 -1
- package/dist/field/index.d.ts.map +1 -1
- package/dist/field/index.js +8 -8
- package/dist/field/index.js.map +1 -1
- package/dist/lexical/LexicalProvider.d.ts +1 -1
- package/dist/lexical/LexicalProvider.d.ts.map +1 -1
- package/dist/lexical/LexicalProvider.js.map +1 -1
- package/dist/lexical/config/client/EditorConfigProvider.d.ts +1 -1
- package/dist/lexical/config/client/EditorConfigProvider.d.ts.map +1 -1
- package/dist/lexical/config/client/EditorConfigProvider.js.map +1 -1
- package/dist/validate/validateNodes.d.ts +1 -1
- package/dist/validate/validateNodes.d.ts.map +1 -1
- package/dist/validate/validateNodes.js.map +1 -1
- package/package.json +9 -9
- package/dist/exports/client/Field-6VQ73D3D.js.map +0 -7
- package/dist/exports/client/chunk-QZIAQPM7.js.map +0 -7
- package/dist/exports/client/component-TYPMHBL7.js.map +0 -7
- /package/dist/exports/client/{RelationshipComponent-FFJCVTWM.js.map → RelationshipComponent-ZR2OCBGL.js.map} +0 -0
- /package/dist/exports/client/{chunk-HO42U3IJ.js.map → chunk-6QXGZYUK.js.map} +0 -0
- /package/dist/exports/client/{chunk-SFUMQAVE.js.map → chunk-IPCJ5EVK.js.map} +0 -0
- /package/dist/exports/client/{chunk-KTD7OXVC.js.map → chunk-VUVXZJJR.js.map} +0 -0
- /package/dist/exports/client/{component-5K355FZZ.js.map → component-D4GWDXK5.js.map} +0 -0
- /package/dist/exports/client/{componentInline-3JDU4HVQ.js.map → componentInline-6EKPZSCV.js.map} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createCommand as l}from"lexical";var h=l("INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND");import{DecoratorBlockNode as s}from"@lexical/react/LexicalDecoratorBlockNode.js";import*as n from"react";import{jsx as c}from"react/jsx-runtime";var p=n.lazy(()=>import("./RelationshipComponent-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{createCommand as l}from"lexical";var h=l("INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND");import{DecoratorBlockNode as s}from"@lexical/react/LexicalDecoratorBlockNode.js";import*as n from"react";import{jsx as c}from"react/jsx-runtime";var p=n.lazy(()=>import("./RelationshipComponent-ZR2OCBGL.js").then(a=>({default:a.RelationshipComponent})));function d(a){let t=a.getAttribute("data-lexical-relationship-id"),e=a.getAttribute("data-lexical-relationship-relationTo");return t!=null&&e!=null?{node:r({relationTo:e,value:t})}:null}var o=class a extends s{__data;constructor({data:t,format:e,key:i}){super(e,i),this.__data=t}static clone(t){return new a({data:t.__data,format:t.__format,key:t.__key})}static getType(){return"relationship"}static importDOM(){return{div:t=>!t.hasAttribute("data-lexical-relationship-relationTo")||!t.hasAttribute("data-lexical-relationship-id")?null:{conversion:d,priority:2}}}static importJSON(t){t.version===1&&t?.value?.id&&(t.value=t.value.id);let e={relationTo:t.relationTo,value:t.value},i=r(e);return i.setFormat(t.format),i}static isInline(){return!1}decorate(t,e){return c(p,{className:e.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportDOM(){let t=document.createElement("div");t.setAttribute("data-lexical-relationship-id",String(this.__data?.value)),t.setAttribute("data-lexical-relationship-relationTo",this.__data?.relationTo);let e=document.createTextNode(this.getTextContent());return t.append(e),{element:t}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"relationship",version:2}}getData(){return this.getLatest().__data}getTextContent(){return`${this.__data?.relationTo} relation to ${this.__data?.value}`}setData(t){let e=this.getWritable();e.__data=t}};function r(a){return new o({data:a})}function x(a){return a instanceof o}export{h as a,o as b,r as c,x as d};
|
|
2
|
+
//# sourceMappingURL=chunk-6QXGZYUK.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as y}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as y}from"./chunk-IWZVO3AI.js";import{Drawer as $}from"@payloadcms/ui";import{Form as w,FormSubmit as R,RenderFields as F,useConfig as E,useDocumentInfo as M,useFieldProps as T,useTranslation as A}from"@payloadcms/ui";import{getFormState as g}from"@payloadcms/ui/shared";import{useCallback as L,useEffect as P,useState as I}from"react";import{v4 as k}from"uuid";import{jsx as D,jsxs as N}from"react/jsx-runtime";var C=({data:e,featureKey:t,handleDrawerSubmit:o,schemaPathSuffix:a})=>{let{t:i}=A(),{id:n}=M(),{schemaPath:l}=T(),r=E(),[p,x]=I(!1),{field:{richTextComponentMap:_}}=y(),U=`lexical_internal_feature.${t}.fields${a?`.${a}`:""}`,s=`${l}.lexical_internal_feature.${t}${a?`.${a}`:""}`,d=_.get(U);P(()=>{(async()=>{let O=await g({apiRoute:r.routes.api,body:{id:n,data:e??{},operation:"update",schemaPath:s},serverURL:r.serverURL});x(O)})()},[r.routes.api,r.serverURL,s,n,e]);let m=L(async({formState:f})=>await g({apiRoute:r.routes.api,body:{id:n,formState:f,operation:"update",schemaPath:s},serverURL:r.serverURL}),[r.routes.api,r.serverURL,s,n]);return p===!1?null:N(w,{beforeSubmit:[m],disableValidationOnSubmit:!0,fields:Array.isArray(d)?d:[],initialState:p,onChange:[m],onSubmit:o,uuid:k(),children:[D(F,{fieldMap:Array.isArray(d)?d:[],forceRender:!0,path:"",readOnly:!1,schemaPath:s}),D(R,{children:i("fields:saveChanges")})]})};import{jsx as S}from"react/jsx-runtime";var lt=({className:e,data:t,drawerSlug:o,drawerTitle:a,featureKey:i,handleDrawerSubmit:n,schemaPathSuffix:l})=>S($,{className:e,slug:o,title:a??"",children:S(C,{data:t,featureKey:i,handleDrawerSubmit:n,schemaPathSuffix:l})});import{useAuth as J,useConfig as H,useEntityVisibility as B}from"@payloadcms/ui";import*as c from"react";var K=(e,t)=>e.filter(({slug:o,admin:{enableRichTextRelationship:a},upload:i})=>t.visibleEntities.collections.includes(o)?t?.uploads?a&&!!i:i?!1:a:!1),ct=e=>{let{children:t,uploads:o=!1,...a}=e,{collections:i}=H(),{user:n}=J(),{visibleEntities:l}=B(),[r]=c.useState(()=>K(i,{uploads:o,user:n,visibleEntities:l}).map(({slug:p})=>p));return r.length?c.cloneElement(t,{...a,enabledCollectionSlugs:r}):null};import{createCommand as W}from"lexical";var ft=W("INSERT_UPLOAD_WITH_DRAWER_COMMAND");import{DecoratorBlockNode as j}from"@lexical/react/LexicalDecoratorBlockNode.js";import b from"bson-objectid";import{$applyNodeReplacement as V}from"lexical";import*as h from"react";import{jsx as Q}from"react/jsx-runtime";var X=h.lazy(()=>import("./component-D4GWDXK5.js").then(e=>({default:e.UploadComponent})));function G(e){return e.parentElement!=null&&e.parentElement.tagName==="LI"&&e.previousSibling===null&&e.getAttribute("aria-roledescription")==="checkbox"}function q(e){if(e.hasAttribute("data-lexical-upload-relation-to")&&e.hasAttribute("data-lexical-upload-id")){let o=e.getAttribute("data-lexical-upload-id"),a=e.getAttribute("data-lexical-upload-relation-to");if(o!=null&&a!=null)return{node:v({data:{fields:{},relationTo:a,value:o}})}}let t=e;return t.src.startsWith("file:///")||G(t),null}var u=class e extends j{__data;constructor({data:t,format:o,key:a}){super(o,a),this.__data=t}static clone(t){return new e({data:t.__data,format:t.__format,key:t.__key})}static getType(){return"upload"}static importDOM(){return{img:t=>({conversion:q,priority:0})}}static importJSON(t){t.version===1&&t?.value?.id&&(t.value=t.value.id),t.version===2&&!t?.id&&(t.id=new b.default().toHexString(),t.version=3);let o={id:t.id,fields:t.fields,relationTo:t.relationTo,value:t.value},a=v({data:o});return a.setFormat(t.format),a}static isInline(){return!1}decorate(){return Q(X,{data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportDOM(){let t=document.createElement("img");return t.setAttribute("data-lexical-upload-id",String(this.__data?.value)),t.setAttribute("data-lexical-upload-relation-to",this.__data?.relationTo),{element:t}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"upload",version:3}}getData(){return this.getLatest().__data}setData(t){let o=this.getWritable();o.__data=t}updateDOM(){return!1}};function v({data:e}){return e?.id||(e.id=new b.default().toHexString()),V(new u({data:e}))}function St(e){return e instanceof u}export{lt as a,ct as b,ft as c,u as d,v as e,St as f};
|
|
2
|
+
//# sourceMappingURL=chunk-IPCJ5EVK.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{useLexicalComposerContext as m}from"@lexical/react/LexicalComposerContext.js";import{createContext as y,useContext as T,useMemo as R,useRef as g,useState as l}from"react";import{jsx as M}from"react/jsx-runtime";function h(){return Math.random().toString(36).substring(2,12)+Math.random().toString(36).substring(2,12)}var p=y({editorConfig:null,field:null,uuid:null}),b=({children:i,editorConfig:s,editorContainerRef:c,fieldProps:
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{useLexicalComposerContext as m}from"@lexical/react/LexicalComposerContext.js";import{createContext as y,useContext as T,useMemo as R,useRef as g,useState as l}from"react";import{jsx as M}from"react/jsx-runtime";function h(){return Math.random().toString(36).substring(2,12)+Math.random().toString(36).substring(2,12)}var p=y({editorConfig:null,field:null,uuid:null}),b=({children:i,editorConfig:s,editorContainerRef:c,fieldProps:C,parentContext:r})=>{let[u]=m(),[a]=l(h()),e=g(new Map),[f,E]=l(null),n=g(new Set),x=R(()=>({blurEditor:t=>{n.current.clear()},childrenEditors:e,editor:u,editorConfig:s,editorContainerRef:c,field:C,focusEditor:t=>{let o=t.uuid;n.current.has(o)||(n.current.add(o),E(t),r?.uuid&&r.focusEditor(t),e.current.forEach((d,v)=>{d.focusEditor(t)}),n.current.clear())},focusedEditor:f,parentEditor:r,registerChild:(t,o)=>{if(!e.current.has(t)){let d=new Map(e.current);d.set(t,o),e.current=d}},unregisterChild:t=>{if(e.current.has(t)){let o=new Map(e.current);o.delete(t),e.current=o}},uuid:a}),[u,e,s,c,C,f,r,a]);return M(p.Provider,{value:x,children:i})},F=()=>{let i=T(p);if(i===void 0)throw new Error("useEditorConfigContext must be used within an EditorConfigProvider");return i};export{b as a,F as b};
|
|
2
|
+
//# sourceMappingURL=chunk-IWZVO3AI.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/lexical/config/client/EditorConfigProvider.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport type { LexicalEditor } from 'lexical'\nimport type { FormFieldBase } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport * as React from 'react'\nimport { createContext, useContext, useMemo, useRef, useState } from 'react'\n\nimport type { SanitizedClientEditorConfig } from '../types.js'\n\n// Should always produce a 20 character pseudo-random string\nfunction generateQuickGuid(): string {\n return Math.random().toString(36).substring(2, 12) + Math.random().toString(36).substring(2, 12)\n}\n\nexport interface EditorConfigContextType {\n // Editor focus handling\n blurEditor: (editorContext: EditorConfigContextType) => void\n childrenEditors: React.RefObject<Map<string, EditorConfigContextType>>\n editor: LexicalEditor\n editorConfig: SanitizedClientEditorConfig\n editorContainerRef: React.RefObject<HTMLDivElement>\n field: {\n editorConfig: SanitizedClientEditorConfig // With rendered features n stuff\n name: string\n richTextComponentMap: Map<string, React.ReactNode>\n } & FormFieldBase\n // Editor focus handling\n focusEditor: (editorContext: EditorConfigContextType) => void\n focusedEditor: EditorConfigContextType | null\n parentEditor: EditorConfigContextType\n registerChild: (uuid: string, editorContext: EditorConfigContextType) => void\n unregisterChild?: (uuid: string) => void\n uuid: string\n}\n\nconst Context: React.Context<EditorConfigContextType> = createContext({\n editorConfig: null,\n field: null,\n uuid: null,\n})\n\nexport const EditorConfigProvider = ({\n children,\n editorConfig,\n editorContainerRef,\n fieldProps,\n parentContext,\n}: {\n children: React.ReactNode\n editorConfig: SanitizedClientEditorConfig\n editorContainerRef: React.RefObject<HTMLDivElement>\n fieldProps: {\n editorConfig: SanitizedClientEditorConfig // With rendered features n stuff\n name: string\n richTextComponentMap: Map<string, React.ReactNode>\n } & FormFieldBase\n parentContext?: EditorConfigContextType\n}): React.ReactNode => {\n const [editor] = useLexicalComposerContext()\n // State to store the UUID\n const [uuid] = useState(generateQuickGuid())\n\n const childrenEditors = useRef<Map<string, EditorConfigContextType>>(new Map())\n const [focusedEditor, setFocusedEditor] = useState<EditorConfigContextType | null>(null)\n const focusHistory = useRef<Set<string>>(new Set())\n\n const editorContext = useMemo(\n () =>\n ({\n blurEditor: (editorContext: EditorConfigContextType) => {\n //setFocusedEditor(null) // Clear focused editor\n focusHistory.current.clear() // Reset focus history when focus is lost\n },\n childrenEditors,\n editor,\n editorConfig,\n editorContainerRef,\n field: fieldProps,\n focusEditor: (editorContext: EditorConfigContextType) => {\n const editorUUID = editorContext.uuid\n\n // Avoid recursion by checking if this editor is already focused in this cycle\n if (focusHistory.current.has(editorUUID)) {\n return\n }\n\n // Add this editor to the history to prevent future recursions in this cycle\n focusHistory.current.add(editorUUID)\n setFocusedEditor(editorContext)\n\n // Propagate focus event to parent and children, ensuring they do not refocus this editor\n if (parentContext?.uuid) {\n parentContext.focusEditor(editorContext)\n }\n childrenEditors.current.forEach((childEditor, childUUID) => {\n childEditor.focusEditor(editorContext)\n })\n\n focusHistory.current.clear()\n },\n focusedEditor,\n parentEditor: parentContext,\n registerChild: (childUUID, childEditorContext) => {\n if (!childrenEditors.current.has(childUUID)) {\n const newMap = new Map(childrenEditors.current)\n newMap.set(childUUID, childEditorContext)\n childrenEditors.current = newMap\n }\n },\n unregisterChild: (childUUID) => {\n if (childrenEditors.current.has(childUUID)) {\n const newMap = new Map(childrenEditors.current)\n newMap.delete(childUUID)\n childrenEditors.current = newMap\n }\n },\n\n uuid,\n }) as EditorConfigContextType,\n [\n editor,\n childrenEditors,\n editorConfig,\n editorContainerRef,\n fieldProps,\n focusedEditor,\n parentContext,\n uuid,\n ],\n )\n\n return <Context.Provider value={editorContext}>{children}</Context.Provider>\n}\n\nexport const useEditorConfigContext = (): EditorConfigContextType => {\n const context = useContext(Context)\n if (context === undefined) {\n throw new Error('useEditorConfigContext must be used within an EditorConfigProvider')\n }\n return context\n}\n"],
|
|
5
|
+
"mappings": "AAKA,OAAS,6BAAAA,MAAiC,2CAE1C,OAAS,iBAAAC,EAAe,cAAAC,EAAY,WAAAC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gB,QAAUS,CAC5B,CACF,EACA,gBAAkBF,GAAc,CAC9B,GAAIP,EAAgB,QAAQ,IAAIO,CAAS,EAAG,CAC1C,IAAME,EAAS,IAAI,IAAIT,EAAgB,OAAO,EAC9CS,EAAO,OAAOF,CAAS,EACvBP,EAAgB,QAAUS,CAC5B,CACF,EAEA,KAAAV,CACF,GACF,CACED,EACAE,EACAN,EACAC,EACAC,EACAK,EACAJ,EACAE,CACF,CACF,EAEA,OAAOV,EAACE,EAAQ,SAAR,CAAiB,MAAOa,EAAgB,SAAAX,EAAS,CAC3D,EAEaiB,EAAyB,IAA+B,CACnE,IAAMC,EAAU1B,EAAWM,CAAO,EAClC,GAAIoB,IAAY,OACd,MAAM,IAAI,MAAM,oEAAoE,EAEtF,OAAOA,CACT",
|
|
6
|
+
"names": ["useLexicalComposerContext", "createContext", "useContext", "useMemo", "useRef", "useState", "jsx", "generateQuickGuid", "Context", "EditorConfigProvider", "children", "editorConfig", "editorContainerRef", "fieldProps", "parentContext", "editor", "uuid", "childrenEditors", "focusedEditor", "setFocusedEditor", "focusHistory", "editorContext", "editorUUID", "childEditor", "childUUID", "childEditorContext", "newMap", "useEditorConfigContext", "context"]
|
|
7
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
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-
|
|
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-6EKPZSCV.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-VUVXZJJR.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{a as L,b as O,c as A,f as F}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=component-
|
|
1
|
+
"use client";import{a as L,b as O,c as A,f as F}from"./chunk-IPCJ5EVK.js";import{b as T}from"./chunk-IWZVO3AI.js";import{useLexicalComposerContext as X}from"@lexical/react/LexicalComposerContext.js";import{useLexicalNodeSelection as Z}from"@lexical/react/useLexicalNodeSelection.js";import{mergeRegister as ee}from"@lexical/utils";import{getTranslation as K}from"@payloadcms/translations";import{Button as N,DrawerToggler as oe,File as te,useConfig as ae,useDocumentDrawer as le,useDrawerSlug as re,useModal as ne,usePayloadAPI as ie,useTranslation as se}from"@payloadcms/ui";import{$getNodeByKey as E,$getSelection as de,$isNodeSelection as ce,CLICK_COMMAND as ue,COMMAND_PRIORITY_LOW as w,KEY_BACKSPACE_COMMAND as pe,KEY_DELETE_COMMAND as me}from"lexical";import{useCallback as i,useEffect as fe,useReducer as ge,useRef as Ce,useState as De}from"react";import{jsx as o,jsxs as s}from"react/jsx-runtime";var t="lexical-upload",B={depth:0},ve=d=>{let{data:{fields:I,relationTo:R,value:c},nodeKey:l}=d,{collections:k,routes:{api:j},serverURL:W}=ae(),C=Ce(null),{closeModal:y}=ne(),[a]=X(),[r,u,D]=Z(l),{editorConfig:Y,field:v}=T(),{i18n:S,t:p}=se(),[$,H]=ge(e=>e+1,0),[n]=De(()=>k.find(e=>e.slug===R)),m=re("upload-drawer"),[z,q,{closeDrawer:h}]=le({id:c,collectionSlug:n.slug}),[{data:f},{setParams:P}]=ie(`${W}${j}/${n.slug}/${c}`,{initialParams:B}),U=f?.thumbnailURL||f?.url,G=i(()=>{a.update(()=>{E(l).remove()})},[a,l]),J=i(e=>{P({...B,cacheBust:$}),H(),h()},[P,$,h]),_=i(e=>{if(r&&ce(de())){e.preventDefault();let g=E(l);if(F(g))return g.remove(),!0}return!1},[r,l]),M=i(e=>e.target===C.current||C.current?.contains(e.target)?(e.shiftKey?u(!r):r||(D(),u(!0)),!0):!1,[r,u,D]);fe(()=>ee(a.registerCommand(ue,M,w),a.registerCommand(me,_,w),a.registerCommand(pe,_,w)),[D,a,r,l,_,u,M]);let x=(Y?.resolvedFeatureMap?.get("upload")?.sanitizedClientFeatureProps).collections?.[n.slug]?.hasExtraFields,Q=i((e,g)=>{a.update(()=>{let b=E(l);if(b){let V={...b.getData(),fields:g};b.setData(V)}}),y(m)},[y,a,m,l]);return s("div",{className:[t,r&&`${t}--selected`].filter(Boolean).join(" "),contentEditable:!1,ref:C,children:[s("div",{className:`${t}__card`,children:[s("div",{className:`${t}__topRow`,children:[o("div",{className:`${t}__thumbnail`,children:U?o("img",{alt:f?.filename,"data-lexical-upload-id":c,"data-lexical-upload-relation-to":R,src:U}):o(te,{})}),s("div",{className:`${t}__topRowRightPanel`,children:[o("div",{className:`${t}__collectionLabel`,children:K(n.labels.singular,S)}),a.isEditable()&&s("div",{className:`${t}__actions`,children:[x?o(oe,{className:`${t}__upload-drawer-toggler`,disabled:v?.readOnly,slug:m,children:o(N,{buttonStyle:"icon-label",el:"div",icon:"edit",onClick:e=>{e.preventDefault()},round:!0,tooltip:p("fields:editRelationship")})}):null,o(N,{buttonStyle:"icon-label",disabled:v?.readOnly,el:"div",icon:"swap",onClick:()=>{a.dispatchCommand(A,{replace:{nodeKey:l}})},round:!0,tooltip:p("fields:swapUpload")}),o(N,{buttonStyle:"icon-label",className:`${t}__removeButton`,disabled:v?.readOnly,icon:"x",onClick:e=>{e.preventDefault(),G()},round:!0,tooltip:p("fields:removeUpload")})]})]})]}),o("div",{className:`${t}__bottomRow`,children:o(q,{className:`${t}__doc-drawer-toggler`,children:o("strong",{children:f?.filename})})})]}),c&&o(z,{onSave:J}),x?o(L,{data:I,drawerSlug:m,drawerTitle:p("general:editLabel",{label:K(n.labels.singular,S)}),featureKey:"upload",handleDrawerSubmit:Q,schemaPathSuffix:n.slug}):null]})},xe=d=>o(O,{...d,uploads:!0,children:o(ve,{...d})});export{xe as UploadComponent};
|
|
2
|
+
//# sourceMappingURL=component-D4GWDXK5.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{b as D}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=component-
|
|
1
|
+
"use client";import{b as D}from"./chunk-IWZVO3AI.js";import{Collapsible as te,Form as ae,Pill as le,SectionTitle as re,ShimmerEffect as ie,useConfig as se,useDocumentInfo as ne,useFieldProps as ce,useFormSubmitted as de,useTranslation as me}from"@payloadcms/ui";import{useCallback as pe,useEffect as fe,useMemo as ue,useState as ye}from"react";import{getTranslation as he}from"@payloadcms/translations";import{getFormState as K}from"@payloadcms/ui/shared";import{v4 as be}from"uuid";import{useLexicalComposerContext as W}from"@lexical/react/LexicalComposerContext.js";import{getTranslation as z}from"@payloadcms/translations";import{Button as H,Collapsible as q,ErrorPill as G,Pill as J,RenderFields as Q,SectionTitle as X,useDocumentInfo as Y,useFormSubmitted as Z,useTranslation as ee}from"@payloadcms/ui";import{dequal as oe}from"dequal/lite";import{$getNodeByKey as M}from"lexical";import w,{useCallback as A}from"react";import{useAllFormFields as U}from"@payloadcms/ui";import{reduceFieldsToValues as I}from"payload/shared";import{useEffect as j}from"react";function E({fields:s}){for(let e in s){let a=s[e];Array.isArray(a.rows)&&"value"in a&&(a.disableFormData=!0)}return s}var O=s=>{let{onChange:e}=s,[a]=U(),o=E({fields:a}),f=I(o,!0);return j(()=>{e&&e({fullFieldsWithValues:o,newFormData:f})},[f,e,o]),null};import{jsx as u,jsxs as L}from"react/jsx-runtime";var V=s=>{let{baseClass:e,field:a,formData:o,formSchema:f,nodeKey:n,reducedBlock:{LabelComponent:g,labels:B},schemaPath:T}=s,{i18n:C}=ee(),[c]=W(),{getDocPreferences:v,setDocFieldPreferences:_}=Y(),[x,d]=w.useState(()=>{let l=!1;return v().then(m=>{let t=m?.fields[a.name]?.collapsed;t&&t.includes(o.id)&&(l=!0,d(!0))}),l}),i=Z(),[h,S]=w.useState(0),k=i&&h>0,R=[`${e}__row`,k?`${e}__row--has-errors`:`${e}__row--no-errors`].filter(Boolean).join(" "),N=A(({fullFieldsWithValues:l,newFormData:m})=>{m={...m,id:o.id,blockType:o.blockType};function P(t){for(let r in t){let b=t[r];Array.isArray(b)&&!b?.length?delete t[r]:b&&typeof b=="object"?P(b):b==null&&delete t[r]}}if(P(m),P(o),oe(o,m)||setTimeout(()=>{c.update(()=>{let t=M(n);t&&t.setFields(m)})},0),i){let t=0;for(let r of Object.values(l))r?.valid===!1&&t++;S(t)}},[c,n,i,o]),$=A(l=>{v().then(m=>{let t=m?.fields[a.name]?.collapsed,r=t&&t?.length?t:[];l?r.includes(o.id)||r.push(o.id):r.includes(o.id)&&r.splice(r.indexOf(o.id),1),_(a.name,{collapsed:r,hello:"hi"})})},[v,a.name,_,o.id]),F=A(()=>{c.update(()=>{M(n).remove()})},[c,n]);return L(w.Fragment,{children:[u(q,{className:R,collapsibleStyle:k?"error":"default",header:g?u(g,{blockKind:"lexicalBlock",formData:o}):L("div",{className:`${e}__block-header`,children:[L("div",{children:[u(J,{className:`${e}__block-pill ${e}__block-pill-${o?.blockType}`,pillStyle:"white",children:typeof B.singular=="string"?z(B.singular,C):"[Singular Label]"}),u(X,{path:"blockName",readOnly:a?.readOnly}),k&&u(G,{count:h,i18n:C,withMessage:!0})]}),c.isEditable()&&u(H,{buttonStyle:"icon-label",className:`${e}__removeButton`,disabled:a?.readOnly,icon:"x",onClick:l=>{l.preventDefault(),F()},round:!0,tooltip:"Remove Block"})]}),isCollapsed:x,onToggle:l=>{$(l),d(l)},children:u(Q,{className:`${e}__fields`,fieldMap:Array.isArray(f)?f:[],forceRender:!0,margins:"small",path:"",readOnly:!1,schemaPath:T})},0),u(O,{onChange:N})]})};import{jsx as p,jsxs as Ce}from"react/jsx-runtime";var y="lexical-block",Ie=s=>{let{formData:e,nodeKey:a}=s,o=se(),f=de(),{id:n}=ne(),{path:g,schemaPath:B}=ce(),{editorConfig:T,field:C}=D(),[c,v]=ye(!1),{field:{richTextComponentMap:_}}=D(),x=`lexical_internal_feature.blocks.fields.${e?.blockType}`,d=`${B}.lexical_internal_feature.blocks.${e?.blockType}`,i=T?.resolvedFeatureMap?.get("blocks")?.sanitizedClientFeatureProps?.reducedBlocks?.find(F=>F.slug===e?.blockType),h=_.get(x);fe(()=>{e&&(async()=>{let l=await K({apiRoute:o.routes.api,body:{id:n,data:e,operation:"update",schemaPath:d},serverURL:o.serverURL});l&&v({...l,blockName:{initialValue:"",passesCondition:!0,valid:!0,value:e.blockName}})})()},[o.routes.api,o.serverURL,d,n]);let S=pe(async({formState:F})=>({...await K({apiRoute:o.routes.api,body:{id:n,formState:F,operation:"update",schemaPath:d},serverURL:o.serverURL}),blockName:{initialValue:"",passesCondition:!0,valid:!0,value:e.blockName}}),[o.routes.api,o.serverURL,d,n,e.blockName]),{i18n:k}=me(),R=[`${y}__row`,`${y}__row--no-errors`].filter(Boolean).join(" "),N=i?.LabelComponent,$=ue(()=>i&&c!==!1?p(ae,{beforeSubmit:[S],fields:h,initialState:c,onChange:[S],submitted:f,uuid:be(),children:p(V,{baseClass:y,field:C,formData:e,formSchema:Array.isArray(h)?h:[],nodeKey:a,path:`${g}.lexical_internal_feature.blocks.${e.blockType}`,reducedBlock:i,schemaPath:d})}):p(te,{className:R,collapsibleStyle:"default",header:N?p(N,{blockKind:"lexicalBlock",formData:e}):p("div",{className:`${y}__block-header`,children:Ce("div",{children:[p(le,{className:`${y}__block-pill ${y}__block-pill-${e?.blockType}`,pillStyle:"white",children:i&&typeof i.labels.singular=="string"?he(i.labels.singular,k):"[Singular Label]"}),p(re,{path:"blockName",readOnly:C?.readOnly})]})}),children:p(ie,{height:"35vh"})},0),[R,h,C,a,k,f,c,i,S,d,g]);return p("div",{className:y+" "+y+"-"+e.blockType,children:$})};export{Ie as BlockComponent};
|
|
2
|
+
//# sourceMappingURL=component-KA7FDRMA.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/features/blocks/component/index.tsx", "../../../src/features/blocks/component/BlockContent.tsx", "../../../src/features/blocks/component/FormSavePlugin.tsx", "../../../src/features/blocks/component/removeEmptyArrayValues.ts"],
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport type { FormProps } from '@payloadcms/ui'\n\nimport {\n Collapsible,\n Form,\n Pill,\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\nimport { type BlockFields } from '../nodes/BlocksNode.js'\nconst baseClass = 'lexical-block'\nimport type { FormState } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { getFormState } from '@payloadcms/ui/shared'\nimport { v4 as uuid } from 'uuid'\n\nimport type { ClientComponentProps } from '../../typesClient.js'\nimport type { BlocksFeatureClientProps, ClientBlock } from '../feature.client.js'\n\nimport { useEditorConfigContext } from '../../../lexical/config/client/EditorConfigProvider.js'\nimport { BlockContent } from './BlockContent.js'\ntype Props = {\n children?: React.ReactNode\n formData: BlockFields\n 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 { editorConfig, field: parentLexicalRichTextField } = useEditorConfigContext()\n\n const [initialState, setInitialState] = useState<FormState | false>(false)\n const {\n field: { richTextComponentMap },\n } = useEditorConfigContext()\n\n const componentMapRenderedFieldsPath = `lexical_internal_feature.blocks.fields.${formData?.blockType}`\n const schemaFieldsPath = `${schemaPath}.lexical_internal_feature.blocks.${formData?.blockType}`\n\n const reducedBlock: ClientBlock = (\n editorConfig?.resolvedFeatureMap?.get('blocks')\n ?.sanitizedClientFeatureProps as ClientComponentProps<BlocksFeatureClientProps>\n )?.reducedBlocks?.find((block) => block.slug === formData?.blockType)\n\n const fieldMap = richTextComponentMap.get(componentMapRenderedFieldsPath)\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 }) // Form State\n\n if (state) {\n setInitialState({\n ...state,\n blockName: {\n initialValue: '',\n passesCondition: true,\n valid: true,\n value: formData.blockName,\n },\n })\n }\n }\n\n if (formData) {\n void awaitInitialState()\n }\n }, [config.routes.api, config.serverURL, schemaFieldsPath, id])\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 return {\n ...formState,\n blockName: {\n initialValue: '',\n passesCondition: true,\n valid: true,\n value: formData.blockName,\n },\n }\n },\n\n [config.routes.api, config.serverURL, schemaFieldsPath, id, formData.blockName],\n )\n const { i18n } = useTranslation()\n\n const classNames = [`${baseClass}__row`, `${baseClass}__row--no-errors`].filter(Boolean).join(' ')\n\n const LabelComponent = reducedBlock?.LabelComponent\n\n // Memoized Form JSX\n const formContent = useMemo(() => {\n return reducedBlock && initialState !== false ? (\n <Form\n beforeSubmit={[onChange]}\n // @ts-expect-error TODO: Fix this\n fields={fieldMap}\n initialState={initialState}\n onChange={[onChange]}\n submitted={submitted}\n uuid={uuid()}\n >\n <BlockContent\n baseClass={baseClass}\n field={parentLexicalRichTextField}\n formData={formData}\n formSchema={Array.isArray(fieldMap) ? fieldMap : []}\n nodeKey={nodeKey}\n path={`${path}.lexical_internal_feature.blocks.${formData.blockType}`}\n reducedBlock={reducedBlock}\n schemaPath={schemaFieldsPath}\n />\n </Form>\n ) : (\n <Collapsible\n className={classNames}\n collapsibleStyle=\"default\"\n header={\n LabelComponent ? (\n <LabelComponent blockKind={'lexicalBlock'} formData={formData} />\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 {reducedBlock && typeof reducedBlock.labels.singular === 'string'\n ? getTranslation(reducedBlock.labels.singular, i18n)\n : '[Singular Label]'}\n </Pill>\n <SectionTitle path=\"blockName\" readOnly={parentLexicalRichTextField?.readOnly} />\n </div>\n </div>\n )\n }\n key={0}\n >\n <ShimmerEffect height=\"35vh\" />\n </Collapsible>\n )\n }, [\n classNames,\n fieldMap,\n parentLexicalRichTextField,\n nodeKey,\n i18n,\n submitted,\n initialState,\n reducedBlock,\n onChange,\n schemaFieldsPath,\n path,\n ]) // Adding formData to the dependencies here might break it\n return <div className={baseClass + ' ' + baseClass + '-' + formData.blockType}>{formContent}</div>\n}\n", "import type { CollapsedPreferences, Data, FieldMap, FormFieldBase, 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 RenderFields,\n SectionTitle,\n useDocumentInfo,\n useFormSubmitted,\n useTranslation,\n} from '@payloadcms/ui'\nimport { dequal } from 'dequal/lite' // lite: no need for Map and Set support\nimport { $getNodeByKey } from 'lexical'\nimport React, { useCallback } from 'react'\n\nimport type { SanitizedClientEditorConfig } from '../../../lexical/config/types.js'\nimport type { ClientBlock } from '../feature.client.js'\nimport type { BlockFields, BlockNode } from '../nodes/BlocksNode.js'\n\nimport { FormSavePlugin } from './FormSavePlugin.js'\n\ntype Props = {\n baseClass: string\n field: {\n editorConfig: SanitizedClientEditorConfig // With rendered features n stuff\n name: string\n richTextComponentMap: Map<string, React.ReactNode>\n } & FormFieldBase\n formData: BlockFields\n formSchema: FieldMap\n nodeKey: string\n path: string\n reducedBlock: ClientBlock\n schemaPath: string\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 {\n baseClass,\n field,\n formData,\n formSchema,\n nodeKey,\n reducedBlock: { LabelComponent, labels },\n schemaPath,\n } = 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: Data\n }) => {\n newFormData = {\n ...newFormData,\n id: formData.id,\n blockType: formData.blockType,\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.\n function 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 removeUndefinedAndNullAndEmptyArraysRecursively(newFormData)\n\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 node.setFields(newFormData as BlockFields)\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 LabelComponent ? (\n <LabelComponent blockKind={'lexicalBlock'} formData={formData} />\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 labels.singular === 'string'\n ? getTranslation(labels.singular, i18n)\n : '[Singular Label]'}\n </Pill>\n <SectionTitle path=\"blockName\" readOnly={field?.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?.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 fieldMap={Array.isArray(formSchema) ? 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", "import 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", "import 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": "qDAIA,OACE,eAAAA,GACA,QAAAC,GACA,QAAAC,GACA,gBAAAC,GACA,iBAAAC,GACA,aAAAC,GACA,mBAAAC,GACA,iBAAAC,GACA,oBAAAC,GACA,kBAAAC,OACK,iBACP,OAAgB,eAAAC,GAAa,aAAAC,GAAW,WAAAC,GAAS,YAAAC,OAAgB,QAMjE,OAAS,kBAAAC,OAAsB,2BAC/B,OAAS,gBAAAC,MAAoB,wBAC7B,OAAS,MAAMC,OAAY,OCtB3B,OAAS,6BAAAC,MAAiC,2CAC1C,OAAS,kBAAAC,MAAsB,2BAC/B,OACE,UAAAC,EACA,eAAAC,EACA,aAAAC,EACA,QAAAC,EACA,gBAAAC,EACA,gBAAAC,EACA,mBAAAC,EACA,oBAAAC,EACA,kBAAAC,OACK,iBACP,OAAS,UAAAC,OAAc,cACvB,OAAS,iBAAAC,MAAqB,UAC9B,OAAOC,GAAS,eAAAC,MAAmB,QCdnC,OAAS,oBAAAC,MAAwB,iBACjC,OAAS,wBAAAC,MAA4B,iBACrC,OAAS,aAAAC,MAAiB,QCGnB,SAASC,EAAuB,CAAE,OAAAC,CAAO,EAAqC,CACnF,QAAWC,KAAOD,EAAQ,CACxB,IAAME,EAAQF,EAAOC,CAAG,EACpB,MAAM,QAAQC,EAAM,IAAI,GAAK,UAAWA,IAC1CA,EAAM,gBAAkB,GAE5B,CACA,OAAOF,CACT,CDGO,IAAMG,EAAmCC,GAAU,CACxD,GAAM,CAAE,SAAAC,CAAS,EAAID,EAEf,CAACE,CAAO,EAAIC,EAAiB,EAE7BC,EAASC,EAAuB,CAAE,OAAQH,CAAQ,CAAC,EAInDI,EAAcC,EAAqBH,EAAQ,EAAI,EAErD,OAAAI,EAAU,IAAM,CACVP,GACFA,EAAS,CAAE,qBAAsBG,EAAQ,YAAAE,CAAY,CAAC,CAE1D,EAAG,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AAO,OAAO,EAAE,KAAK,GAAG,EAE3FmC,EAAiBZ,GAAc,eAG/Ba,EAAcC,GAAQ,IACnBd,GAAgBN,IAAiB,GACtCnB,EAACwC,GAAA,CACC,aAAc,CAACT,CAAQ,EAEvB,OAAQJ,EACR,aAAcR,EACd,SAAU,CAACY,CAAQ,EACnB,UAAWtB,EACX,KAAMgC,GAAK,EAEX,SAAAzC,EAAC0C,EAAA,CACC,UAAWxC,EACX,MAAOe,EACP,SAAUZ,EACV,WAAY,MAAM,QAAQsB,CAAQ,EAAIA,EAAW,CAAC,EAClD,QAASrB,EACT,KAAM,GAAGO,CAAI,oCAAoCR,EAAS,SAAS,GACnE,aAAcoB,EACd,WAAYD,EACd,EACF,EAEAxB,EAAC2C,GAAA,CACC,UAAWP,EACX,iBAAiB,UACjB,OACEC,EACErC,EAACqC,EAAA,CAAe,UAAW,eAAgB,SAAUhC,EAAU,EAE/DL,EAAC,OAAI,UAAW,GAAGE,CAAS,iBAC1B,SAAAD,GAAC,OACC,UAAAD,EAAC4C,GAAA,CACC,UAAW,GAAG1C,CAAS,gBAAgBA,CAAS,gBAAgBG,GAAU,SAAS,GACnF,UAAU,QAET,SAAAoB,GAAgB,OAAOA,EAAa,OAAO,UAAa,SACrDoB,GAAepB,EAAa,OAAO,SAAUS,CAAI,EACjD,mBACN,EACAlC,EAAC8C,GAAA,CAAa,KAAK,YAAY,SAAU7B,GAA4B,SAAU,GACjF,EACF,EAKJ,SAAAjB,EAAC+C,GAAA,CAAc,OAAO,OAAO,GAFxB,CAGP,EAED,CACDX,EACAT,EACAV,EACAX,EACA4B,EACAzB,EACAU,EACAM,EACAM,EACAP,EACAX,CACF,CAAC,EACD,OAAOb,EAAC,OAAI,UAAWE,EAAY,IAAMA,EAAY,IAAMG,EAAS,UAAY,SAAAiC,EAAY,CAC9F",
|
|
6
|
+
"names": ["Collapsible", "Form", "Pill", "SectionTitle", "ShimmerEffect", "useConfig", "useDocumentInfo", "useFieldProps", "useFormSubmitted", "useTranslation", "useCallback", "useEffect", "useMemo", "useState", "getTranslation", "getFormState", "uuid", "useLexicalComposerContext", "getTranslation", "Button", "Collapsible", "ErrorPill", "Pill", "RenderFields", "SectionTitle", "useDocumentInfo", "useFormSubmitted", "useTranslation", "dequal", "$getNodeByKey", "React", "useCallback", "useAllFormFields", "reduceFieldsToValues", "useEffect", "removeEmptyArrayValues", "fields", "key", "field", "FormSavePlugin", "props", "onChange", "_fields", "useAllFormFields", "fields", "removeEmptyArrayValues", "newFormData", "reduceFieldsToValues", "useEffect", "jsx", "jsxs", "BlockContent", "props", "baseClass", "field", "formData", "formSchema", "nodeKey", "LabelComponent", "labels", "schemaPath", "i18n", "useTranslation", "editor", "useLexicalComposerContext", "getDocPreferences", "setDocFieldPreferences", "useDocumentInfo", "isCollapsed", "setIsCollapsed", "React", "initialState", "currentDocPreferences", "collapsedArray", "hasSubmitted", "useFormSubmitted", "errorCount", "setErrorCount", "fieldHasErrors", "classNames", "onFormChange", "useCallback", "fullFieldsWithValues", "newFormData", "removeUndefinedAndNullAndEmptyArraysRecursively", "obj", "key", "value", "dequal", "node", "$getNodeByKey", "rowErrorCount", "formField", "onCollapsedChange", "changedCollapsed", "newCollapsed", "removeBlock", "Collapsible", "Pill", "getTranslation", "SectionTitle", "ErrorPill", "Button", "e", "incomingCollapsedState", "RenderFields", "FormSavePlugin", "jsx", "jsxs", "baseClass", "BlockComponent", "props", "formData", "nodeKey", "config", "useConfig", "submitted", "useFormSubmitted", "id", "useDocumentInfo", "path", "schemaPath", "useFieldProps", "editorConfig", "parentLexicalRichTextField", "useEditorConfigContext", "initialState", "setInitialState", "useState", "richTextComponentMap", "componentMapRenderedFieldsPath", "schemaFieldsPath", "reducedBlock", "block", "fieldMap", "useEffect", "state", "getFormState", "onChange", "useCallback", "prevFormState", "i18n", "useTranslation", "classNames", "LabelComponent", "formContent", "useMemo", "Form", "uuid", "BlockContent", "Collapsible", "Pill", "getTranslation", "SectionTitle", "ShimmerEffect"]
|
|
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-VUVXZJJR.js";import{b as y}from"./chunk-IWZVO3AI.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-6EKPZSCV.js.map
|