@payloadcms/richtext-lexical 4.0.0-internal.183b315 → 4.0.0-internal.293e026
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/bundled.css +1 -1
- package/dist/exports/client/chunk-ESITTE3C.js +2 -0
- package/dist/exports/client/chunk-ESITTE3C.js.map +7 -0
- package/dist/exports/client/componentInline-H24N7GUG.js +2 -0
- package/dist/exports/client/index.js +14 -14
- package/dist/exports/client/index.js.map +3 -3
- package/dist/features/blocks/client/component/index.d.ts.map +1 -1
- package/dist/features/blocks/client/component/index.js +2 -1
- package/dist/features/blocks/client/component/index.js.map +1 -1
- package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
- package/dist/features/blocks/client/componentInline/index.js +2 -1
- package/dist/features/blocks/client/componentInline/index.js.map +1 -1
- package/dist/features/blocks/client/index.d.ts.map +1 -1
- package/dist/features/blocks/client/index.js +4 -2
- package/dist/features/blocks/client/index.js.map +1 -1
- package/dist/features/blocks/server/index.d.ts.map +1 -1
- package/dist/features/blocks/server/index.js +4 -6
- package/dist/features/blocks/server/index.js.map +1 -1
- package/dist/field/bundled.css +1 -1
- package/dist/utilities/applyBaseFilterToFields.d.ts.map +1 -1
- package/dist/utilities/applyBaseFilterToFields.js +1 -2
- package/dist/utilities/applyBaseFilterToFields.js.map +1 -1
- package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js +1 -1
- package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js.map +1 -1
- package/package.json +7 -7
- package/dist/exports/client/chunk-ZYXHC5CY.js +0 -2
- package/dist/exports/client/chunk-ZYXHC5CY.js.map +0 -7
- package/dist/exports/client/componentInline-R3EPNYWF.js +0 -2
- /package/dist/exports/client/{componentInline-R3EPNYWF.js.map → componentInline-H24N7GUG.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applyBaseFilterToFields.d.ts","sourceRoot":"","sources":["../../src/utilities/applyBaseFilterToFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"applyBaseFilterToFields.d.ts","sourceRoot":"","sources":["../../src/utilities/applyBaseFilterToFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,eAAe,EAAa,MAAM,SAAS,CAAA;AAIhE;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,eAAe,GAAG,KAAK,EAAE,CAgGzF"}
|
|
@@ -77,10 +77,9 @@ export function applyBaseFilterToFields(fields, config) {
|
|
|
77
77
|
}
|
|
78
78
|
// Handle blocks
|
|
79
79
|
if (field.type === 'blocks') {
|
|
80
|
-
const blocks = field.blockReferences ?? field.blocks ?? [];
|
|
81
80
|
return {
|
|
82
81
|
...field,
|
|
83
|
-
blocks: blocks.map(block => {
|
|
82
|
+
blocks: field.blocks.map(block => {
|
|
84
83
|
if (typeof block === 'string') {
|
|
85
84
|
return block;
|
|
86
85
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applyBaseFilterToFields.js","names":["combineWhereConstraints","applyBaseFilterToFields","fields","config","map","field","type","relationshipField","originalFilterOptions","filterOptions","args","relationTo","req","user","originalResult","admin","collections","find","slug","hidden","baseFilter","baseListFilter","baseFilterResult","limit","page","sort","tabs","tab","blocks","
|
|
1
|
+
{"version":3,"file":"applyBaseFilterToFields.js","names":["combineWhereConstraints","applyBaseFilterToFields","fields","config","map","field","type","relationshipField","originalFilterOptions","filterOptions","args","relationTo","req","user","originalResult","admin","collections","find","slug","hidden","baseFilter","baseListFilter","baseFilterResult","limit","page","sort","tabs","tab","blocks","block"],"sources":["../../src/utilities/applyBaseFilterToFields.ts"],"sourcesContent":["import type { Field, SanitizedConfig, TypedUser } from 'payload'\n\nimport { combineWhereConstraints } from 'payload/shared'\n\n/**\n * Recursively applies baseFilter from collection config to relationship fields\n * within blocks. This ensures that relationship drawers in blocks respect\n * collection-level filters like multi-tenant filtering.\n *\n * Based on the fix from PR #13229 for LinkFeature\n */\nexport function applyBaseFilterToFields(fields: Field[], config: SanitizedConfig): Field[] {\n return fields.map((field) => {\n // Handle relationship fields\n if (field.type === 'relationship') {\n const relationshipField = field\n\n // Store the original filterOptions\n const originalFilterOptions = relationshipField.filterOptions\n\n // Create new filterOptions that includes baseFilter\n relationshipField.filterOptions = async (args) => {\n const { relationTo, req, user } = args\n\n // Call original filterOptions if it exists\n const originalResult =\n typeof originalFilterOptions === 'function'\n ? await originalFilterOptions(args)\n : (originalFilterOptions ?? true)\n\n // If original filter returns false, respect that\n if (originalResult === false) {\n return false\n }\n\n // Get the collection's admin config\n const admin = config.collections.find(({ slug }) => slug === relationTo)?.admin\n\n // Check if collection is hidden\n const hidden = admin?.hidden\n if (typeof hidden === 'function' && hidden({ user } as { user: TypedUser })) {\n return false\n }\n\n // Apply baseFilter (with backwards compatibility for baseListFilter)\n const baseFilter = admin?.baseFilter ?? admin?.baseListFilter\n const baseFilterResult = await baseFilter?.({\n limit: 0,\n page: 1,\n req,\n sort: 'id',\n })\n\n // If no baseFilter, return original result\n if (!baseFilterResult) {\n return originalResult\n }\n\n // If original result is true, just return the baseFilter\n if (originalResult === true) {\n return baseFilterResult\n }\n\n // Combine original and baseFilter results\n return combineWhereConstraints([originalResult, baseFilterResult], 'and')\n }\n\n return relationshipField\n }\n\n // Recursively process nested fields\n if ('fields' in field && field.fields) {\n return {\n ...field,\n fields: applyBaseFilterToFields(field.fields, config),\n }\n }\n\n // Handle tabs\n if (field.type === 'tabs' && 'tabs' in field) {\n return {\n ...field,\n tabs: field.tabs.map((tab) => ({\n ...tab,\n fields: applyBaseFilterToFields(tab.fields, config),\n })),\n }\n }\n\n // Handle blocks\n if (field.type === 'blocks') {\n return {\n ...field,\n blocks: field.blocks.map((block) => {\n if (typeof block === 'string') {\n return block\n }\n return {\n ...block,\n fields: applyBaseFilterToFields(block.fields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tB,uBAAA,CAAwB,CAACc,cAAA,EAAgBQ,gBAAA,CAAiB,EAAE;MACrE;MAEA,OAAOf,iBAAA;IACT;IAEA;IACA,IAAI,YAAYF,KAAA,IAASA,KAAA,CAAMH,MAAM,EAAE;MACrC,OAAO;QACL,GAAGG,KAAK;QACRH,MAAA,EAAQD,uBAAA,CAAwBI,KAAA,CAAMH,MAAM,EAAEC,MAAA;MAChD;IACF;IAEA;IACA,IAAIE,KAAA,CAAMC,IAAI,KAAK,UAAU,UAAUD,KAAA,EAAO;MAC5C,OAAO;QACL,GAAGA,KAAK;QACRqB,IAAA,EAAMrB,KAAA,CAAMqB,IAAI,CAACtB,GAAG,CAAEuB,GAAA,KAAS;UAC7B,GAAGA,GAAG;UACNzB,MAAA,EAAQD,uBAAA,CAAwB0B,GAAA,CAAIzB,MAAM,EAAEC,MAAA;QAC9C;MACF;IACF;IAEA;IACA,IAAIE,KAAA,CAAMC,IAAI,KAAK,UAAU;MAC3B,OAAO;QACL,GAAGD,KAAK;QACRuB,MAAA,EAAQvB,KAAA,CAAMuB,MAAM,CAACxB,GAAG,CAAEyB,KAAA;UACxB,IAAI,OAAOA,KAAA,KAAU,UAAU;YAC7B,OAAOA,KAAA;UACT;UACA,OAAO;YACL,GAAGA,KAAK;YACR3B,MAAA,EAAQD,uBAAA,CAAwB4B,KAAA,CAAM3B,MAAM,EAAEC,MAAA;UAChD;QACF;MACF;IACF;IAEA,OAAOE,KAAA;EACT;AACF","ignoreList":[]}
|
|
@@ -37,7 +37,7 @@ export const upgradeDocumentFieldsRecursively = ({
|
|
|
37
37
|
if (field.type === 'blocks') {
|
|
38
38
|
data[field.name].forEach(row => {
|
|
39
39
|
const blockTypeToMatch = row?.blockType;
|
|
40
|
-
const block = payload.blocks[blockTypeToMatch] ??
|
|
40
|
+
const block = payload.blocks[blockTypeToMatch] ?? field.blocks.find(block => typeof block !== 'string' && block.slug === blockTypeToMatch);
|
|
41
41
|
if (block) {
|
|
42
42
|
found += upgradeDocumentFieldsRecursively({
|
|
43
43
|
data: row,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upgradeDocumentFieldsRecursively.js","names":["createHeadlessEditor","fieldAffectsData","fieldHasSubFields","fieldIsArrayType","tabHasName","getEnabledNodes","upgradeDocumentFieldsRecursively","data","fields","found","payload","field","name","type","tabs","forEach","tab","Array","isArray","row","blockTypeToMatch","blockType","block","blocks","
|
|
1
|
+
{"version":3,"file":"upgradeDocumentFieldsRecursively.js","names":["createHeadlessEditor","fieldAffectsData","fieldHasSubFields","fieldIsArrayType","tabHasName","getEnabledNodes","upgradeDocumentFieldsRecursively","data","fields","found","payload","field","name","type","tabs","forEach","tab","Array","isArray","row","blockTypeToMatch","blockType","block","blocks","find","slug","editor","features","length","editorState","headlessEditor","nodes","editorConfig","update","setEditorState","parseEditorState","discrete","getEditorState","toJSON"],"sources":["../../../src/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.ts"],"sourcesContent":["import type { SerializedEditorState } from 'lexical'\nimport type { Field, FlattenedBlock, Payload } from 'payload'\n\nimport { createHeadlessEditor } from '@lexical/headless'\nimport { fieldAffectsData, fieldHasSubFields, fieldIsArrayType, tabHasName } from 'payload/shared'\n\nimport type { LexicalRichTextAdapter } from '../../types/index.js'\n\nimport { getEnabledNodes } from '../../lexical/nodes/index.js'\n\ntype NestedRichTextFieldsArgs = {\n data: Record<string, unknown>\n\n fields: Field[]\n found: number\n payload: Payload\n}\n\nexport const upgradeDocumentFieldsRecursively = ({\n data,\n fields,\n found,\n payload,\n}: NestedRichTextFieldsArgs): number => {\n for (const field of fields) {\n if (fieldHasSubFields(field) && !fieldIsArrayType(field)) {\n if (fieldAffectsData(field) && typeof data[field.name] === 'object') {\n found += upgradeDocumentFieldsRecursively({\n data: data[field.name] as Record<string, unknown>,\n fields: field.fields,\n found,\n payload,\n })\n } else {\n found += upgradeDocumentFieldsRecursively({\n data,\n fields: field.fields,\n found,\n payload,\n })\n }\n } else if (field.type === 'tabs') {\n field.tabs.forEach((tab) => {\n found += upgradeDocumentFieldsRecursively({\n data: (tabHasName(tab) ? data[tab.name] : data) as Record<string, unknown>,\n fields: tab.fields,\n found,\n payload,\n })\n })\n } else if (Array.isArray(data[field.name])) {\n if (field.type === 'blocks') {\n ;(data[field.name] as Record<string, unknown>[]).forEach((row) => {\n const blockTypeToMatch: string = row?.blockType as string\n\n const block =\n payload.blocks[blockTypeToMatch] ??\n (field.blocks.find(\n (block) => typeof block !== 'string' && block.slug === blockTypeToMatch,\n ) as FlattenedBlock | undefined)\n\n if (block) {\n found += upgradeDocumentFieldsRecursively({\n data: row,\n fields: block.fields,\n found,\n payload,\n })\n }\n })\n }\n\n if (field.type === 'array') {\n ;(data[field.name] as Record<string, unknown>[]).forEach((row) => {\n found += upgradeDocumentFieldsRecursively({\n data: row,\n fields: field.fields,\n found,\n payload,\n })\n })\n }\n }\n\n if (\n field.type === 'richText' &&\n data[field.name] &&\n !Array.isArray(data[field.name]) &&\n 'root' in (data[field.name] as Record<string, unknown>)\n ) {\n // Lexical richText\n const editor: LexicalRichTextAdapter = field.editor as LexicalRichTextAdapter\n if (editor && typeof editor === 'object') {\n if ('features' in editor && editor.features?.length) {\n // Load lexical editor into lexical, then save it immediately\n const editorState = data[field.name] as SerializedEditorState\n\n const headlessEditor = createHeadlessEditor({\n nodes: getEnabledNodes({\n editorConfig: editor.editorConfig,\n }),\n })\n headlessEditor.update(\n () => {\n headlessEditor.setEditorState(headlessEditor.parseEditorState(editorState))\n },\n { discrete: true },\n )\n\n // get editor state\n data[field.name] = headlessEditor.getEditorState().toJSON()\n\n found++\n }\n }\n }\n }\n\n return found\n}\n"],"mappings":"AAGA,SAASA,oBAAoB,QAAQ;AACrC,SAASC,gBAAgB,EAAEC,iBAAiB,EAAEC,gBAAgB,EAAEC,UAAU,QAAQ;AAIlF,SAASC,eAAe,QAAQ;AAUhC,OAAO,MAAMC,gCAAA,GAAmCA,CAAC;EAC/CC,IAAI;EACJC,MAAM;EACNC,KA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AeO,cAAc,GAAGC,MAAM;UAEzD7B,KAAA;QACF;MACF;IACF;EACF;EAEA,OAAOA,KAAA;AACT","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/richtext-lexical",
|
|
3
|
-
"version": "4.0.0-internal.
|
|
3
|
+
"version": "4.0.0-internal.293e026",
|
|
4
4
|
"description": "The officially supported Lexical richtext adapter for Payload",
|
|
5
5
|
"homepage": "https://payloadcms.com",
|
|
6
6
|
"repository": {
|
|
@@ -374,8 +374,8 @@
|
|
|
374
374
|
"react-error-boundary": "6.1.1",
|
|
375
375
|
"ts-essentials": "10.0.3",
|
|
376
376
|
"uuid": "14.0.0",
|
|
377
|
-
"@payloadcms/
|
|
378
|
-
"@payloadcms/
|
|
377
|
+
"@payloadcms/ui": "4.0.0-internal.293e026",
|
|
378
|
+
"@payloadcms/translations": "4.0.0-internal.293e026"
|
|
379
379
|
},
|
|
380
380
|
"devDependencies": {
|
|
381
381
|
"@babel/cli": "7.27.2",
|
|
@@ -394,16 +394,16 @@
|
|
|
394
394
|
"esbuild": "0.27.1",
|
|
395
395
|
"esbuild-sass-plugin": "3.3.1",
|
|
396
396
|
"swc-plugin-transform-remove-imports": "8.3.0",
|
|
397
|
-
"
|
|
398
|
-
"
|
|
397
|
+
"@payloadcms/eslint-config": "3.28.0",
|
|
398
|
+
"payload": "4.0.0-internal.293e026"
|
|
399
399
|
},
|
|
400
400
|
"peerDependencies": {
|
|
401
401
|
"@faceless-ui/modal": "3.0.0",
|
|
402
402
|
"@faceless-ui/scroll-info": "2.0.0",
|
|
403
403
|
"react": "^19.0.1 || ^19.1.2 || ^19.2.1",
|
|
404
404
|
"react-dom": "^19.0.1 || ^19.1.2 || ^19.2.1",
|
|
405
|
-
"@payloadcms/next": "4.0.0-internal.
|
|
406
|
-
"payload": "4.0.0-internal.
|
|
405
|
+
"@payloadcms/next": "4.0.0-internal.293e026",
|
|
406
|
+
"payload": "4.0.0-internal.293e026"
|
|
407
407
|
},
|
|
408
408
|
"engines": {
|
|
409
409
|
"node": ">=24.15.0"
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as ue,b as me,c as de}from"./chunk-5VIL27GI.js";import{b as ae}from"./chunk-RJ5MAOKZ.js";import{jsx as l,jsxs as _}from"react/jsx-runtime";import{useLexicalComposerContext as Ke}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Je}from"@lexical/react/useLexicalEditable";import{getTranslation as fe}from"@payloadcms/translations";import{Button as pe,Drawer as ze,EditDepthProvider as Ve,Form as He,formatDrawerSlug as We,RenderFields as Xe,ShimmerEffect as Ge,useConfig as Ue,useDocumentForm as qe,useDocumentInfo as Qe,useEditDepth as Ye,useServerFunctions as Ze,useTranslation as et}from"@payloadcms/ui";import{abortAndIgnore as J}from"@payloadcms/ui/shared";import{$getNodeByKey as z,SKIP_DOM_SELECTION_TAG as be}from"lexical";import{deepCopyObjectSimpleWithoutReactComponents as V,reduceFieldsToValues as tt}from"payload/shared";import F,{createContext as ot,useCallback as H,useEffect as E,useMemo as B,useRef as y}from"react";import{v4 as nt}from"uuid";import{jsx as Le}from"react/jsx-runtime";import Pe from"bson-objectid";import{$applyNodeReplacement as Re}from"lexical";import je from"react";import{addClassNamesToElement as Ne}from"@lexical/utils";import Oe from"bson-objectid";import{$applyNodeReplacement as Te,DecoratorNode as Ee}from"lexical";var S=class extends Ee{__cacheBuster;__fields;constructor({cacheBuster:t,fields:e,key:i}){super(i),this.__fields=e,this.__cacheBuster=t||0}static clone(t){return new this({cacheBuster:t.__cacheBuster,fields:t.__fields,key:t.__key})}static getType(){return"inlineBlock"}static importDOM(){return{}}static importJSON(t){return $e(t.fields)}static isInline(){return!1}canIndent(){return!0}createDOM(t){let e=document.createElement("span");return Ne(e,t?.theme?.inlineBlock),e}decorate(t,e){return null}exportDOM(){let t=document.createElement("span");t.classList.add("inline-block-container");let e=document.createTextNode(this.getTextContent());return t.append(e),{element:t}}exportJSON(){return{type:"inlineBlock",fields:this.getFields(),version:1}}getCacheBuster(){return this.getLatest().__cacheBuster}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}isInline(){return!0}setFields(t,e){let i=this.getWritable();i.__fields=t,e||i.__cacheBuster++}updateDOM(){return!1}};function $e(c){return Te(new S({fields:{...c,id:c?.id||new Oe.default().toHexString()}}))}var Me=je.lazy(()=>import("./componentInline-R3EPNYWF.js").then(c=>({default:c.InlineBlockComponent}))),T=class extends S{static clone(t){return super.clone(t)}static getType(){return super.getType()}static importJSON(t){return Ae(t.fields)}decorate(...[t,e,i,f]){return Le(Me,{cacheBuster:this.getCacheBuster(),className:e.theme.inlineBlock??"LexicalEditorTheme__inlineBlock",CustomBlock:i,CustomLabel:f,formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Ae(c){return Re(new T({fields:{...c,id:c?.id||new Pe.default().toHexString()}}))}function K(c){return c instanceof T}var he=ot({initialState:!1}),ke=()=>F.use(he),vt=c=>{let{cacheBuster:t,className:e,CustomBlock:i,CustomLabel:f,formData:o,nodeKey:a}=c,[k]=Ke(),u=Je(),{i18n:$,t:h}=et(),{createdInlineBlock:W,fieldProps:{featureClientSchemaMap:Be,initialLexicalFormState:Ce,schemaPath:X},setCreatedInlineBlock:G,uuid:ge}=ae(),{fields:D}=qe(),{getFormState:I}=Ze(),xe=Ye(),U=y(!1),[m,L]=F.useState(()=>{let r=Ce?.[o.id]?.formState;return r?Object.fromEntries(Object.entries(r).map(([s,n])=>[s,s in o?{...n,initialValue:o[s],value:o[s]}:n])):!1}),q=y(!1),Q=y(t);E(()=>{q.current?(Q.current!==t&&L(!1),Q.current=t):q.current=!0},[t]);let[Se]=F.useState(()=>nt()),[Y,Z]=F.useState(()=>{if(!f)return m?._components?.customComponents?.BlockLabel??void 0}),[ee,te]=F.useState(()=>{if(!i)return m?._components?.customComponents?.Block??void 0}),oe=B(()=>i?l(i,{className:e,formData:o,isEditor:!0,isJSXConverter:!1,nodeKey:a,useInlineBlockComponentContext:ke}):ee,[i,e,o,a,ee]),P=B(()=>f?l(f,{className:e,formData:o,isEditor:!0,isJSXConverter:!1,nodeKey:a,useInlineBlockComponentContext:ke}):Y,[f,e,o,a,Y]),ne=We({slug:`lexical-inlineBlocks-create-${ge}-${o.id}`,depth:xe}),{toggleDrawer:b}=de(ne,!0),_e=y(null),{id:w,collectionSlug:v,getDocPreferences:N,globalSlug:O}=Qe(),{config:ye}=Ue(),Fe=`${X}.lexical_internal_feature.blocks.lexical_inline_blocks.${o.blockType}`,C=Be.blocks?.[Fe]?.[0],d=C?.blockReferences?typeof C?.blockReferences?.[0]=="string"?ye.blocksMap[C?.blockReferences?.[0]]:C?.blockReferences?.[0]:C?.blocks?.[0],re=d?.fields??[];E(()=>{!U.current&&W?.getKey()===a&&(re.length>2&&b(),G?.(void 0),U.current=!0)},[re.length,W,a,G,b]);let se=H(()=>{k.update(()=>{z(a)?.remove()})},[k,a]),g=d?.labels?.singular?fe(d?.labels.singular,$):d?.slug,R=y(new AbortController),x=`${X}.lexical_internal_feature.blocks.lexical_inline_blocks.${d?.slug}.fields`;E(()=>{let r=new AbortController;return o&&!m&&(async()=>{let{state:n}=await I({id:w,collectionSlug:v,data:o,docPermissions:{fields:!0},docPreferences:await N(),documentFormState:V(D,{excludeFiles:!0}),globalSlug:O,initialBlockData:o,initialBlockFormState:o,operation:"update",readOnly:!u,renderAllFields:!0,schemaPath:x,signal:r.signal});if(n){let p=tt(V(n,{excludeFiles:!0}),!0);k.update(()=>{let A=z(a);if(A&&K(A)){let ce=p;ce.blockType=o.blockType,A.setFields(ce,!0)}},{tag:be}),L(n),f||Z(n._components?.customComponents?.BlockLabel),i||te(n._components?.customComponents?.Block)}})(),()=>{J(r)}},[I,k,a,u,f,i,x,w,o,m,v,O,N,D]);let le=H(async({formState:r,submit:s})=>{J(R.current);let n=new AbortController;R.current=n;let{state:p}=await I({id:w,collectionSlug:v,docPermissions:{fields:!0},docPreferences:await N(),documentFormState:V(D,{excludeFiles:!0}),formState:r,globalSlug:O,initialBlockFormState:r,operation:"update",readOnly:!u,renderAllFields:!!s,schemaPath:x,signal:n.signal});return p?(s&&(f||Z(p._components?.customComponents?.BlockLabel),i||te(p._components?.customComponents?.Block)),p):r},[I,w,v,N,D,O,u,x,i,f]);E(()=>{let r=(s,n)=>Object.keys(n).some(p=>n[p]&&s[p]!==n[p].value);return()=>{m&&r(o,m)&&L(!1),J(R.current)}},[o,m]);let De=H((r,s)=>{s.blockType=o.blockType,k.update(()=>{let n=z(a);n&&K(n)&&n.setFields(s,!0)},{tag:be})},[k,a,o]),{headerActions:Ie,submitRef:we}=ue(),j=B(()=>()=>l(pe,{buttonStyle:"ghost",className:`${e}__removeButton`,disabled:!u,icon:"x",onClick:r=>{r.preventDefault(),r.stopPropagation(),se()},round:!0,size:"medium",tooltip:h("lexical:blocks:inlineBlocks:remove",{label:g})}),[e,g,u,se,h]),ve=B(()=>()=>l(pe,{buttonStyle:"ghost",className:`${e}__editButton`,disabled:!u,el:"button",icon:"edit",onClick:()=>{b()},round:!0,size:"medium",tooltip:h("lexical:blocks:inlineBlocks:edit",{label:g})}),[e,g,u,h,b]),M=B(()=>({children:r,className:s})=>l("div",{className:[`${e}__container`,e+"-"+o.blockType,s].filter(Boolean).join(" "),...u?{onClick:()=>b(),onKeyDown:n=>{(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),b())},role:"button",tabIndex:0}:{},ref:_e,children:r}),[e,o.blockType,u,b]),ie=B(()=>P?()=>P:()=>l("div",{children:d?.labels?fe(d?.labels.singular,$):""}),[P,d?.labels,$]);return d?_(He,{beforeSubmit:[async({formState:r})=>await le({formState:r,submit:!0})],disableValidationOnSubmit:!0,el:"div",fields:d?.fields,initialState:m||{},onChange:[le],onSubmit:(r,s)=>{De(r,s),b()},uuid:Se,children:[l(Ve,{children:l(ze,{className:"",headerActions:Ie,slug:ne,title:h(`lexical:blocks:inlineBlocks:${o?.id?"edit":"create"}`,{label:g??h("lexical:blocks:inlineBlocks:label")}),children:m?_("div",{className:"fields-drawer",children:[l(Xe,{fields:d?.fields,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:x,permissions:!0,readOnly:!u}),l(me,{submitRef:we})]}):null})}),oe?l(he,{value:{EditButton:ve,initialState:m,InlineBlockContainer:M,Label:ie,nodeKey:a,RemoveButton:j},children:oe}):_(M,{children:[m?l(ie,{}):l(Ge,{height:"15px",width:"40px"}),u?l("div",{className:`${e}__actions`,children:l(j,{})}):null]})]}):_(M,{className:`${e}-not-found`,children:[_("span",{children:["Error: Block '",o.blockType,"' not found"]}),u?l("div",{className:`${e}__actions`,children:l(j,{})}):null]})};export{ke as a,vt as b,T as c,Ae as d,K as e};
|
|
2
|
-
//# sourceMappingURL=chunk-ZYXHC5CY.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/features/blocks/client/componentInline/index.tsx", "../../../src/features/blocks/client/nodes/InlineBlocksNode.tsx", "../../../src/features/blocks/server/nodes/InlineBlocksNode.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\n\nimport type { BlocksFieldClient, ClientBlock, Data, FormState } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n Drawer,\n EditDepthProvider,\n Form,\n formatDrawerSlug,\n RenderFields,\n ShimmerEffect,\n useConfig,\n useDocumentForm,\n useDocumentInfo,\n useEditDepth,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport { $getNodeByKey, SKIP_DOM_SELECTION_TAG } from 'lexical'\n\nimport './index.css'\nimport '../../../../utilities/fieldsDrawer/index.css'\n\nimport { deepCopyObjectSimpleWithoutReactComponents, reduceFieldsToValues } from 'payload/shared'\nimport React, { createContext, useCallback, useEffect, useMemo, useRef } from 'react'\nimport { v4 as uuid } from 'uuid'\n\nimport type { ViewMapInlineBlockComponentProps } from '../../../../types/index.js'\nimport type { InlineBlockFields } from '../../server/schema.js'\nimport type { BlockComponentProps } from '../component/index.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport {\n RegisterFormSubmit,\n useDrawerSubmit,\n} from '../../../../utilities/fieldsDrawer/useDrawerSubmit.js'\nimport { useLexicalDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport { $isInlineBlockNode } from '../nodes/InlineBlocksNode.js'\n\nexport type InlineBlockComponentProps<\n TFormData extends Record<string, unknown> = InlineBlockFields,\n> = {\n readonly CustomBlock?: React.FC<ViewMapInlineBlockComponentProps>\n readonly CustomLabel?: React.FC<ViewMapInlineBlockComponentProps>\n} & Pick<BlockComponentProps<TFormData>, 'cacheBuster' | 'className' | 'formData' | 'nodeKey'>\n\nexport type InlineBlockComponentContextType = {\n EditButton?: React.FC\n initialState: false | FormState | undefined\n InlineBlockContainer?: React.FC<{ children: React.ReactNode }>\n Label?: React.FC\n nodeKey?: string\n RemoveButton?: React.FC\n}\n\nconst InlineBlockComponentContext = createContext<InlineBlockComponentContextType>({\n initialState: false,\n})\n\nexport const useInlineBlockComponentContext = () => React.use(InlineBlockComponentContext)\n\nexport const InlineBlockComponent: React.FC<InlineBlockComponentProps<InlineBlockFields>> = (\n props,\n) => {\n const {\n cacheBuster,\n className: baseClass,\n CustomBlock: CustomBlockFromProps,\n CustomLabel: CustomLabelFromProps,\n formData,\n nodeKey,\n } = props\n\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n const { i18n, t } = useTranslation<object, string>()\n const {\n createdInlineBlock,\n fieldProps: { featureClientSchemaMap, initialLexicalFormState, schemaPath },\n setCreatedInlineBlock,\n uuid: uuidFromContext,\n } = useEditorConfigContext()\n const { fields: parentDocumentFields } = useDocumentForm()\n\n const { getFormState } = useServerFunctions()\n const editDepth = useEditDepth()\n const firstTimeDrawer = useRef(false)\n\n const [initialState, setInitialState] = React.useState<false | FormState | undefined>(() => {\n // Initial form state that was calculated server-side. May have stale values\n const cachedFormState = initialLexicalFormState?.[formData.id]?.formState\n if (!cachedFormState) {\n return false\n }\n\n // Merge current formData values into the cached form state\n // This ensures that when the component remounts (e.g., due to view changes), we don't lose user edits\n return Object.fromEntries(\n Object.entries(cachedFormState).map(([fieldName, fieldState]) => [\n fieldName,\n fieldName in formData\n ? {\n ...fieldState,\n initialValue: formData[fieldName],\n value: formData[fieldName],\n }\n : fieldState,\n ]),\n )\n })\n\n const hasMounted = useRef(false)\n const prevCacheBuster = useRef(cacheBuster)\n useEffect(() => {\n if (hasMounted.current) {\n if (prevCacheBuster.current !== cacheBuster) {\n setInitialState(false)\n }\n prevCacheBuster.current = cacheBuster\n } else {\n hasMounted.current = true\n }\n }, [cacheBuster])\n\n const [formUuid] = React.useState(() => uuid())\n\n // Server-rendered custom components (from admin.components, NOT viewMap).\n // When viewMap components exist, we render them directly with formData instead.\n const [CustomLabel, setCustomLabel] = React.useState<React.ReactNode | undefined>(() => {\n if (CustomLabelFromProps) {\n return undefined\n }\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return initialState?.['_components']?.customComponents?.BlockLabel ?? undefined\n })\n\n const [CustomBlock, setCustomBlock] = React.useState<React.ReactNode | undefined>(() => {\n if (CustomBlockFromProps) {\n return undefined\n }\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return initialState?.['_components']?.customComponents?.Block ?? undefined\n })\n\n const resolvedCustomBlock = useMemo(() => {\n if (CustomBlockFromProps) {\n return (\n <CustomBlockFromProps\n className={baseClass}\n formData={formData}\n isEditor={true}\n isJSXConverter={false}\n nodeKey={nodeKey}\n // eslint-disable-next-line react-compiler/react-compiler -- intentionally passed as a prop for custom block components to call\n useInlineBlockComponentContext={useInlineBlockComponentContext}\n />\n )\n }\n return CustomBlock\n }, [CustomBlockFromProps, baseClass, formData, nodeKey, CustomBlock])\n\n const resolvedCustomLabel = useMemo(() => {\n if (CustomLabelFromProps) {\n return (\n <CustomLabelFromProps\n className={baseClass}\n formData={formData}\n isEditor={true}\n isJSXConverter={false}\n nodeKey={nodeKey}\n // eslint-disable-next-line react-compiler/react-compiler -- intentionally passed as a prop for custom block components to call\n useInlineBlockComponentContext={useInlineBlockComponentContext}\n />\n )\n }\n return CustomLabel\n }, [CustomLabelFromProps, baseClass, formData, nodeKey, CustomLabel])\n\n const drawerSlug = formatDrawerSlug({\n slug: `lexical-inlineBlocks-create-${uuidFromContext}-${formData.id}`,\n depth: editDepth,\n })\n const { toggleDrawer } = useLexicalDrawer(drawerSlug, true)\n\n const inlineBlockElemElemRef = useRef<HTMLDivElement | null>(null)\n const { id, collectionSlug, getDocPreferences, globalSlug } = useDocumentInfo()\n const { config } = useConfig()\n\n const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${formData.blockType}`\n\n const clientSchemaMap = featureClientSchemaMap['blocks']\n\n const blocksField: BlocksFieldClient | undefined = clientSchemaMap?.[\n componentMapRenderedBlockPath\n ]?.[0] as BlocksFieldClient | undefined\n\n const clientBlock: ClientBlock | undefined = blocksField?.blockReferences\n ? typeof blocksField?.blockReferences?.[0] === 'string'\n ? config.blocksMap[blocksField?.blockReferences?.[0]]\n : blocksField?.blockReferences?.[0]\n : blocksField?.blocks?.[0]\n\n const clientBlockFields = clientBlock?.fields ?? []\n\n // Open drawer on \"mount\"\n useEffect(() => {\n if (!firstTimeDrawer.current && createdInlineBlock?.getKey() === nodeKey) {\n // > 2 because they always have \"id\" and \"blockName\" fields\n if (clientBlockFields.length > 2) {\n toggleDrawer()\n }\n setCreatedInlineBlock?.(undefined)\n firstTimeDrawer.current = true\n }\n }, [clientBlockFields.length, createdInlineBlock, nodeKey, setCreatedInlineBlock, toggleDrawer])\n\n const removeInlineBlock = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey)?.remove()\n })\n }, [editor, nodeKey])\n\n const blockDisplayName = clientBlock?.labels?.singular\n ? getTranslation(clientBlock?.labels.singular, i18n)\n : clientBlock?.slug\n\n const onChangeAbortControllerRef = useRef(new AbortController())\n const schemaFieldsPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${clientBlock?.slug}.fields`\n\n // Initial state for newly created blocks\n useEffect(() => {\n const abortController = new AbortController()\n\n const awaitInitialState = async () => {\n /*\n * This will only run if a new block is created. For all existing blocks that are loaded when the document is loaded, or when the form is saved,\n * this is not run, as the lexical field RSC will fetch the state server-side and pass it to the client. That way, we avoid unnecessary client-side\n * requests. Though for newly created blocks, we need to fetch the state client-side, as the server doesn't know about the block yet.\n */\n const { state } = await getFormState({\n id,\n collectionSlug,\n data: formData,\n docPermissions: { fields: true },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields, {\n excludeFiles: true,\n }),\n globalSlug,\n initialBlockData: formData,\n initialBlockFormState: formData,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: abortController.signal,\n })\n\n if (state) {\n const newFormStateData: InlineBlockFields = reduceFieldsToValues(\n deepCopyObjectSimpleWithoutReactComponents(state, { excludeFiles: true }),\n true,\n ) as InlineBlockFields\n\n // Things like default values may come back from the server => update the node with the new data\n editor.update(\n () => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n const newData = newFormStateData\n newData.blockType = formData.blockType\n\n node.setFields(newData, true)\n }\n },\n // Without this, the outer editor's reconciler resets DOM selection\n // back into its own root, kicking focus out of any nested richText.\n { tag: SKIP_DOM_SELECTION_TAG },\n )\n\n setInitialState(state)\n if (!CustomLabelFromProps) {\n setCustomLabel(state['_components']?.customComponents?.BlockLabel)\n }\n if (!CustomBlockFromProps) {\n setCustomBlock(state['_components']?.customComponents?.Block)\n }\n }\n }\n\n if (formData && !initialState) {\n void awaitInitialState()\n }\n\n return () => {\n abortAndIgnore(abortController)\n }\n }, [\n getFormState,\n editor,\n nodeKey,\n isEditable,\n CustomLabelFromProps,\n CustomBlockFromProps,\n schemaFieldsPath,\n id,\n formData,\n initialState,\n collectionSlug,\n globalSlug,\n getDocPreferences,\n parentDocumentFields,\n ])\n\n /**\n * HANDLE ONCHANGE\n */\n const onChange = useCallback(\n async ({ formState: prevFormState, submit }: { formState: FormState; submit?: boolean }) => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n\n const controller = new AbortController()\n onChangeAbortControllerRef.current = controller\n\n const { state } = await getFormState({\n id,\n collectionSlug,\n docPermissions: {\n fields: true,\n },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields, {\n excludeFiles: true,\n }),\n formState: prevFormState,\n globalSlug,\n initialBlockFormState: prevFormState,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: submit ? true : false,\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n if (!state) {\n return prevFormState\n }\n\n if (submit) {\n if (!CustomLabelFromProps) {\n setCustomLabel(state['_components']?.customComponents?.BlockLabel)\n }\n if (!CustomBlockFromProps) {\n setCustomBlock(state['_components']?.customComponents?.Block)\n }\n }\n\n return state\n },\n [\n getFormState,\n id,\n collectionSlug,\n getDocPreferences,\n parentDocumentFields,\n globalSlug,\n isEditable,\n schemaFieldsPath,\n CustomBlockFromProps,\n CustomLabelFromProps,\n ],\n )\n // cleanup effect\n useEffect(() => {\n const isStateOutOfSync = (formData: InlineBlockFields, initialState: FormState) => {\n return Object.keys(initialState).some(\n (key) => initialState[key] && formData[key] !== initialState[key].value,\n )\n }\n\n return () => {\n // If the component is unmounted (either via removeInlineBlock or via lexical itself) and the form state got changed before,\n // we need to reset the initial state to force a re-fetch of the initial state when it gets mounted again (e.g. via lexical history undo).\n // Otherwise it would use an outdated initial state.\n if (initialState && isStateOutOfSync(formData, initialState)) {\n setInitialState(false)\n }\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [formData, initialState])\n\n /**\n * HANDLE FORM SUBMIT\n */\n const onFormSubmit = useCallback(\n (formState: FormState, newData: Data) => {\n newData.blockType = formData.blockType\n\n editor.update(\n () => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n node.setFields(newData as InlineBlockFields, true)\n }\n },\n // Without this, the outer editor's reconciler resets DOM selection\n // back into its own root, kicking focus out of any nested richText.\n { tag: SKIP_DOM_SELECTION_TAG },\n )\n },\n [editor, nodeKey, formData],\n )\n\n const { headerActions, submitRef } = useDrawerSubmit()\n\n const RemoveButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"ghost\"\n className={`${baseClass}__removeButton`}\n disabled={!isEditable}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n e.stopPropagation()\n removeInlineBlock()\n }}\n round\n size=\"medium\"\n tooltip={t('lexical:blocks:inlineBlocks:remove', { label: blockDisplayName })}\n />\n ),\n [baseClass, blockDisplayName, isEditable, removeInlineBlock, t],\n )\n\n const EditButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"ghost\"\n className={`${baseClass}__editButton`}\n disabled={!isEditable}\n el=\"button\"\n icon=\"edit\"\n onClick={() => {\n toggleDrawer()\n }}\n round\n size=\"medium\"\n tooltip={t('lexical:blocks:inlineBlocks:edit', { label: blockDisplayName })}\n />\n ),\n [baseClass, blockDisplayName, isEditable, t, toggleDrawer],\n )\n\n const InlineBlockContainer = useMemo(\n () =>\n ({ children, className }: { children: React.ReactNode; className?: string }) => (\n <div\n className={[`${baseClass}__container`, baseClass + '-' + formData.blockType, className]\n .filter(Boolean)\n .join(' ')}\n {...(isEditable\n ? {\n onClick: () => toggleDrawer(),\n onKeyDown: (e: React.KeyboardEvent) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n toggleDrawer()\n }\n },\n role: 'button',\n tabIndex: 0,\n }\n : {})}\n ref={inlineBlockElemElemRef}\n >\n {children}\n </div>\n ),\n [baseClass, formData.blockType, isEditable, toggleDrawer],\n )\n\n const Label = useMemo(() => {\n if (resolvedCustomLabel) {\n return () => resolvedCustomLabel\n } else {\n return () => (\n <div>{clientBlock?.labels ? getTranslation(clientBlock?.labels.singular, i18n) : ''}</div>\n )\n }\n }, [resolvedCustomLabel, clientBlock?.labels, i18n])\n\n if (!clientBlock) {\n return (\n <InlineBlockContainer className={`${baseClass}-not-found`}>\n <span>Error: Block '{formData.blockType}' not found</span>\n {isEditable ? (\n <div className={`${baseClass}__actions`}>\n <RemoveButton />\n </div>\n ) : null}\n </InlineBlockContainer>\n )\n }\n\n return (\n <Form\n beforeSubmit={[\n async ({ formState }) => {\n // This is only called when form is submitted from drawer\n return await onChange({ formState, submit: true })\n },\n ]}\n disableValidationOnSubmit\n el=\"div\"\n fields={clientBlock?.fields}\n initialState={initialState || {}}\n onChange={[onChange]}\n onSubmit={(formState, data) => {\n onFormSubmit(formState, data)\n toggleDrawer()\n }}\n uuid={formUuid}\n >\n <EditDepthProvider>\n <Drawer\n className={''}\n headerActions={headerActions}\n slug={drawerSlug}\n title={t(`lexical:blocks:inlineBlocks:${formData?.id ? 'edit' : 'create'}`, {\n label: blockDisplayName ?? t('lexical:blocks:inlineBlocks:label'),\n })}\n >\n {initialState ? (\n <div className=\"fields-drawer\">\n <RenderFields\n fields={clientBlock?.fields}\n forceRender\n parentIndexPath=\"\"\n parentPath=\"\" // See Blocks feature path for details as for why this is empty\n parentSchemaPath={schemaFieldsPath}\n permissions={true}\n readOnly={!isEditable}\n />\n <RegisterFormSubmit submitRef={submitRef} />\n </div>\n ) : null}\n </Drawer>\n </EditDepthProvider>\n {resolvedCustomBlock ? (\n <InlineBlockComponentContext\n value={{\n EditButton,\n initialState,\n InlineBlockContainer,\n Label,\n nodeKey,\n RemoveButton,\n }}\n >\n {resolvedCustomBlock}\n </InlineBlockComponentContext>\n ) : (\n <InlineBlockContainer>\n {initialState ? <Label /> : <ShimmerEffect height=\"15px\" width=\"40px\" />}\n {isEditable ? (\n <div className={`${baseClass}__actions`}>\n <RemoveButton />\n </div>\n ) : null}\n </InlineBlockContainer>\n )}\n </Form>\n )\n}\n", "'use client'\nimport ObjectID from 'bson-objectid'\nimport {\n $applyNodeReplacement,\n type EditorConfig,\n type LexicalEditor,\n type LexicalNode,\n} from 'lexical'\nimport React, { type JSX } from 'react'\n\nimport type { ViewMapInlineBlockComponentProps } from '../../../../types/index.js'\nimport type { InlineBlockFields, SerializedInlineBlockNode } from '../../server/schema.js'\n\nimport { ServerInlineBlockNode } from '../../server/nodes/InlineBlocksNode.js'\n\nconst InlineBlockComponent = React.lazy(() =>\n import('../componentInline/index.js').then((module) => ({\n default: module.InlineBlockComponent,\n })),\n)\n\nexport type InlineBlockDecorateFunction = (\n editor: LexicalEditor,\n config: EditorConfig,\n CustomBlock?: React.FC<ViewMapInlineBlockComponentProps>,\n CustomLabel?: React.FC<ViewMapInlineBlockComponentProps>,\n) => JSX.Element\n\nexport class InlineBlockNode extends ServerInlineBlockNode {\n static override clone(node: ServerInlineBlockNode): ServerInlineBlockNode {\n return super.clone(node)\n }\n\n static override getType(): string {\n return super.getType()\n }\n\n static override importJSON(serializedNode: SerializedInlineBlockNode): InlineBlockNode {\n const node = $createInlineBlockNode(serializedNode.fields)\n return node\n }\n\n override decorate(\n ...[_editor, config, CustomBlock, CustomLabel]: Parameters<InlineBlockDecorateFunction>\n ): ReturnType<InlineBlockDecorateFunction> {\n return (\n <InlineBlockComponent\n cacheBuster={this.getCacheBuster()}\n className={config.theme.inlineBlock ?? 'LexicalEditorTheme__inlineBlock'}\n CustomBlock={CustomBlock}\n CustomLabel={CustomLabel}\n formData={this.getFields()}\n nodeKey={this.getKey()}\n />\n )\n }\n\n override exportJSON(): SerializedInlineBlockNode {\n return super.exportJSON()\n }\n}\n\nexport function $createInlineBlockNode(fields: Exclude<InlineBlockFields, 'id'>): InlineBlockNode {\n return $applyNodeReplacement(\n new InlineBlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\n },\n }),\n )\n}\n\nexport function $isInlineBlockNode(\n node: InlineBlockNode | LexicalNode | null | undefined,\n): node is InlineBlockNode {\n return node instanceof InlineBlockNode\n}\n", "import type {\n DOMConversionMap,\n DOMExportOutput,\n EditorConfig,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n} from 'lexical'\nimport type React from 'react'\nimport type { JSX } from 'react'\n\nimport { addClassNamesToElement } from '@lexical/utils'\nimport ObjectID from 'bson-objectid'\nimport { $applyNodeReplacement, DecoratorNode } from 'lexical'\n\nimport type { InlineBlockFields, SerializedInlineBlockNode } from '../schema.js'\n\nexport class ServerInlineBlockNode extends DecoratorNode<null | React.ReactElement> {\n __cacheBuster: number\n __fields: InlineBlockFields\n\n constructor({\n cacheBuster,\n fields,\n key,\n }: {\n cacheBuster?: number\n fields: InlineBlockFields\n key?: NodeKey\n }) {\n super(key)\n this.__fields = fields\n this.__cacheBuster = cacheBuster || 0\n }\n\n static override clone(node: ServerInlineBlockNode): ServerInlineBlockNode {\n return new this({\n cacheBuster: node.__cacheBuster,\n fields: node.__fields,\n key: node.__key,\n })\n }\n\n static override getType(): string {\n return 'inlineBlock'\n }\n\n static override importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {}\n }\n\n static override importJSON(serializedNode: SerializedInlineBlockNode): ServerInlineBlockNode {\n const node = $createServerInlineBlockNode(serializedNode.fields)\n return node\n }\n\n static isInline(): false {\n return false\n }\n\n canIndent() {\n return true\n }\n\n override createDOM(config?: EditorConfig): HTMLElement {\n const element = document.createElement('span')\n addClassNamesToElement(element, config?.theme?.inlineBlock)\n return element\n }\n\n override decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element | null {\n return null\n }\n\n override exportDOM(): DOMExportOutput {\n const element = document.createElement('span')\n element.classList.add('inline-block-container')\n\n const text = document.createTextNode(this.getTextContent())\n element.append(text)\n return { element }\n }\n\n override exportJSON(): SerializedInlineBlockNode {\n return {\n type: 'inlineBlock',\n fields: this.getFields(),\n version: 1,\n }\n }\n\n getCacheBuster(): number {\n return this.getLatest().__cacheBuster\n }\n\n getFields(): InlineBlockFields {\n return this.getLatest().__fields\n }\n\n override getTextContent(): string {\n return `Block Field`\n }\n\n override isInline() {\n return true\n }\n\n setFields(fields: InlineBlockFields, preventFormStateUpdate?: boolean): void {\n const writable = this.getWritable()\n writable.__fields = fields\n if (!preventFormStateUpdate) {\n writable.__cacheBuster++\n }\n }\n\n override updateDOM(): boolean {\n return false\n }\n}\n\nexport function $createServerInlineBlockNode(\n fields: Exclude<InlineBlockFields, 'id'>,\n): ServerInlineBlockNode {\n return $applyNodeReplacement(\n new ServerInlineBlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\n },\n }),\n )\n}\n\nexport function $isServerInlineBlockNode(\n node: LexicalNode | null | ServerInlineBlockNode | undefined,\n): node is ServerInlineBlockNode {\n return node instanceof ServerInlineBlockNode\n}\n"],
|
|
5
|
-
"mappings": "oJAIA,OAASA,6BAAAA,OAAiC,wCAC1C,OAASC,sBAAAA,OAA0B,oCACnC,OAASC,kBAAAA,OAAsB,2BAC/B,OACEC,UAAAA,GACAC,UAAAA,GACAC,qBAAAA,GACAC,QAAAA,GACAC,oBAAAA,GACAC,gBAAAA,GACAC,iBAAAA,GACAC,aAAAA,GACAC,mBAAAA,GACAC,mBAAAA,GACAC,gBAAAA,GACAC,sBAAAA,GACAC,kBAAAA,OACK,iBACP,OAASC,kBAAAA,MAAsB,wBAC/B,OAASC,iBAAAA,EAAeC,0BAAAA,OAA8B,UAEtD,OAAO,8CAAAC,EAAA,wBAAAC,OAAA,iBACP,OAAOC,GAAA,iBAAAC,GAAA,eAAAC,EAAA,aAAAC,EAAA,WAAAC,EAAA,UAAAC,MAAA,QAEP,OAASP,MAAAA,OAAAA,gDC3BT,OAAOQ,OAAc,gBACrB,OACEC,yBAAAA,OAIK,UACP,OAAOC,OAAyB,QCGhC,OAASC,0BAAAA,OAA8B,iBAC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AqB9H,SAAW,CAAA,iBAAGG,EAAqB,UAAA,aAAA,MACtDwH,EAAA,MAAA,WAAK,GAAA7H,CAAA,qBACL6H,EACCA,EAAC,CAAA,CAAA,IAAI3H,IAAAA",
|
|
6
|
-
"names": ["useLexicalComposerContext", "useLexicalEditable", "getTranslation", "Button", "Drawer", "EditDepthProvider", "Form", "formatDrawerSlug", "RenderFields", "ShimmerEffect", "useConfig", "useDocumentForm", "useDocumentInfo", "useEditDepth", "useServerFunctions", "useTranslation", "abortAndIgnore", "$getNodeByKey", "SKIP_DOM_SELECTION_TAG", "deepCopyObjectSimpleWithoutReactComponents", "reduceFieldsToValues", "React", "createContext", "useCallback", "useEffect", "useMemo", "useRef", "ObjectID", "$applyNodeReplacement", "React", "addClassNamesToElement", "ObjectID", "$applyNodeReplacement", "DecoratorNode", "ServerInlineBlockNode", "__cacheBuster", "__fields", "constructor", "cacheBuster", "fields", "key", "clone", "node", "__key", "getType", "importDOM", "importJSON", "serializedNode", "$createServerInlineBlockNode", "isInline", "canIndent", "createDOM", "config", "element", "document", "createElement", "theme", "inlineBlock", "decorate", "editor", "exportDOM", "classList", "add", "text", "createTextNode", "getTextContent", "append", "exportJSON", "type", "getFields", "version", "getCacheBuster", "getLatest", "setFields", "preventFormStateUpdate", "writable", "getWritable", "updateDOM", "id", "default", "toHexString", "InlineBlockComponent", "React", "lazy", "then", "module", "default", "InlineBlockNode", "ServerInlineBlockNode", "clone", "node", "getType", "importJSON", "serializedNode", "$createInlineBlockNode", "fields", "decorate", "_editor", "config", "CustomBlock", "CustomLabel", "_jsx", "cacheBuster", "getCacheBuster", "className", "theme", "inlineBlock", "formData", "getFields", "nodeKey", "getKey", "exportJSON", "$applyNodeReplacement", "id", "ObjectID", "toHexString", "$isInlineBlockNode", "InlineBlockComponentContext", "createContext", "$isInlineBlockNode", "initialState", "React", "InlineBlockComponent", "props", "cacheBuster", "baseClass", "CustomBlockFromProps", "className", "CustomBlock", "CustomLabel", "formData", "nodeKey", "useLexicalEditable", "i18n", "t", "createdInlineBlock", "fieldProps", "featureClientSchemaMap", "uuidFromContext", "setCreatedInlineBlock", "useEditorConfigContext", "useDocumentForm", "fields", "getFormState", "useServerFunctions", "useRef", "editDepth", "useEditDepth", "setInitialState", "useState", "cachedFormState", "fieldName", "fieldState", "fromEntries", "entries", "initialValue", "prevCacheBuster", "useEffect", "hasMounted", "current", "formUuid", "uuid", "setCustomLabel", "CustomLabelFromProps", "customComponents", "BlockLabel", "resolvedCustomBlock", "useMemo", "isEditor", "useInlineBlockComponentContext", "resolvedCustomLabel", "drawerSlug", "depth", "toggleDrawer", "useLexicalDrawer", "id", "collectionSlug", "getDocPreferences", "globalSlug", "config", "useConfig", "componentMapRenderedBlockPath", "clientSchemaMap", "blocksField", "clientBlockFields", "firstTimeDrawer", "removeInlineBlock", "useCallback", "editor", "length", "$getNodeByKey", "blockDisplayName", "clientBlock", "getTranslation", "labels", "singular", "schemaFieldsPath", "abortController", "state", "data", "docPermissions", "deepCopyObjectSimpleWithoutReactComponents", "parentDocumentFields", "docPreferences", "documentFormState", "initialBlockData", "initialBlockFormState", "operation", "readOnly", "isEditable", "renderAllFields", "signal", "newFormStateData", "reduceFieldsToValues", "node", "newData", "SKIP_DOM_SELECTION_TAG", "setCustomBlock", "awaitInitialState", "abortAndIgnore", "submit", "formState", "controller", "onChangeAbortControllerRef", "excludeFiles", "prevFormState", "state_0", "isStateOutOfSync", "formData_0", "initialState_0", "key", "Object", "onFormSubmit", "blockType", "node_0", "tag", "headerActions", "submitRef", "useDrawerSubmit", "RemoveButton", "buttonStyle", "disabled", "e", "icon", "onClick", "round", "size", "tooltip", "label", "EditButton", "_jsx", "Button", "el", "InlineBlockContainer", "e_0", "onKeyDown", "role", "tabIndex", "children", "ref", "inlineBlockElemElemRef", "formState_0", "beforeSubmit", "onChange", "disableValidationOnSubmit", "onSubmit", "EditDepthProvider", "Drawer", "slug", "title", "_jsxs", "RenderFields", "forceRender", "parentIndexPath", "parentPath", "parentSchemaPath", "RegisterFormSubmit", "value", "Label", "height", "width"]
|
|
7
|
-
}
|
/package/dist/exports/client/{componentInline-R3EPNYWF.js.map → componentInline-H24N7GUG.js.map}
RENAMED
|
File without changes
|