@payloadcms/richtext-lexical 3.0.0-beta.129 → 3.0.0-beta.130
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-SHUAQNQD.js → Field-GWJ72IYP.js} +2 -2
- package/dist/exports/client/{RelationshipComponent-IMM4CFBE.js → RelationshipComponent-2RT3YXUT.js} +2 -2
- package/dist/exports/client/bundled.css +1 -1
- package/dist/exports/client/{chunk-352SHIZR.js → chunk-AE5XKHR4.js} +2 -2
- package/dist/exports/client/{chunk-PDAZFJVO.js → chunk-CUIBIFW2.js} +1 -1
- package/dist/exports/client/chunk-CUIBIFW2.js.map +7 -0
- package/dist/exports/client/{chunk-O4IOO4EU.js → chunk-MI5HS4QX.js} +2 -2
- package/dist/exports/client/{chunk-75T7MDBH.js → chunk-XDEGE6I5.js} +2 -2
- package/dist/exports/client/{chunk-ZOYGBIAN.js → chunk-YGRKYSDC.js} +2 -2
- package/dist/exports/client/{component-YE2TDR5O.js → component-YICNYPTU.js} +2 -2
- package/dist/exports/client/{component-EHTN2BHZ.js → component-YNHK5J3P.js} +2 -2
- package/dist/exports/client/{componentInline-N5LJ2LY2.js → componentInline-6RPSMLNJ.js} +2 -2
- package/dist/exports/client/index.js +2 -2
- package/dist/field/bundled.css +1 -1
- package/dist/field/rscEntry.d.ts +2 -2
- package/dist/field/rscEntry.d.ts.map +1 -1
- package/dist/field/rscEntry.js +0 -3
- package/dist/field/rscEntry.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/package.json +7 -7
- package/dist/exports/client/chunk-PDAZFJVO.js.map +0 -7
- /package/dist/exports/client/{Field-SHUAQNQD.js.map → Field-GWJ72IYP.js.map} +0 -0
- /package/dist/exports/client/{RelationshipComponent-IMM4CFBE.js.map → RelationshipComponent-2RT3YXUT.js.map} +0 -0
- /package/dist/exports/client/{chunk-352SHIZR.js.map → chunk-AE5XKHR4.js.map} +0 -0
- /package/dist/exports/client/{chunk-O4IOO4EU.js.map → chunk-MI5HS4QX.js.map} +0 -0
- /package/dist/exports/client/{chunk-75T7MDBH.js.map → chunk-XDEGE6I5.js.map} +0 -0
- /package/dist/exports/client/{chunk-ZOYGBIAN.js.map → chunk-YGRKYSDC.js.map} +0 -0
- /package/dist/exports/client/{component-YE2TDR5O.js.map → component-YICNYPTU.js.map} +0 -0
- /package/dist/exports/client/{component-EHTN2BHZ.js.map → component-YNHK5J3P.js.map} +0 -0
- /package/dist/exports/client/{componentInline-N5LJ2LY2.js.map → componentInline-6RPSMLNJ.js.map} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as l}from"react/jsx-runtime";import u from"bson-objectid";import a from"react";import{DecoratorBlockNode as i}from"@lexical/react/LexicalDecoratorBlockNode.js";import c from"bson-objectid";import{deepCopyObjectSimple as f}from"payload/shared";var o=class extends i{__fields;constructor({fields:t,format:e,key:s}){super(e,s),this.__fields=t}static clone(t){return new this({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 e=p(t.fields);return e.setFormat(t.format),e}static isInline(){return!1}decorate(t,e){return null}exportDOM(){let t=document.createElement("div"),e=document.createTextNode(this.getTextContent());return t.append(e),{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 e=f(t),s=this.getWritable();s.__fields=e}};function p(r){return new o({fields:{...r,id:r?.id||new c.default().toHexString()}})}var m=a.lazy(()=>import("./component-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{jsx as l}from"react/jsx-runtime";import u from"bson-objectid";import a from"react";import{DecoratorBlockNode as i}from"@lexical/react/LexicalDecoratorBlockNode.js";import c from"bson-objectid";import{deepCopyObjectSimple as f}from"payload/shared";var o=class extends i{__fields;constructor({fields:t,format:e,key:s}){super(e,s),this.__fields=t}static clone(t){return new this({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 e=p(t.fields);return e.setFormat(t.format),e}static isInline(){return!1}decorate(t,e){return null}exportDOM(){let t=document.createElement("div"),e=document.createTextNode(this.getTextContent());return t.append(e),{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 e=f(t),s=this.getWritable();s.__fields=e}};function p(r){return new o({fields:{...r,id:r?.id||new c.default().toHexString()}})}var m=a.lazy(()=>import("./component-YNHK5J3P.js").then(r=>({default:r.BlockComponent}))),n=class extends o{static clone(t){return super.clone(t)}static getType(){return super.getType()}static importJSON(t){t.version===1&&(t={...t,fields:{...t.fields.data},version:2});let e=d(t.fields);return e.setFormat(t.format),e}decorate(t,e){return l(m,{formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function d(r){return new n({fields:{...r,id:r?.id||new u.default().toHexString()}})}function v(r){return r instanceof n}export{n as a,d as b,v as c};
|
|
2
|
+
//# sourceMappingURL=chunk-AE5XKHR4.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import{jsx as w}from"react/jsx-runtime";import{useLexicalComposerContext as x}from"@lexical/react/LexicalComposerContext.js";import"react";import{createContext as C,useContext as M,useMemo as b,useRef as E,useState as m}from"react";function v(){return Math.random().toString(36).substring(2,12)+Math.random().toString(36).substring(2,12)}var g=C({editorConfig:null,fieldProps:null,uuid:null}),y=({children:o,editorConfig:s,editorContainerRef:c,fieldProps:d,parentContext:n})=>{let[a]=x(),[f]=m(v()),t=E(new Map),[l,h]=m(null),u=E(new Set),p=b(()=>({blurEditor:r=>{u.current.clear()},childrenEditors:t,editor:a,editorConfig:s,editorContainerRef:c,fieldProps:d,focusedEditor:l,focusEditor:r=>{let e=r.uuid;u.current.has(e)||(u.current.add(e),h(r),n?.uuid&&n.focusEditor(r),t.current.forEach(i=>{i.focusEditor(r)}),u.current.clear())},parentEditor:n,registerChild:(r,e)=>{if(!t.current.has(r)){let i=new Map(t.current);i.set(r,e),t.current=i}},unregisterChild:r=>{if(t.current.has(r)){let e=new Map(t.current);e.delete(r),t.current=e}},uuid:f}),[a,t,s,c,d,l,n,f]);return w(g.Provider,{value:p,children:o})},F=()=>{let o=M(g);if(o===void 0)throw new Error("useEditorConfigContext must be used within an EditorConfigProvider");return o};export{y as a,F as b};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
2
|
+
//# sourceMappingURL=chunk-CUIBIFW2.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 { MarkRequired } from 'ts-essentials'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport * as React from 'react'\nimport { createContext, useContext, useMemo, useRef, useState } from 'react'\n\nimport type { LexicalRichTextFieldProps } from '../../../types.js'\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\n fieldProps: MarkRequired<LexicalRichTextFieldProps, 'path' | 'schemaPath'>\n focusedEditor: EditorConfigContextType | null\n // Editor focus handling\n focusEditor: (editorContext: EditorConfigContextType) => void\n parentEditor: EditorConfigContextType\n registerChild: (uuid: string, editorContext: EditorConfigContextType) => void\n unregisterChild?: (uuid: string) => void\n uuid: string\n}\n\n// @ts-expect-error: TODO: Fix this\nconst Context: React.Context<EditorConfigContextType> = createContext({\n editorConfig: null,\n fieldProps: 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 | null>\n\n fieldProps: LexicalRichTextFieldProps\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 fieldProps,\n focusedEditor,\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) => {\n childEditor.focusEditor(editorContext)\n })\n\n focusHistory.current.clear()\n },\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": "wCAKA,OAASA,6BAAAA,MAAiC,2CAC1C,MAAuB,QACvB,OAASC,iBAAAA,EAAeC,cAAAA,EAAYC,WAAAA,EAASC,UAAAA,EAAQC,YAAAA,MAAgB,QAMrE,SAASC,GAAA,CACP,OAAOC,KAAKC,OAAM,EAAGC,SAAS,EAAA,EAAIC,UAAU,EAAG,EAAA,EAAMH,KAAKC,OAAM,EAAGC,SAAS,EAAA,EAAIC,UAAU,EAAG,EAAA,CAC/F,CAqBA,IAAMC,EAAkDV,EAAc,CACpEW,aAAc,KACdC,WAAY,KACZC,KAAM,IACR,CAAA,EAEaC,EAAuBA,CAAC,CACnCC,SAAAA,EACAJ,aAAAA,EACAK,mBAAAA,EACAJ,WAAAA,EACAK,cAAAA,CAAa,IAQd,CACC,GAAM,CAACC,CAAA,EAAUnB,EAAA,EAEX,CAACc,CAAA,EAAQT,EAASC,EAAA,CAAA,EAElBc,EAAkBhB,EAA6C,IAAIiB,GAAA,EACnE,CAACC,EAAeC,CAAA,EAAoBlB,EAAyC,IAAA,EAC7EmB,EAAepB,EAAoB,IAAIqB,GAAA,EAEvCC,EAAgBvB,EACpB,KACG,CACCwB,WAAaD,GAAA,CAEXF,EAAaI,QAAQC,MAAK,CAC5B,EACAT,gBAAAA,EACAD,OAAAA,EACAP,aAAAA,EACAK,mBAAAA,EACAJ,WAAAA,EACAS,cAAAA,EACAQ,YAAcJ,GAAA,CACZ,IAAMK,EAAaL,EAAcZ,KAG7BU,EAAaI,QAAQI,IAAID,CAAA,IAK7BP,EAAaI,QAAQK,IAAIF,CAAA,EACzBR,EAAiBG,CAAA,EAGbR,GAAeJ,MACjBI,EAAcY,YAAYJ,CAAA,EAE5BN,EAAgBQ,QAAQM,QAASC,GAAA,CAC/BA,EAAYL,YAAYJ,CAAA,CAC1B,CAAA,EAEAF,EAAaI,QAAQC,MAAK,EAC5B,EACAO,aAAclB,EACdmB,cAAeA,CAACC,EAAWC,IAAA,CACzB,GAAI,CAACnB,EAAgBQ,QAAQI,IAAIM,CAAA,EAAY,CAC3C,IAAME,EAAS,IAAInB,IAAID,EAAgBQ,OAAO,EAC9CY,EAAOC,IAAIH,EAAWC,CAAA,EACtBnB,EAAgBQ,QAAUY,CAC5B,CACF,EACAE,gBAAkBJ,GAAA,CAChB,GAAIlB,EAAgBQ,QAAQI,IAAIM,CAAA,EAAY,CAC1C,IAAME,EAAS,IAAInB,IAAID,EAAgBQ,OAAO,EAC9CY,EAAOG,OAAOL,CAAA,EACdlB,EAAgBQ,QAAUY,CAC5B,CACF,EAEA1B,KAAAA,CACF,GACF,CACEK,EACAC,EACAR,EACAK,EACAJ,EACAS,EACAJ,EACAJ,CAAA,CACD,EAGH,OAAO8B,EAACjC,EAAQkC,SAAQ,CAACC,MAAOpB,WAAgBV,GAClD,EAEa+B,EAAyBA,IAAA,CACpC,IAAAC,EAAgB9C,EAAAS,CAAW,EAAA,GACvBqC,IAAAC,OAAY,MAAA,IAAAC,MACE,oEAAA,EAAA,OAEXF,CAAA",
|
|
6
|
+
"names": ["useLexicalComposerContext", "createContext", "useContext", "useMemo", "useRef", "useState", "generateQuickGuid", "Math", "random", "toString", "substring", "Context", "editorConfig", "fieldProps", "uuid", "EditorConfigProvider", "children", "editorContainerRef", "parentContext", "editor", "childrenEditors", "Map", "focusedEditor", "setFocusedEditor", "focusHistory", "Set", "editorContext", "blurEditor", "current", "clear", "focusEditor", "editorUUID", "has", "add", "forEach", "childEditor", "parentEditor", "registerChild", "childUUID", "childEditorContext", "newMap", "set", "unregisterChild", "delete", "_jsx", "Provider", "value", "useEditorConfigContext", "context", "undefined", "Error"]
|
|
7
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createCommand as u}from"lexical";var d=u("INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND");import{jsx as h}from"react/jsx-runtime";import*as l from"react";import{DecoratorBlockNode as c}from"@lexical/react/LexicalDecoratorBlockNode.js";function p(r){let t=r.getAttribute("data-lexical-relationship-id"),e=r.getAttribute("data-lexical-relationship-relationTo");return t!=null&&e!=null?{node:o({relationTo:e,value:t})}:null}var n=class extends c{__data;constructor({data:t,format:e,key:a}){super(e,a),this.__data=t}static clone(t){return new this({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:p,priority:2}}}static importJSON(t){t.version===1&&t?.value?.id&&(t.value=t.value.id);let e={relationTo:t.relationTo,value:t.value},a=o(e);return a.setFormat(t.format),a}static isInline(){return!1}decorate(t,e){return null}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 o(r){return new n({data:r})}var _=l.lazy(()=>import("./RelationshipComponent-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{createCommand as u}from"lexical";var d=u("INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND");import{jsx as h}from"react/jsx-runtime";import*as l from"react";import{DecoratorBlockNode as c}from"@lexical/react/LexicalDecoratorBlockNode.js";function p(r){let t=r.getAttribute("data-lexical-relationship-id"),e=r.getAttribute("data-lexical-relationship-relationTo");return t!=null&&e!=null?{node:o({relationTo:e,value:t})}:null}var n=class extends c{__data;constructor({data:t,format:e,key:a}){super(e,a),this.__data=t}static clone(t){return new this({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:p,priority:2}}}static importJSON(t){t.version===1&&t?.value?.id&&(t.value=t.value.id);let e={relationTo:t.relationTo,value:t.value},a=o(e);return a.setFormat(t.format),a}static isInline(){return!1}decorate(t,e){return null}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 o(r){return new n({data:r})}var _=l.lazy(()=>import("./RelationshipComponent-2RT3YXUT.js").then(r=>({default:r.RelationshipComponent})));function m(r){let t=r.getAttribute("data-lexical-relationship-id"),e=r.getAttribute("data-lexical-relationship-relationTo");return t!=null&&e!=null?{node:s({relationTo:e,value:t})}:null}var i=class extends n{static clone(t){return super.clone(t)}static getType(){return super.getType()}static importDOM(){return{div:t=>!t.hasAttribute("data-lexical-relationship-relationTo")||!t.hasAttribute("data-lexical-relationship-id")?null:{conversion:m,priority:2}}}static importJSON(t){t.version===1&&t?.value?.id&&(t.value=t.value.id);let e={relationTo:t.relationTo,value:t.value},a=s(e);return a.setFormat(t.format),a}decorate(t,e){return h(_,{className:e.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function s(r){return new i({data:r})}function R(r){return r instanceof i}export{d as a,i as b,s as c,R as d};
|
|
2
|
+
//# sourceMappingURL=chunk-MI5HS4QX.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as E}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as E}from"./chunk-CUIBIFW2.js";import{c as N}from"react/compiler-runtime";import{jsx as M}from"react/jsx-runtime";import{Drawer as z,EditDepthProvider as tt,useModal as et}from"@payloadcms/ui";import"react";import{jsx as $,jsxs as J}from"react/jsx-runtime";import{Form as B,FormSubmit as K,RenderFields as L,useDocumentInfo as G,useServerFunctions as V,useTranslation as q}from"@payloadcms/ui";import{abortAndIgnore as R}from"@payloadcms/ui/shared";import{useCallback as Q,useEffect as P,useRef as X,useState as Y}from"react";import{v4 as Z}from"uuid";var I=({data:r,featureKey:t,fieldMapOverride:e,handleDrawerSubmit:o,schemaFieldsPathOverride:n,schemaPath:S,schemaPathSuffix:m})=>{let{t:d}=q(),{id:c,collectionSlug:u,docPermissions:i,getDocPreferences:a,globalSlug:s}=G(),l=X(new AbortController),[f,p]=Y(!1),{fieldProps:{featureClientSchemaMap:b,permissions:D}}=E(),{getFormState:g}=V(),h=n??`${S}.lexical_internal_feature.${t}${m?`.${m}`:""}`,_=e??b[t]?.[h];P(()=>{let x=new AbortController;return(async()=>{let{state:A}=await g({id:c,collectionSlug:u,data:r??{},docPermissions:i,docPreferences:await a(),globalSlug:s,operation:"update",renderAllFields:!0,schemaPath:h,signal:x.signal});p(A)})(),()=>{R(x)}},[h,c,r,g,u,s,i,a]);let w=Q(async({formState:x})=>{R(l.current);let v=new AbortController;l.current=v;let{state:A}=await g({id:c,collectionSlug:u,docPermissions:i,docPreferences:await a(),formState:x,globalSlug:s,operation:"update",schemaPath:h,signal:v.signal});return A||x},[g,c,u,i,a,s,h]);return P(()=>()=>{R(l.current)},[]),f===!1?null:J(B,{beforeSubmit:[w],disableValidationOnSubmit:!0,fields:Array.isArray(_)?_:[],initialState:f,onChange:[w],onSubmit:o,uuid:Z(),children:[$(L,{fields:Array.isArray(_)?_:[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:h,permissions:D,readOnly:!1}),$(K,{children:d("fields:saveChanges")})]})};var Ut=r=>{let t=N(15),{className:e,data:o,drawerSlug:n,drawerTitle:S,featureKey:m,fieldMapOverride:d,handleDrawerSubmit:c,schemaFieldsPathOverride:u,schemaPath:i,schemaPathSuffix:a}=r,{closeModal:s}=et(),l=S??"",f;t[0]!==s||t[1]!==n||t[2]!==c?(f=(b,D)=>{s(n),setTimeout(()=>{c(b,D)},1)},t[0]=s,t[1]=n,t[2]=c,t[3]=f):f=t[3];let p;return t[4]!==o||t[5]!==m||t[6]!==d||t[7]!==f||t[8]!==u||t[9]!==i||t[10]!==a||t[11]!==e||t[12]!==n||t[13]!==l?(p=M(tt,{children:M(z,{className:e,slug:n,title:l,children:M(I,{data:o,featureKey:m,fieldMapOverride:d,handleDrawerSubmit:f,schemaFieldsPathOverride:u,schemaPath:i,schemaPathSuffix:a})})}),t[4]=o,t[5]=m,t[6]=d,t[7]=f,t[8]=u,t[9]=i,t[10]=a,t[11]=e,t[12]=n,t[13]=l,t[14]=p):p=t[14],p};import{c as rt}from"react/compiler-runtime";import{useLexicalComposerContext as ot}from"@lexical/react/LexicalComposerContext";import{useModal as nt}from"@payloadcms/ui";import{$getPreviousSelection as at,$getSelection as it,$setSelection as st}from"lexical";import{useEffect as lt,useState as j}from"react";var Gt=(r,t)=>{let e=rt(24),[o]=ot(),[n,S]=j(null),[m,d]=j(!1),{closeModal:c,isModalOpen:u,modalState:i,toggleModal:a}=nt(),s;e[0]!==o?(s=()=>{o.read(()=>{let v=it()??at();S(v)})},e[0]=o,e[1]=s):s=e[1];let l=s,f;e[2]!==n||e[3]!==o?(f=()=>{n&&o.update(()=>{st(n.clone())},{discrete:!0,skipTransforms:!0})},e[2]=n,e[3]=o,e[4]=f):f=e[4];let p=f,b;e[5]!==c||e[6]!==r?(b=()=>{c(r)},e[5]=c,e[6]=r,e[7]=b):b=e[7];let D=b,g;e[8]!==u||e[9]!==r||e[10]!==l||e[11]!==p||e[12]!==a?(g=()=>{u(r)?p():l(),d(!0),a(r)},e[8]=u,e[9]=r,e[10]=l,e[11]=p,e[12]=a,e[13]=g):g=e[13];let h=g,_,w;e[14]!==m||e[15]!==i||e[16]!==r||e[17]!==t||e[18]!==p?(_=()=>{if(!m)return;let v=i[r];v&&!v?.isOpen&&(d(!1),t?setTimeout(()=>{p()},0):p())},w=[i,r,p,m,t],e[14]=m,e[15]=i,e[16]=r,e[17]=t,e[18]=p,e[19]=_,e[20]=w):(_=e[19],w=e[20]),lt(_,w);let x;return e[21]!==D||e[22]!==h?(x={closeDrawer:D,toggleDrawer:h},e[21]=D,e[22]=h,e[23]=x):x=e[23],x};import{c as ct}from"react/compiler-runtime";import{useAuth as ut,useConfig as ft,useEntityVisibility as pt}from"@payloadcms/ui";import*as O from"react";var mt=(r,t)=>r.filter(({slug:e,admin:{enableRichTextRelationship:o},upload:n})=>t?.visibleEntities.collections.includes(e)?t?.uploads?o&&!!n:n?!1:o:!1),Xt=r=>{let t=ct(16),e,o,n;t[0]!==r?({children:n,uploads:e,...o}=r,t[0]=r,t[1]=e,t[2]=o,t[3]=n):(e=t[1],o=t[2],n=t[3]);let S=e===void 0?!1:e,{config:m}=ft(),{collections:d}=m,{user:c}=ut(),{visibleEntities:u}=pt(),i;t[4]!==d||t[5]!==S||t[6]!==c||t[7]!==u?(i=()=>mt(d,{uploads:S,user:c,visibleEntities:u}).map(l=>{let{slug:f}=l;return f}),t[4]=d,t[5]=S,t[6]=c,t[7]=u,t[8]=i):i=t[8];let[a]=O.useState(i);if(!a.length)return null;let s;if(t[9]!==o||t[10]!==a||t[11]!==n){let l;t[13]!==o||t[14]!==a?(l={...o,enabledCollectionSlugs:a},t[13]=o,t[14]=a,t[15]=l):l=t[15],s=O.cloneElement(n,l),t[9]=o,t[10]=a,t[11]=n,t[12]=s}else s=t[12];return s};import{createCommand as dt}from"lexical";var Nt=dt("INSERT_UPLOAD_WITH_DRAWER_COMMAND");import{jsx as _t}from"react/jsx-runtime";import k from"bson-objectid";import{$applyNodeReplacement as bt}from"lexical";import*as W from"react";import{jsx as ht}from"react/jsx-runtime";import{DecoratorBlockNode as xt}from"@lexical/react/LexicalDecoratorBlockNode.js";import F from"bson-objectid";import{$applyNodeReplacement as St}from"lexical";import"react";function T(r){return r.parentElement!=null&&r.parentElement.tagName==="LI"&&r.previousSibling===null&&r.getAttribute("aria-roledescription")==="checkbox"}function gt(r){if(r.hasAttribute("data-lexical-upload-relation-to")&&r.hasAttribute("data-lexical-upload-id")){let e=r.getAttribute("data-lexical-upload-id"),o=r.getAttribute("data-lexical-upload-relation-to");if(e!=null&&o!=null)return{node:U({data:{fields:{},relationTo:o,value:e}})}}let t=r;return t.src.startsWith("file:///")||T(t),null}var C=class extends xt{__data;constructor({data:t,format:e,key:o}){super(e,o),this.__data=t}static clone(t){return new this({data:t.__data,format:t.__format,key:t.__key})}static getType(){return"upload"}static importDOM(){return{img:t=>({conversion:gt,priority:0})}}static importJSON(t){t.version===1&&t?.value?.id&&(t.value=t.value.id),t.version===2&&!t?.id&&(t.id=new F.default().toHexString(),t.version=3);let e={id:t.id,fields:t.fields,relationTo:t.relationTo,value:t.value},o=U({data:e});return o.setFormat(t.format),o}static isInline(){return!1}decorate(){return ht(RawUploadComponent,{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 e=this.getWritable();e.__data=t}updateDOM(){return!1}};function U({data:r}){return r?.id||(r.id=new F.default().toHexString()),St(new C({data:r}))}var vt=W.lazy(()=>import("./component-YICNYPTU.js").then(r=>({default:r.UploadComponent})));function Dt(r){if(r.hasAttribute("data-lexical-upload-relation-to")&&r.hasAttribute("data-lexical-upload-id")){let e=r.getAttribute("data-lexical-upload-id"),o=r.getAttribute("data-lexical-upload-relation-to");if(e!=null&&o!=null)return{node:H({data:{fields:{},relationTo:o,value:e}})}}let t=r;return t.src.startsWith("file:///")||T(t),null}var y=class extends C{static clone(t){return super.clone(t)}static getType(){return super.getType()}static importDOM(){return{img:t=>({conversion:Dt,priority:0})}}static importJSON(t){t.version===1&&t?.value?.id&&(t.value=t.value.id),t.version===2&&!t?.id&&(t.id=new k.default().toHexString(),t.version=3);let e={id:t.id,fields:t.fields,relationTo:t.relationTo,value:t.value},o=H({data:e});return o.setFormat(t.format),o}decorate(){return _t(vt,{data:this.__data,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function H({data:r}){return r?.id||(r.id=new k.default().toHexString()),bt(new y({data:r}))}function ue(r){return r instanceof y}export{Ut as a,Gt as b,Xt as c,Nt as d,y as e,H as f,ue as g};
|
|
2
|
+
//# sourceMappingURL=chunk-XDEGE6I5.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createCommand as i}from"lexical";var O=i("INSERT_BLOCK_COMMAND"),x=i("INSERT_INLINE_BLOCK_COMMAND"),I=i("OPEN_INLINE_BLOCK_DRAWER_COMMAND");import{jsx as p}from"react/jsx-runtime";import u from"bson-objectid";import m from"react";import c from"bson-objectid";import{DecoratorNode as l}from"lexical";import{deepCopyObjectSimple as d}from"payload/shared";var r=class extends l{__fields;constructor({fields:e,key:n}){super(n),this.__fields=e}static clone(e){return new this({fields:e.__fields,key:e.__key})}static getType(){return"inlineBlock"}static importDOM(){return{}}static importJSON(e){return a(e.fields)}static isInline(){return!1}canIndent(){return!0}createDOM(){let e=document.createElement("span");return e.classList.add("inline-block-container"),e}decorate(e,n){return null}exportDOM(){let e=document.createElement("span");e.classList.add("inline-block-container");let n=document.createTextNode(this.getTextContent());return e.append(n),{element:e}}exportJSON(){return{type:"inlineBlock",fields:this.getFields(),version:1}}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}isInline(){return!0}setFields(e){let n=d(e),s=this.getWritable();s.__fields=n}updateDOM(){return!1}};function a(t){return new r({fields:{...t,id:t?.id||new c.default().toHexString()}})}var f=m.lazy(()=>import("./componentInline-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{createCommand as i}from"lexical";var O=i("INSERT_BLOCK_COMMAND"),x=i("INSERT_INLINE_BLOCK_COMMAND"),I=i("OPEN_INLINE_BLOCK_DRAWER_COMMAND");import{jsx as p}from"react/jsx-runtime";import u from"bson-objectid";import m from"react";import c from"bson-objectid";import{DecoratorNode as l}from"lexical";import{deepCopyObjectSimple as d}from"payload/shared";var r=class extends l{__fields;constructor({fields:e,key:n}){super(n),this.__fields=e}static clone(e){return new this({fields:e.__fields,key:e.__key})}static getType(){return"inlineBlock"}static importDOM(){return{}}static importJSON(e){return a(e.fields)}static isInline(){return!1}canIndent(){return!0}createDOM(){let e=document.createElement("span");return e.classList.add("inline-block-container"),e}decorate(e,n){return null}exportDOM(){let e=document.createElement("span");e.classList.add("inline-block-container");let n=document.createTextNode(this.getTextContent());return e.append(n),{element:e}}exportJSON(){return{type:"inlineBlock",fields:this.getFields(),version:1}}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}isInline(){return!0}setFields(e){let n=d(e),s=this.getWritable();s.__fields=n}updateDOM(){return!1}};function a(t){return new r({fields:{...t,id:t?.id||new c.default().toHexString()}})}var f=m.lazy(()=>import("./componentInline-6RPSMLNJ.js").then(t=>({default:t.InlineBlockComponent}))),o=class extends r{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return _(e.fields)}decorate(e,n){return p(f,{formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function _(t){return new o({fields:{...t,id:t?.id||new u.default().toHexString()}})}function y(t){return t instanceof o}export{O as a,x as b,I as c,o as d,_ as e,y as f};
|
|
2
|
+
//# sourceMappingURL=chunk-YGRKYSDC.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{a as y,b as M,c as A,d as T,g as O}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=component-
|
|
1
|
+
"use client";import{a as y,b as M,c as A,d as T,g as O}from"./chunk-XDEGE6I5.js";import{a as U}from"./chunk-5PBXL4HT.js";import{b}from"./chunk-CUIBIFW2.js";import{jsx as e,jsxs as c}from"react/jsx-runtime";import{useLexicalComposerContext as ae}from"@lexical/react/LexicalComposerContext.js";import{useLexicalNodeSelection as le}from"@lexical/react/useLexicalNodeSelection.js";import{mergeRegister as re}from"@lexical/utils";import{getTranslation as F}from"@payloadcms/translations";import{Button as C,File as se,formatDrawerSlug as ie,useConfig as ne,useEditDepth as ce,usePayloadAPI as de,useTranslation as ue}from"@payloadcms/ui";import{$getNodeByKey as I,$getSelection as me,$isNodeSelection as pe,CLICK_COMMAND as fe,COMMAND_PRIORITY_LOW as w,KEY_BACKSPACE_COMMAND as ge,KEY_DELETE_COMMAND as he}from"lexical";import{useCallback as f,useEffect as _e,useId as De,useReducer as be,useRef as Ce,useState as we}from"react";var o="lexical-upload",K={depth:0},Ne=d=>{let{data:{fields:j,relationTo:N,value:n},nodeKey:l}=d;if(typeof n=="object")throw new Error("Upload value should be a string or number. The Lexical Upload component should not receive the populated value object.");let{config:{collections:B,routes:{api:k},serverURL:W}}=ne(),g=Ce(null),{uuid:Y}=b(),z=ce(),[a]=ae(),[r,h,x]=le(l),{editorConfig:H,fieldProps:{readOnly:_,schemaPath:q}}=b(),{i18n:S,t:u}=ue(),[$,G]=be(t=>t+1,0),[s]=we(()=>B.find(t=>t.slug===N)),J=De(),v=ie({slug:"lexical-upload-drawer-"+Y+J,depth:z}),{toggleDrawer:Q}=M(v,!0),{closeDocumentDrawer:E,DocumentDrawer:V,DocumentDrawerToggler:X}=U({id:n,collectionSlug:s.slug}),[{data:m},{setParams:R}]=de(`${W}${k}/${s.slug}/${n}`,{initialParams:K}),L=m?.thumbnailURL||m?.url,Z=f(()=>{a.update(()=>{I(l)?.remove()})},[a,l]),ee=f(t=>{R({...K,cacheBust:$}),G(),E()},[R,$,E]),D=f(t=>{let p=me();return r&&pe(p)&&(t.preventDefault(),a.update(()=>{p.getNodes().forEach(i=>{O(i)&&i.remove()})})),!1},[a,r]);_e(()=>re(a.registerCommand(fe,t=>t.target===g.current||g.current?.contains(t.target)?(t.shiftKey?h(!r):r||(x(),h(!0)),!0):!1,w),a.registerCommand(he,D,w),a.registerCommand(ge,D,w)),[x,a,r,l,D,h]);let P=H?.resolvedFeatureMap?.get("upload")?.sanitizedClientFeatureProps.collections?.[s.slug]?.hasExtraFields,te=f((t,p)=>{a.update(()=>{let i=I(l);if(i){let oe={...i.getData(),fields:p};i.setData(oe)}})},[a,l]);return c("div",{className:[o,r&&`${o}--selected`].filter(Boolean).join(" "),contentEditable:!1,ref:g,children:[c("div",{className:`${o}__card`,children:[c("div",{className:`${o}__topRow`,children:[e("div",{className:`${o}__thumbnail`,children:L?e("img",{alt:m?.filename,"data-lexical-upload-id":n,"data-lexical-upload-relation-to":N,src:L}):e(se,{})}),c("div",{className:`${o}__topRowRightPanel`,children:[e("div",{className:`${o}__collectionLabel`,children:F(s.labels.singular,S)}),a.isEditable()&&c("div",{className:`${o}__actions`,children:[P?e(C,{buttonStyle:"icon-label",className:`${o}__upload-drawer-toggler`,disabled:_,el:"button",icon:"edit",onClick:()=>{Q()},round:!0,tooltip:u("fields:editRelationship")}):null,e(C,{buttonStyle:"icon-label",className:`${o}__swap-drawer-toggler`,disabled:_,el:"button",icon:"swap",onClick:()=>{a.dispatchCommand(T,{replace:{nodeKey:l}})},round:!0,tooltip:u("fields:swapUpload")}),e(C,{buttonStyle:"icon-label",className:`${o}__removeButton`,disabled:_,icon:"x",onClick:t=>{t.preventDefault(),Z()},round:!0,tooltip:u("fields:removeUpload")})]})]})]}),e("div",{className:`${o}__bottomRow`,children:e(X,{className:`${o}__doc-drawer-toggler`,children:e("strong",{children:m?.filename})})})]}),n?e(V,{onSave:ee}):null,P?e(y,{data:j,drawerSlug:v,drawerTitle:u("general:editLabel",{label:F(s.labels.singular,S)}),featureKey:"upload",handleDrawerSubmit:te,schemaPath:q,schemaPathSuffix:s.slug}):null]})},Ke=d=>e(A,{...d,uploads:!0,children:e(Ne,{...d})});export{Ke as UploadComponent};
|
|
2
|
+
//# sourceMappingURL=component-YICNYPTU.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{c as M}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=component-
|
|
1
|
+
"use client";import{c as M}from"./chunk-AE5XKHR4.js";import{b as w}from"./chunk-CUIBIFW2.js";import{jsx as k,jsxs as de}from"react/jsx-runtime";import{Collapsible as me,Form as ue,Pill as fe,SectionTitle as pe,ShimmerEffect as be,useDocumentInfo as U,useFormSubmitted as he,useServerFunctions as ke,useTranslation as ye}from"@payloadcms/ui";import{abortAndIgnore as D}from"@payloadcms/ui/shared";import{useCallback as _e,useEffect as W,useMemo as Ce,useRef as ge,useState as Se}from"react";import{getTranslation as ve}from"@payloadcms/translations";import{v4 as Pe}from"uuid";import{jsx as C,jsxs as R}from"react/jsx-runtime";import{useLexicalComposerContext as X}from"@lexical/react/LexicalComposerContext.js";import{getTranslation as Y}from"@payloadcms/translations";import{Button as Z,Collapsible as ee,ErrorPill as oe,Pill as te,RenderFields as le,SectionTitle as se,useDocumentInfo as re,useFormSubmitted as ne,useTranslation as ie}from"@payloadcms/ui";import{dequal as ae}from"dequal/lite";import{$getNodeByKey as q}from"lexical";import j,{useCallback as I,useEffect as ce}from"react";import{c as z}from"react/compiler-runtime";import{useAllFormFields as G}from"@payloadcms/ui";import{reduceFieldsToValues as J}from"payload/shared";import{useEffect as Q}from"react";function V({fields:l}){for(let e in l){let o=l[e];Array.isArray(o.rows)&&"value"in o&&(o.disableFormData=!0)}return l}var K=l=>{let e=z(8),{onChange:o}=l,[i]=G(),u,s;e[0]!==i?(s=V({fields:i}),u=J(s,!0),e[0]=i,e[1]=u,e[2]=s):(u=e[1],s=e[2]);let a=u,_,p;return e[3]!==o||e[4]!==s||e[5]!==a?(_=()=>{o&&o({fullFieldsWithValues:s,newFormData:a})},p=[a,o,s],e[3]=o,e[4]=s,e[5]=a,e[6]=_,e[7]=p):(_=e[6],p=e[7]),Q(_,p),null};function O(l){for(let e in l){let o=l[e];Array.isArray(o)&&!o?.length?delete l[e]:o&&typeof o=="object"?O(o):o==null&&delete l[e]}}var H=l=>{let{baseClass:e,clientBlock:o,field:i,formSchema:u,Label:s,nodeKey:a,path:_,schemaPath:p}=l,{formData:t}=l,{fieldProps:{permissions:$}}=w(),{i18n:g}=ie(),[f]=X(),{docPermissions:P,getDocPreferences:b,setDocFieldPreferences:S}=re(),[N,h]=j.useState();ce(()=>{b().then(m=>{let c=m?.fields[i.name]?.collapsed;h(c?c.includes(t.id):!1)})},[i.name,t.id,b]);let x=ne(),[B,L]=j.useState(0),r=x&&B>0,A=[`${e}__row`,r?`${e}__row--has-errors`:`${e}__row--no-errors`].filter(Boolean).join(" "),F=I(({fullFieldsWithValues:m,newFormData:n})=>{if(n.id=t.id,n.blockType=t.blockType,O(n),O(t),ae(t,n)||setTimeout(()=>{f.update(()=>{let c=q(a);c&&M(c)&&(t=n,c.setFields(n))})},0),x){let c=0;for(let d of Object.values(m))d?.valid===!1&&c++;L(c)}},[f,a,x,t]),T=I(m=>{b().then(n=>{let d=n?.fields[i.name]?.collapsed,v=d&&d?.length?d:[];m?v.includes(t.id)||v.push(t.id):v.includes(t.id)&&v.splice(v.indexOf(t.id),1),S(i.name,{collapsed:v,hello:"hi"})})},[b,i.name,S,t.id]),E=I(()=>{f.update(()=>{q(a)?.remove()})},[f,a]);return typeof N!="boolean"?null:R(j.Fragment,{children:[C(ee,{className:A,collapsibleStyle:r?"error":"default",header:s||R("div",{className:`${e}__block-header`,children:[R("div",{children:[C(te,{className:`${e}__block-pill ${e}__block-pill-${t?.blockType}`,pillStyle:"white",children:typeof o?.labels?.singular=="string"?Y(o?.labels.singular,g):o.slug}),C(se,{path:"blockName",readOnly:i?.admin?.readOnly||!1}),r&&C(oe,{count:B,i18n:g,withMessage:!0})]}),f.isEditable()&&C(Z,{buttonStyle:"icon-label",className:`${e}__removeButton`,disabled:i?.admin?.readOnly,icon:"x",onClick:m=>{m.preventDefault(),E()},round:!0,tooltip:"Remove Block"})]}),isCollapsed:N,onToggle:m=>{T(m),h(m)},children:C(le,{fields:u,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:$})},0),C(K,{onChange:F})]})};var y="lexical-block",Ye=l=>{let{formData:e,nodeKey:o}=l,i=he(),{id:u,collectionSlug:s,globalSlug:a}=U(),{fieldProps:{featureClientSchemaMap:_,field:p,path:t,schemaPath:$}}=w(),g=ge(new AbortController),{docPermissions:f,getDocPreferences:P}=U(),{getFormState:b}=ke(),[S,N]=Se(!1),h=`${$}.lexical_internal_feature.blocks.lexical_blocks.${e.blockType}.fields`,x=`${$}.lexical_internal_feature.blocks.lexical_blocks.${e.blockType}`,r=_.blocks[x][0].blocks[0],{i18n:A}=ye();W(()=>{let n=new AbortController;return e&&(async()=>{let{state:d}=await b({id:u,collectionSlug:s,data:e,docPermissions:f,docPreferences:await P(),globalSlug:a,operation:"update",renderAllFields:!0,schemaPath:h,signal:n.signal});d&&(d.blockName={initialValue:"",passesCondition:!0,valid:!0,value:e.blockName},N(d))})(),()=>{D(n)}},[b,h,u,s,a,P,f]);let F=_e(async({formState:n})=>{D(g.current);let c=new AbortController;g.current=c;let{state:d}=await b({id:u,collectionSlug:s,docPermissions:f,docPreferences:await P(),formState:n,globalSlug:a,operation:"update",schemaPath:h,signal:c.signal});return d?(d.blockName={initialValue:"",passesCondition:!0,valid:!0,value:e.blockName},d):n},[b,u,s,f,P,a,h,e.blockName]);W(()=>()=>{D(g.current)},[]);let T=[`${y}__row`,`${y}__row--no-errors`].filter(Boolean).join(" "),E=r?.admin?.components?.Label,m=Ce(()=>r&&S!==!1?k(ue,{beforeSubmit:[F],fields:r.fields,initialState:S,onChange:[F],submitted:i,uuid:Pe(),children:k(H,{baseClass:y,clientBlock:r,field:p,formData:e,formSchema:r.fields,nodeKey:o,path:`${t}.lexical_internal_feature.blocks.${e.blockType}`,schemaPath:h})}):k(me,{className:T,collapsibleStyle:"default",header:r?.admin?.components?.Label?E:k("div",{className:`${y}__block-header`,children:de("div",{children:[k(fe,{className:`${y}__block-pill ${y}__block-pill-${e?.blockType}`,pillStyle:"white",children:r&&typeof r.labels?.singular=="string"?ve(r.labels.singular,A):r?.slug}),k(pe,{path:"blockName",readOnly:p?.admin?.readOnly||!1})]})}),children:k(be,{height:"35vh"})},0),[r,S,F,i,p,o,t,h,T,A]);return k("div",{className:y+" "+y+"-"+e.blockType,children:m})};export{Ye as BlockComponent};
|
|
2
|
+
//# sourceMappingURL=component-YNHK5J3P.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{c as x,f as M}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=componentInline-
|
|
1
|
+
"use client";import{c as x,f as M}from"./chunk-YGRKYSDC.js";import{b as E}from"./chunk-CUIBIFW2.js";import{jsx as u,jsxs as S}from"react/jsx-runtime";import{useCallback as f,useEffect as R,useRef as A}from"react";import{useLexicalComposerContext as I}from"@lexical/react/LexicalComposerContext";import{useLexicalNodeSelection as K}from"@lexical/react/useLexicalNodeSelection";import{mergeRegister as P}from"@lexical/utils";import{getTranslation as h}from"@payloadcms/translations";import{Button as v,useTranslation as T}from"@payloadcms/ui";import{$getNodeByKey as j,$getSelection as Y,$isNodeSelection as z,CLICK_COMMAND as F,COMMAND_PRIORITY_LOW as p,KEY_BACKSPACE_COMMAND as W,KEY_DELETE_COMMAND as q}from"lexical";var l="inline-block",ie=D=>{let{formData:r,nodeKey:n}=D,[e]=I(),{i18n:b,t:C}=T(),{fieldProps:{featureClientSchemaMap:$,readOnly:k,schemaPath:y}}=E(),a=A(null),[o,c,m]=K(n),O=`${y}.lexical_internal_feature.blocks.lexical_inline_blocks.${r.blockType}`,i=$.blocks[O][0].blocks[0],L=f(()=>{e.update(()=>{j(n)?.remove()})},[e,n]),d=f(s=>{let t=Y();return o&&z(t)&&(s.preventDefault(),e.update(()=>{t.getNodes().forEach(B=>{M(B)&&B.remove()})})),!1},[e,o]),_=f(s=>{let t=s;return t.target===a.current||a.current?.contains(t.target)?(t.shiftKey?c(!o):o||(m(),c(!0)),!0):!1},[o,c,m]);R(()=>P(e.registerCommand(F,_,p),e.registerCommand(q,d,p),e.registerCommand(W,d,p)),[m,e,o,n,d,c,_]);let N=i?.labels?.singular?h(i.labels.singular,b):i?.slug,g=i?.admin?.components?.Label;return S("div",{className:[l,l+"-"+r.blockType,o&&`${l}--selected`].filter(Boolean).join(" "),ref:a,children:[g||u("div",{children:h(i.labels.singular,b)}),e.isEditable()&&S("div",{className:`${l}__actions`,children:[u(v,{buttonStyle:"icon-label",className:`${l}__editButton`,disabled:k,el:"div",icon:"edit",onClick:()=>{e.dispatchCommand(x,{fields:r,nodeKey:n})},round:!0,size:"small",tooltip:C("lexical:blocks:inlineBlocks:edit",{label:N})}),u(v,{buttonStyle:"icon-label",className:`${l}__removeButton`,disabled:k,icon:"x",onClick:s=>{s.preventDefault(),L()},round:!0,size:"small",tooltip:C("lexical:blocks:inlineBlocks:remove",{label:N})})]})]})};export{ie as InlineBlockComponent};
|
|
2
|
+
//# sourceMappingURL=componentInline-6RPSMLNJ.js.map
|