@payloadcms/richtext-lexical 3.17.1 → 3.18.0-canary.030d28e

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.
Files changed (116) hide show
  1. package/dist/dependencyChecker.spec.js +17 -0
  2. package/dist/dependencyChecker.spec.js.map +1 -0
  3. package/dist/exports/client/{RelationshipComponent-AAFBGDZ5.js → RelationshipComponent-SOY5AKWW.js} +2 -2
  4. package/dist/exports/client/chunk-DIR6RNSY.js +2 -0
  5. package/dist/exports/client/chunk-DIR6RNSY.js.map +7 -0
  6. package/dist/exports/client/{chunk-CGFQWJ56.js → chunk-JNGXYK2K.js} +2 -2
  7. package/dist/exports/client/chunk-JNGXYK2K.js.map +7 -0
  8. package/dist/exports/client/{chunk-XXNV22UZ.js → chunk-RIV4NGKY.js} +2 -2
  9. package/dist/exports/client/{chunk-XXNV22UZ.js.map → chunk-RIV4NGKY.js.map} +2 -2
  10. package/dist/exports/client/{chunk-AXXPUMFU.js → chunk-RJTGMBHA.js} +2 -2
  11. package/dist/exports/client/chunk-RJTGMBHA.js.map +7 -0
  12. package/dist/exports/client/{component-SX36AJXS.js → component-FU65NQBY.js} +2 -2
  13. package/dist/exports/client/{component-NUQPQ2MC.js → component-VZEKUT7Y.js} +2 -2
  14. package/dist/exports/client/componentInline-MX6DTKSG.js +2 -0
  15. package/dist/exports/client/index.js +8 -8
  16. package/dist/exports/client/index.js.map +3 -3
  17. package/dist/exports/react/components/RichText/converter/converters/link.js +1 -1
  18. package/dist/exports/react/components/RichText/converter/converters/link.js.map +1 -1
  19. package/dist/exports/react/components/RichText/converter/converters/tab.d.ts +4 -0
  20. package/dist/exports/react/components/RichText/converter/converters/tab.d.ts.map +1 -0
  21. package/dist/exports/react/components/RichText/converter/converters/tab.js +9 -0
  22. package/dist/exports/react/components/RichText/converter/converters/tab.js.map +1 -0
  23. package/dist/exports/react/components/RichText/converter/defaultConverters.d.ts.map +1 -1
  24. package/dist/exports/react/components/RichText/converter/defaultConverters.js +3 -1
  25. package/dist/exports/react/components/RichText/converter/defaultConverters.js.map +1 -1
  26. package/dist/exports/react/components/RichText/converter/index.d.ts.map +1 -1
  27. package/dist/exports/react/components/RichText/converter/index.js +2 -1
  28. package/dist/exports/react/components/RichText/converter/index.js.map +1 -1
  29. package/dist/exports/react/index.d.ts +1 -0
  30. package/dist/exports/react/index.d.ts.map +1 -1
  31. package/dist/exports/react/index.js +1 -0
  32. package/dist/exports/react/index.js.map +1 -1
  33. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  34. package/dist/features/blocks/client/component/index.js +1 -2
  35. package/dist/features/blocks/client/component/index.js.map +1 -1
  36. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  37. package/dist/features/blocks/client/componentInline/index.js +3 -5
  38. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  39. package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
  40. package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
  41. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts.map +1 -1
  42. package/dist/features/blocks/client/nodes/InlineBlocksNode.js.map +1 -1
  43. package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
  44. package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
  45. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts.map +1 -1
  46. package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
  47. package/dist/features/converters/html/converter/converters/linebreak.d.ts +2 -2
  48. package/dist/features/converters/html/converter/converters/linebreak.d.ts.map +1 -1
  49. package/dist/features/converters/html/converter/converters/linebreak.js.map +1 -1
  50. package/dist/features/converters/html/converter/converters/paragraph.d.ts +1 -1
  51. package/dist/features/converters/html/converter/converters/paragraph.d.ts.map +1 -1
  52. package/dist/features/converters/html/converter/converters/paragraph.js.map +1 -1
  53. package/dist/features/converters/html/converter/converters/tab.d.ts +4 -0
  54. package/dist/features/converters/html/converter/converters/tab.d.ts.map +1 -0
  55. package/dist/features/converters/html/converter/converters/tab.js +9 -0
  56. package/dist/features/converters/html/converter/converters/tab.js.map +1 -0
  57. package/dist/features/converters/html/converter/converters/text.d.ts +1 -1
  58. package/dist/features/converters/html/converter/converters/text.d.ts.map +1 -1
  59. package/dist/features/converters/html/converter/converters/text.js.map +1 -1
  60. package/dist/features/converters/html/converter/defaultConverters.d.ts.map +1 -1
  61. package/dist/features/converters/html/converter/defaultConverters.js +2 -1
  62. package/dist/features/converters/html/converter/defaultConverters.js.map +1 -1
  63. package/dist/features/converters/html/converter/index.d.ts.map +1 -1
  64. package/dist/features/converters/html/converter/index.js +2 -1
  65. package/dist/features/converters/html/converter/index.js.map +1 -1
  66. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts.map +1 -1
  67. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js.map +1 -1
  68. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts.map +1 -1
  69. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js.map +1 -1
  70. package/dist/features/link/client/plugins/autoLink/index.js +1 -1
  71. package/dist/features/link/client/plugins/autoLink/index.js.map +1 -1
  72. package/dist/features/link/nodes/AutoLinkNode.d.ts.map +1 -1
  73. package/dist/features/link/nodes/AutoLinkNode.js.map +1 -1
  74. package/dist/features/link/nodes/LinkNode.d.ts.map +1 -1
  75. package/dist/features/link/nodes/LinkNode.js +8 -4
  76. package/dist/features/link/nodes/LinkNode.js.map +1 -1
  77. package/dist/features/link/nodes/types.d.ts +2 -2
  78. package/dist/features/link/nodes/types.d.ts.map +1 -1
  79. package/dist/features/link/nodes/types.js.map +1 -1
  80. package/dist/features/link/server/baseFields.d.ts.map +1 -1
  81. package/dist/features/link/server/baseFields.js +7 -1
  82. package/dist/features/link/server/baseFields.js.map +1 -1
  83. package/dist/features/link/server/index.js +1 -1
  84. package/dist/features/link/server/index.js.map +1 -1
  85. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts.map +1 -1
  86. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  87. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.d.ts.map +1 -1
  88. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  89. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts.map +1 -1
  90. package/dist/features/relationship/client/nodes/RelationshipNode.js.map +1 -1
  91. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
  92. package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
  93. package/dist/features/upload/client/nodes/UploadNode.d.ts.map +1 -1
  94. package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
  95. package/dist/features/upload/server/nodes/UploadNode.d.ts.map +1 -1
  96. package/dist/features/upload/server/nodes/UploadNode.js.map +1 -1
  97. package/dist/field/rscEntry.d.ts.map +1 -1
  98. package/dist/field/rscEntry.js +3 -0
  99. package/dist/field/rscEntry.js.map +1 -1
  100. package/dist/index.d.ts +2 -0
  101. package/dist/index.d.ts.map +1 -1
  102. package/dist/index.js +3 -1
  103. package/dist/index.js.map +1 -1
  104. package/dist/nodeTypes.d.ts +5 -1
  105. package/dist/nodeTypes.d.ts.map +1 -1
  106. package/dist/nodeTypes.js.map +1 -1
  107. package/package.json +6 -6
  108. package/dist/exports/client/chunk-AXXPUMFU.js.map +0 -7
  109. package/dist/exports/client/chunk-CGFQWJ56.js.map +0 -7
  110. package/dist/exports/client/chunk-XI5JV5QT.js +0 -2
  111. package/dist/exports/client/chunk-XI5JV5QT.js.map +0 -7
  112. package/dist/exports/client/componentInline-KDFOWBR5.js +0 -2
  113. /package/dist/exports/client/{RelationshipComponent-AAFBGDZ5.js.map → RelationshipComponent-SOY5AKWW.js.map} +0 -0
  114. /package/dist/exports/client/{component-SX36AJXS.js.map → component-FU65NQBY.js.map} +0 -0
  115. /package/dist/exports/client/{component-NUQPQ2MC.js.map → component-VZEKUT7Y.js.map} +0 -0
  116. /package/dist/exports/client/{componentInline-KDFOWBR5.js.map → componentInline-MX6DTKSG.js.map} +0 -0
@@ -0,0 +1,17 @@
1
+ import { lexicalTargetVersion } from './index';
2
+ import { fileURLToPath } from 'url';
3
+ import path from 'path';
4
+ import fs from 'fs/promises';
5
+ const filename = fileURLToPath(import.meta.url);
6
+ const dirname = path.dirname(filename);
7
+ describe('Lexical dependency checker', () => {
8
+ it('ensure lexical version installed in package.json matches dependency checker version', async () => {
9
+ const packageJsonString = await fs.readFile(path.resolve(dirname, '../package.json'), 'utf-8');
10
+ const packageJson = JSON.parse(packageJsonString);
11
+ const packageJsonLexicalVersion = packageJson.dependencies['lexical'];
12
+ expect(packageJsonLexicalVersion).toBe(lexicalTargetVersion);
13
+ const packageJsonLexicalPeerDepVersion = packageJson.peerDependencies['lexical'];
14
+ expect(packageJsonLexicalPeerDepVersion).toBe(lexicalTargetVersion);
15
+ });
16
+ });
17
+ //# sourceMappingURL=dependencyChecker.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dependencyChecker.spec.js","names":["lexicalTargetVersion","fileURLToPath","path","fs","filename","import","meta","url","dirname","describe","it","packageJsonString","readFile","resolve","packageJson","JSON","parse","packageJsonLexicalVersion","dependencies","expect","toBe","packageJsonLexicalPeerDepVersion","peerDependencies"],"sources":["../src/dependencyChecker.spec.ts"],"sourcesContent":["import { jest } from '@jest/globals'\nimport { lexicalTargetVersion } from './index'\nimport { fileURLToPath } from 'url'\nimport path from 'path'\nimport fs from 'fs/promises'\n\nconst filename = fileURLToPath(import.meta.url)\nconst dirname = path.dirname(filename)\n\ndescribe('Lexical dependency checker', () => {\n it('ensure lexical version installed in package.json matches dependency checker version', async () => {\n const packageJsonString = await fs.readFile(path.resolve(dirname, '../package.json'), 'utf-8')\n const packageJson = JSON.parse(packageJsonString)\n const packageJsonLexicalVersion = packageJson.dependencies['lexical']\n\n expect(packageJsonLexicalVersion).toBe(lexicalTargetVersion)\n\n const packageJsonLexicalPeerDepVersion = packageJson.peerDependencies['lexical']\n expect(packageJsonLexicalPeerDepVersion).toBe(lexicalTargetVersion)\n })\n})\n"],"mappings":"AACA,SAASA,oBAAoB,QAAQ;AACrC,SAASC,aAAa,QAAQ;AAC9B,OAAOC,IAAA,MAAU;AACjB,OAAOC,EAAA,MAAQ;AAEf,MAAMC,QAAA,GAAWH,aAAA,CAAcI,MAAA,CAAAC,IAAA,CAAYC,GAAG;AAC9C,MAAMC,OAAA,GAAUN,IAAA,CAAKM,OAAO,CAACJ,QAAA;AAE7BK,QAAA,CAAS,8BAA8B;EACrCC,EAAA,CAAG,uFAAuF;IACxF,MAAMC,iBAAA,GAAoB,MAAMR,EAAA,CAAGS,QAAQ,CAACV,IAAA,CAAKW,OAAO,CAACL,OAAA,EAAS,oBAAoB;IACtF,MAAMM,WAAA,GAAcC,IAAA,CAAKC,KAAK,CAACL,iBAAA;IAC/B,MAAMM,yBAAA,GAA4BH,WAAA,CAAYI,YAAY,CAAC,UAAU;IAErEC,MAAA,CAAOF,yBAAA,EAA2BG,IAAI,CAACpB,oBAAA;IAEvC,MAAMqB,gCAAA,GAAmCP,WAAA,CAAYQ,gBAAgB,CAAC,UAAU;IAChFH,MAAA,CAAOE,gCAAA,EAAkCD,IAAI,CAACpB,oBAAA;EAChD;AACF","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- "use client";import{a as S,d as w}from"./chunk-CGFQWJ56.js";import{a as x}from"./chunk-F26IQ5RE.js";import{b as E}from"./chunk-3LGFOM34.js";import{jsx as l,jsxs as h}from"react/jsx-runtime";import{useLexicalComposerContext as W}from"@lexical/react/LexicalComposerContext.js";import{useLexicalNodeSelection as Y}from"@lexical/react/useLexicalNodeSelection.js";import{mergeRegister as H}from"@lexical/utils";import{getTranslation as U}from"@payloadcms/translations";import{Button as A,useConfig as q,usePayloadAPI as z,useTranslation as F}from"@payloadcms/ui";import{$getNodeByKey as G,$getSelection as J,$isNodeSelection as Q,CLICK_COMMAND as V,COMMAND_PRIORITY_LOW as C,KEY_BACKSPACE_COMMAND as X,KEY_DELETE_COMMAND as Z}from"lexical";import ee,{useCallback as _,useEffect as te,useReducer as oe,useRef as se,useState as le}from"react";var o="lexical-relationship",T={depth:0},ne=u=>{let{data:{relationTo:M,value:r},nodeKey:n}=u;if(typeof r=="object")throw new Error("Relationship value should be a string or number. The Lexical Relationship component should not receive the populated value object.");let m=se(null),[e]=W(),[s,c,d]=Y(n),{fieldProps:{readOnly:g}}=E(),{config:{collections:y,routes:{api:L},serverURL:O}}=q(),[i,ie]=le(()=>y.find(t=>t.slug===M)),{i18n:B,t:p}=F(),[R,I]=oe(t=>t+1,0),[{data:b},{setParams:N}]=z(`${O}${L}/${i.slug}/${r}`,{initialParams:T}),{closeDocumentDrawer:v,DocumentDrawer:P,DocumentDrawerToggler:j}=x({id:r,collectionSlug:i.slug}),K=_(()=>{e.update(()=>{G(n)?.remove()})},[e,n]),k=ee.useCallback(()=>{N({...T,cacheBust:R}),v(),I()},[R,N,v]),f=_(t=>{let a=J();return s&&Q(a)&&(t.preventDefault(),e.update(()=>{a.getNodes().forEach($=>{w($)&&$.remove()})})),!1},[e,s]),D=_(t=>{let a=t;return a.target===m.current||m.current?.contains(a.target)?(a.shiftKey?c(!s):s||(d(),c(!0)),!0):!1},[s,c,d]);return te(()=>H(e.registerCommand(V,D,C),e.registerCommand(Z,f,C),e.registerCommand(X,f,C)),[d,e,s,n,f,c,D]),h("div",{className:[o,s&&`${o}--selected`].filter(Boolean).join(" "),contentEditable:!1,ref:m,children:[h("div",{className:`${o}__wrap`,children:[l("p",{className:`${o}__label`,children:p("fields:labelRelationship",{label:i.labels?.singular?U(i.labels?.singular,B):i.slug})}),l(j,{className:`${o}__doc-drawer-toggler`,children:l("p",{className:`${o}__title`,children:b?b[i?.admin?.useAsTitle||"id"]:r})})]}),e.isEditable()&&h("div",{className:`${o}__actions`,children:[l(A,{buttonStyle:"icon-label",className:`${o}__swapButton`,disabled:g,el:"button",icon:"swap",onClick:()=>{n&&e.dispatchCommand(S,{replace:{nodeKey:n}})},round:!0,tooltip:p("fields:swapRelationship")}),l(A,{buttonStyle:"icon-label",className:`${o}__removeButton`,disabled:g,icon:"x",onClick:t=>{t.preventDefault(),K()},round:!0,tooltip:p("fields:removeRelationship")})]}),!!r&&l(P,{onSave:k})]})},be=u=>l(ne,{...u});export{be as RelationshipComponent};
2
- //# sourceMappingURL=RelationshipComponent-AAFBGDZ5.js.map
1
+ "use client";import{a as S,d as w}from"./chunk-JNGXYK2K.js";import{a as x}from"./chunk-F26IQ5RE.js";import{b as E}from"./chunk-3LGFOM34.js";import{jsx as l,jsxs as h}from"react/jsx-runtime";import{useLexicalComposerContext as W}from"@lexical/react/LexicalComposerContext.js";import{useLexicalNodeSelection as Y}from"@lexical/react/useLexicalNodeSelection.js";import{mergeRegister as H}from"@lexical/utils";import{getTranslation as U}from"@payloadcms/translations";import{Button as A,useConfig as q,usePayloadAPI as z,useTranslation as F}from"@payloadcms/ui";import{$getNodeByKey as G,$getSelection as J,$isNodeSelection as Q,CLICK_COMMAND as V,COMMAND_PRIORITY_LOW as C,KEY_BACKSPACE_COMMAND as X,KEY_DELETE_COMMAND as Z}from"lexical";import ee,{useCallback as _,useEffect as te,useReducer as oe,useRef as se,useState as le}from"react";var o="lexical-relationship",T={depth:0},ne=u=>{let{data:{relationTo:M,value:r},nodeKey:n}=u;if(typeof r=="object")throw new Error("Relationship value should be a string or number. The Lexical Relationship component should not receive the populated value object.");let m=se(null),[e]=W(),[s,c,d]=Y(n),{fieldProps:{readOnly:g}}=E(),{config:{collections:y,routes:{api:L},serverURL:O}}=q(),[i,ie]=le(()=>y.find(t=>t.slug===M)),{i18n:B,t:p}=F(),[R,I]=oe(t=>t+1,0),[{data:b},{setParams:N}]=z(`${O}${L}/${i.slug}/${r}`,{initialParams:T}),{closeDocumentDrawer:v,DocumentDrawer:P,DocumentDrawerToggler:j}=x({id:r,collectionSlug:i.slug}),K=_(()=>{e.update(()=>{G(n)?.remove()})},[e,n]),k=ee.useCallback(()=>{N({...T,cacheBust:R}),v(),I()},[R,N,v]),f=_(t=>{let a=J();return s&&Q(a)&&(t.preventDefault(),e.update(()=>{a.getNodes().forEach($=>{w($)&&$.remove()})})),!1},[e,s]),D=_(t=>{let a=t;return a.target===m.current||m.current?.contains(a.target)?(a.shiftKey?c(!s):s||(d(),c(!0)),!0):!1},[s,c,d]);return te(()=>H(e.registerCommand(V,D,C),e.registerCommand(Z,f,C),e.registerCommand(X,f,C)),[d,e,s,n,f,c,D]),h("div",{className:[o,s&&`${o}--selected`].filter(Boolean).join(" "),contentEditable:!1,ref:m,children:[h("div",{className:`${o}__wrap`,children:[l("p",{className:`${o}__label`,children:p("fields:labelRelationship",{label:i.labels?.singular?U(i.labels?.singular,B):i.slug})}),l(j,{className:`${o}__doc-drawer-toggler`,children:l("p",{className:`${o}__title`,children:b?b[i?.admin?.useAsTitle||"id"]:r})})]}),e.isEditable()&&h("div",{className:`${o}__actions`,children:[l(A,{buttonStyle:"icon-label",className:`${o}__swapButton`,disabled:g,el:"button",icon:"swap",onClick:()=>{n&&e.dispatchCommand(S,{replace:{nodeKey:n}})},round:!0,tooltip:p("fields:swapRelationship")}),l(A,{buttonStyle:"icon-label",className:`${o}__removeButton`,disabled:g,icon:"x",onClick:t=>{t.preventDefault(),K()},round:!0,tooltip:p("fields:removeRelationship")})]}),!!r&&l(P,{onSave:k})]})},be=u=>l(ne,{...u});export{be as RelationshipComponent};
2
+ //# sourceMappingURL=RelationshipComponent-SOY5AKWW.js.map
@@ -0,0 +1,2 @@
1
+ import{a as le}from"./chunk-INBEEENE.js";import{b as re}from"./chunk-3LGFOM34.js";import{jsx as r,jsxs as p,Fragment as De}from"react/jsx-runtime";import E,{createContext as Ie,useCallback as _,useEffect as C,useMemo as $,useRef as j}from"react";import{useLexicalComposerContext as Ne}from"@lexical/react/LexicalComposerContext";import{useLexicalNodeSelection as ve}from"@lexical/react/useLexicalNodeSelection";import{mergeRegister as we}from"@lexical/utils";import{getTranslation as ie}from"@payloadcms/translations";import{Button as se,Drawer as $e,EditDepthProvider as Ee,Form as Fe,formatDrawerSlug as Oe,FormSubmit as Pe,RenderFields as Le,ShimmerEffect as Me,useDocumentInfo as Te,useEditDepth as Ae,useServerFunctions as Re,useTranslation as Ke}from"@payloadcms/ui";import{abortAndIgnore as J}from"@payloadcms/ui/shared";import{$getNodeByKey as ce,$getSelection as je,$isNodeSelection as Je,CLICK_COMMAND as ze,COMMAND_PRIORITY_LOW as z,KEY_BACKSPACE_COMMAND as Ye,KEY_DELETE_COMMAND as He}from"lexical";import{v4 as We}from"uuid";import{jsx as Ce}from"react/jsx-runtime";import Be from"bson-objectid";import Se from"react";import ge from"bson-objectid";import{DecoratorNode as ke}from"lexical";var k=class extends ke{__cacheBuster;__fields;constructor({cacheBuster:e,fields:t,key:l}){super(l),this.__fields=t,this.__cacheBuster=e||0}static clone(e){return new this({cacheBuster:e.__cacheBuster,fields:e.__fields,key:e.__key})}static getType(){return"inlineBlock"}static importDOM(){return{}}static importJSON(e){return _e(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,t){return null}exportDOM(){let e=document.createElement("span");e.classList.add("inline-block-container");let t=document.createTextNode(this.getTextContent());return e.append(t),{element:e}}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(e,t){let l=this.getWritable();l.__fields=e,t||l.__cacheBuster++}updateDOM(){return!1}};function _e(s){return new k({fields:{...s,id:s?.id||new ge.default().toHexString()}})}var xe=Se.lazy(()=>import("./componentInline-MX6DTKSG.js").then(s=>({default:s.InlineBlockComponent}))),w=class extends k{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return ye(e.fields)}decorate(e,t){return Ce(xe,{cacheBuster:this.getCacheBuster(),formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function ye(s){return new w({fields:{...s,id:s?.id||new Be.default().toHexString()}})}function K(s){return s instanceof w}var m="inline-block",ae=Ie({initialState:!1}),ht=()=>E.useContext(ae),gt=s=>{let{cacheBuster:e,formData:t,nodeKey:l}=s,[c]=Ne(),{i18n:F,t:f}=Ke(),{createdInlineBlock:Y,fieldProps:{featureClientSchemaMap:ue,initialLexicalFormState:de,permissions:me,readOnly:B,schemaPath:H},setCreatedInlineBlock:W,uuid:fe}=re(),{getFormState:S}=Re(),pe=Ae(),V=j(!1),[u,q]=E.useState(de?.[t.id]?.formState);C(()=>{q(!1)},[e]);let[O,G]=E.useState(u?._components?.customComponents?.BlockLabel),[Q,U]=E.useState(u?._components?.customComponents?.Block),X=Oe({slug:`lexical-inlineBlocks-create-${fe}-${t.id}`,depth:pe}),{toggleDrawer:b}=le(X,!0),P=j(null),[d,x,L]=ve(l),{id:y,collectionSlug:D,getDocPreferences:I,globalSlug:N}=Te(),be=`${H}.lexical_internal_feature.blocks.lexical_inline_blocks.${t.blockType}`,a=ue.blocks[be]?.[0]?.blocks?.[0];C(()=>{!V.current&&Y?.getKey()===l&&(a?.fields?.length>2&&b(),W?.(void 0),V.current=!0)},[a?.fields?.length,Y,l,W,b]);let Z=_(()=>{c.update(()=>{ce(l)?.remove()})},[c,l]),M=_(n=>{let o=je();return d&&Je(o)&&(n.preventDefault(),c.update(()=>{o.getNodes().forEach(i=>{K(i)&&i.remove()})})),!1},[c,d]),ee=_(n=>{let o=n;return o.target===P.current||P.current?.contains(o.target)?(o.shiftKey?x(!d):d||(L(),x(!0)),!0):!1},[d,x,L]);C(()=>we(c.registerCommand(ze,ee,z),c.registerCommand(He,M,z),c.registerCommand(Ye,M,z)),[L,c,d,l,M,x,ee]);let h=a?.labels?.singular?ie(a?.labels.singular,F):a?.slug,T=j(new AbortController),g=`${H}.lexical_internal_feature.blocks.lexical_inline_blocks.${a?.slug}.fields`;C(()=>{let n=new AbortController;return t&&!u&&(async()=>{let{state:i}=await S({id:y,collectionSlug:D,data:t,docPermissions:{fields:!0},docPreferences:await I(),globalSlug:N,operation:"update",renderAllFields:!0,schemaPath:g,signal:n.signal});i&&(q(i),G(i._components?.customComponents?.BlockLabel),U(i._components?.customComponents?.Block))})(),()=>{J(n)}},[S,g,y,t,u,D,N,I]);let te=_(async({formState:n,submit:o})=>{J(T.current);let i=new AbortController;T.current=i;let{state:v}=await S({id:y,collectionSlug:D,docPermissions:{fields:!0},docPreferences:await I(),formState:n,globalSlug:N,operation:"update",renderAllFields:!!o,schemaPath:g,signal:i.signal});return v?(o&&(G(v._components?.customComponents?.BlockLabel),U(v._components?.customComponents?.Block)),v):n},[S,y,D,I,N,g]);C(()=>()=>{J(T.current)},[]);let he=_((n,o)=>{o.blockType=t.blockType,c.update(()=>{let i=ce(l);i&&K(i)&&i.setFields(o,!0)})},[c,l,t]),A=$(()=>()=>r(se,{buttonStyle:"icon-label",className:`${m}__removeButton`,disabled:B,icon:"x",onClick:n=>{n.preventDefault(),Z()},round:!0,size:"small",tooltip:f("lexical:blocks:inlineBlocks:remove",{label:h})}),[h,B,Z,f]),ne=$(()=>()=>r(se,{buttonStyle:"icon-label",className:`${m}__editButton`,disabled:B,el:"button",icon:"edit",onClick:()=>{b()},round:!0,size:"small",tooltip:f("lexical:blocks:inlineBlocks:edit",{label:h})}),[h,B,f,b]),R=$(()=>({children:n,className:o})=>r("div",{className:[m,m+"-"+t.blockType,d&&`${m}--selected`,o].filter(Boolean).join(" "),ref:P,children:n}),[t.blockType,d]),oe=$(()=>O?()=>O:()=>r("div",{children:a?.labels?ie(a?.labels.singular,F):""}),[O,a?.labels,F]);return a?p(Fe,{beforeSubmit:[async({formState:n})=>await te({formState:n,submit:!0})],disableValidationOnSubmit:!0,fields:a?.fields,initialState:u||{},onChange:[te],onSubmit:(n,o)=>{he(n,o),b()},uuid:We(),children:[r(Ee,{children:r($e,{className:"",slug:X,title:f(`lexical:blocks:inlineBlocks:${t?.id?"edit":"create"}`,{label:h??f("lexical:blocks:inlineBlocks:label")}),children:u?p(De,{children:[r(Le,{fields:a?.fields,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:g,permissions:me,readOnly:!1}),r(Pe,{programmaticSubmit:!0,children:f("fields:saveChanges")})]}):null})}),Q?r(ae.Provider,{value:{EditButton:ne,initialState:u,InlineBlockContainer:R,Label:oe,nodeKey:l,RemoveButton:A},children:Q}):p(R,{children:[u?r(oe,{}):r(Me,{height:"15px",width:"40px"}),c.isEditable()?p("div",{className:`${m}__actions`,children:[r(ne,{}),r(A,{})]}):null]})]}):p(R,{className:`${m}-not-found`,children:[p("span",{children:["Error: Block '",t.blockType,"' not found"]}),c.isEditable()?r("div",{className:`${m}__actions`,children:r(A,{})}):null]})};export{ht as a,gt as b,w as c,ye as d,K as e};
2
+ //# sourceMappingURL=chunk-DIR6RNSY.js.map
@@ -0,0 +1,7 @@
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 React, { createContext, useCallback, useEffect, useMemo, useRef } from 'react'\nconst baseClass = 'inline-block'\n\nimport type { BlocksFieldClient, Data, FormState } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useLexicalNodeSelection } from '@lexical/react/useLexicalNodeSelection'\nimport { mergeRegister } from '@lexical/utils'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n Drawer,\n EditDepthProvider,\n Form,\n formatDrawerSlug,\n FormSubmit,\n RenderFields,\n ShimmerEffect,\n useDocumentInfo,\n useEditDepth,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport {\n $getNodeByKey,\n $getSelection,\n $isNodeSelection,\n CLICK_COMMAND,\n COMMAND_PRIORITY_LOW,\n KEY_BACKSPACE_COMMAND,\n KEY_DELETE_COMMAND,\n} from 'lexical'\n\nimport './index.scss'\n\nimport { v4 as uuid } from 'uuid'\n\nimport type { InlineBlockFields } from '../../server/nodes/InlineBlocksNode.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport { useLexicalDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport { $isInlineBlockNode } from '../nodes/InlineBlocksNode.js'\n\ntype Props = {\n /**\n * Can be modified by the node in order to trigger the re-fetch of the initial state based on the\n * formData. This is useful when node.setFields() is explicitly called from outside of the form - in\n * this case, the new field state is likely not reflected in the form state, so we need to re-fetch\n */\n readonly cacheBuster: number\n readonly formData: InlineBlockFields\n readonly nodeKey: string\n}\n\ntype 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.useContext(InlineBlockComponentContext)\n\nexport const InlineBlockComponent: React.FC<Props> = (props) => {\n const { cacheBuster, formData, nodeKey } = props\n\n const [editor] = useLexicalComposerContext()\n const { i18n, t } = useTranslation<object, string>()\n const {\n createdInlineBlock,\n fieldProps: {\n featureClientSchemaMap,\n initialLexicalFormState,\n permissions,\n readOnly,\n schemaPath,\n },\n setCreatedInlineBlock,\n uuid: uuidFromContext,\n } = useEditorConfigContext()\n const { getFormState } = useServerFunctions()\n const editDepth = useEditDepth()\n const firstTimeDrawer = useRef(false)\n\n const [initialState, setInitialState] = React.useState<false | FormState | undefined>(\n initialLexicalFormState?.[formData.id]?.formState,\n )\n\n useEffect(() => {\n setInitialState(false)\n }, [cacheBuster])\n\n const [CustomLabel, setCustomLabel] = React.useState<React.ReactNode | undefined>(\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n initialState?.['_components']?.customComponents?.BlockLabel,\n )\n\n const [CustomBlock, setCustomBlock] = React.useState<React.ReactNode | undefined>(\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n initialState?.['_components']?.customComponents?.Block,\n )\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 [isSelected, setSelected, clearSelection] = useLexicalNodeSelection(nodeKey)\n const { id, collectionSlug, getDocPreferences, globalSlug } = useDocumentInfo()\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 = clientSchemaMap[\n componentMapRenderedBlockPath\n ]?.[0] as BlocksFieldClient\n\n const clientBlock = blocksField?.blocks?.[0]\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 (clientBlock?.fields?.length > 2) {\n toggleDrawer()\n }\n setCreatedInlineBlock?.(undefined)\n firstTimeDrawer.current = true\n }\n }, [\n clientBlock?.fields?.length,\n createdInlineBlock,\n nodeKey,\n setCreatedInlineBlock,\n toggleDrawer,\n ])\n\n const removeInlineBlock = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey)?.remove()\n })\n }, [editor, nodeKey])\n\n const $onDelete = useCallback(\n (event: KeyboardEvent) => {\n const deleteSelection = $getSelection()\n if (isSelected && $isNodeSelection(deleteSelection)) {\n event.preventDefault()\n editor.update(() => {\n deleteSelection.getNodes().forEach((node) => {\n if ($isInlineBlockNode(node)) {\n node.remove()\n }\n })\n })\n }\n return false\n },\n [editor, isSelected],\n )\n const onClick = useCallback(\n (payload: MouseEvent) => {\n const event = payload\n // Check if inlineBlockElemElemRef.target or anything WITHIN inlineBlockElemElemRef.target was clicked\n if (\n event.target === inlineBlockElemElemRef.current ||\n inlineBlockElemElemRef.current?.contains(event.target as Node)\n ) {\n if (event.shiftKey) {\n setSelected(!isSelected)\n } else {\n if (!isSelected) {\n clearSelection()\n setSelected(true)\n }\n }\n return true\n }\n\n return false\n },\n [isSelected, setSelected, clearSelection],\n )\n\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand<MouseEvent>(CLICK_COMMAND, onClick, COMMAND_PRIORITY_LOW),\n\n editor.registerCommand(KEY_DELETE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW),\n editor.registerCommand(KEY_BACKSPACE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW),\n )\n }, [clearSelection, editor, isSelected, nodeKey, $onDelete, setSelected, onClick])\n\n const blockDisplayName = clientBlock?.labels?.singular\n ? getTranslation(clientBlock?.labels.singular, i18n)\n : clientBlock?.slug\n\n 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 globalSlug,\n operation: 'update',\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: abortController.signal,\n })\n\n if (state) {\n setInitialState(state)\n setCustomLabel(state['_components']?.customComponents?.BlockLabel)\n setCustomBlock(state['_components']?.customComponents?.Block)\n }\n }\n\n if (formData && !initialState) {\n void awaitInitialState()\n }\n\n return () => {\n abortAndIgnore(abortController)\n }\n }, [\n getFormState,\n schemaFieldsPath,\n id,\n formData,\n initialState,\n collectionSlug,\n globalSlug,\n getDocPreferences,\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 formState: prevFormState,\n globalSlug,\n operation: 'update',\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 setCustomLabel(state['_components']?.customComponents?.BlockLabel)\n setCustomBlock(state['_components']?.customComponents?.Block)\n }\n\n return state\n },\n [getFormState, id, collectionSlug, getDocPreferences, globalSlug, schemaFieldsPath],\n )\n // cleanup effect\n useEffect(() => {\n return () => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [])\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 const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n node.setFields(newData as InlineBlockFields, true)\n }\n })\n },\n [editor, nodeKey, formData],\n )\n\n const RemoveButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__removeButton`}\n disabled={readOnly}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeInlineBlock()\n }}\n round\n size=\"small\"\n tooltip={t('lexical:blocks:inlineBlocks:remove', { label: blockDisplayName })}\n />\n ),\n [blockDisplayName, readOnly, removeInlineBlock, t],\n )\n\n const EditButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__editButton`}\n disabled={readOnly}\n el=\"button\"\n icon=\"edit\"\n onClick={() => {\n toggleDrawer()\n }}\n round\n size=\"small\"\n tooltip={t('lexical:blocks:inlineBlocks:edit', { label: blockDisplayName })}\n />\n ),\n [blockDisplayName, readOnly, t, toggleDrawer],\n )\n\n const InlineBlockContainer = useMemo(\n () =>\n ({ children, className }: { children: React.ReactNode; className?: string }) => (\n <div\n className={[\n baseClass,\n baseClass + '-' + formData.blockType,\n isSelected && `${baseClass}--selected`,\n className,\n ]\n .filter(Boolean)\n .join(' ')}\n ref={inlineBlockElemElemRef}\n >\n {children}\n </div>\n ),\n [formData.blockType, isSelected],\n )\n\n const Label = useMemo(() => {\n if (CustomLabel) {\n return () => CustomLabel\n } else {\n return () => (\n <div>{clientBlock?.labels ? getTranslation(clientBlock?.labels.singular, i18n) : ''}</div>\n )\n }\n }, [CustomLabel, 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 {editor.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 fields={clientBlock?.fields}\n initialState={initialState || {}}\n onChange={[onChange]}\n onSubmit={(formState, data) => {\n onFormSubmit(formState, data)\n toggleDrawer()\n }}\n uuid={uuid()}\n >\n <EditDepthProvider>\n <Drawer\n className={''}\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 <>\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={permissions}\n readOnly={false}\n />\n <FormSubmit programmaticSubmit={true}>{t('fields:saveChanges')}</FormSubmit>\n </>\n ) : null}\n </Drawer>\n </EditDepthProvider>\n {CustomBlock ? (\n <InlineBlockComponentContext.Provider\n value={{\n EditButton,\n initialState,\n InlineBlockContainer,\n Label,\n nodeKey,\n RemoveButton,\n }}\n >\n {CustomBlock}\n </InlineBlockComponentContext.Provider>\n ) : (\n <InlineBlockContainer>\n {initialState ? <Label /> : <ShimmerEffect height=\"15px\" width=\"40px\" />}\n {editor.isEditable() ? (\n <div className={`${baseClass}__actions`}>\n <EditButton />\n <RemoveButton />\n </div>\n ) : null}\n </InlineBlockContainer>\n )}\n </Form>\n )\n}\n", "'use client'\nimport type { EditorConfig, LexicalEditor, LexicalNode } from 'lexical'\n\nimport ObjectID from 'bson-objectid'\nimport React, { type JSX } from 'react'\n\nimport type {\n InlineBlockFields,\n SerializedInlineBlockNode,\n} from '../../server/nodes/InlineBlocksNode.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 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(editor: LexicalEditor, config: EditorConfig): JSX.Element {\n return (\n <InlineBlockComponent\n cacheBuster={this.getCacheBuster()}\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 new InlineBlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\n },\n })\n}\n\nexport function $isInlineBlockNode(\n node: InlineBlockNode | LexicalNode | null | undefined,\n): node is InlineBlockNode {\n return node instanceof InlineBlockNode\n}\n", "import type {\n DOMConversionMap,\n DOMExportOutput,\n EditorConfig,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n SerializedLexicalNode,\n Spread,\n} from 'lexical'\nimport type { JsonObject } from 'payload'\nimport type React from 'react'\nimport type { JSX } from 'react'\n\nimport ObjectID from 'bson-objectid'\nimport { DecoratorNode } from 'lexical'\n\nexport type InlineBlockFields<TInlineBlockFields extends JsonObject = JsonObject> = {\n blockType: string\n id: string\n} & TInlineBlockFields\n\nexport type SerializedInlineBlockNode<TBlockFields extends JsonObject = JsonObject> = Spread<\n {\n children?: never // required so that our typed editor state doesn't automatically add children\n fields: InlineBlockFields<TBlockFields>\n type: 'inlineBlock'\n },\n SerializedLexicalNode\n>\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 override createDOM() {\n const element = document.createElement('span')\n element.classList.add('inline-block-container')\n\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 new ServerInlineBlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\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": "mJAEA,OAAOA,GAASC,iBAAAA,GAAeC,eAAAA,EAAaC,aAAAA,EAAWC,WAAAA,EAASC,UAAAA,MAAc,QAK9E,OAASC,6BAAAA,OAAiC,wCAC1C,OAASC,2BAAAA,OAA+B,yCACxC,OAASC,iBAAAA,OAAqB,iBAC9B,OAASC,kBAAAA,OAAsB,2BAC/B,OACEC,UAAAA,GACAC,UAAAA,GACAC,qBAAAA,GACAC,QAAAA,GACAC,oBAAAA,GACAC,cAAAA,GACAC,gBAAAA,GACAC,iBAAAA,GACAC,mBAAAA,GACAC,gBAAAA,GACAC,sBAAAA,GACAC,kBAAAA,OACK,iBACP,OAASC,kBAAAA,MAAsB,wBAC/B,OACEC,iBAAAA,GACAC,iBAAAA,GACAC,oBAAAA,GACAC,iBA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I,aAAAA,EACAmI,qBAAAA,EACAM,MAAAA,GACAjI,QAAAA,EACA4G,aAAAA,CACF,WAEC5E,IAGHkG,EAACP,EAAA,WACEnI,EAAesH,EAACmB,GAAA,CAAA,CAAA,EAAWnB,EAACsC,GAAA,CAAcC,OAAO,OAAOC,MAAM,SAC9DrJ,EAAOsJ,WAAU,EAChBrB,EAAC,MAAA,CAAIjB,UAAW,GAAG5H,CAAA,sBACjByH,EAACW,GAAA,CAAA,CAAA,EACDX,EAACF,EAAA,CAAA,CAAA,CAAA,IAED,IAAA,OA1ERsB,EAACP,EAAA,CAAqBV,UAAW,GAAG5H,CAAA,uBAClC6I,EAAC,OAAA,WAAK,iBAAenI,EAASoD,UAAU,aAAA,IACvClD,EAAOsJ,WAAU,EAChBzC,EAAC,MAAA,CAAIG,UAAW,GAAG5H,CAAA,qBACjByH,EAACF,EAAA,CAAA,CAAA,IAED,IAAA,GAyEZ",
6
+ "names": ["React", "createContext", "useCallback", "useEffect", "useMemo", "useRef", "useLexicalComposerContext", "useLexicalNodeSelection", "mergeRegister", "getTranslation", "Button", "Drawer", "EditDepthProvider", "Form", "formatDrawerSlug", "FormSubmit", "RenderFields", "ShimmerEffect", "useDocumentInfo", "useEditDepth", "useServerFunctions", "useTranslation", "abortAndIgnore", "$getNodeByKey", "$getSelection", "$isNodeSelection", "CLICK_COMMAND", "COMMAND_PRIORITY_LOW", "KEY_BACKSPACE_COMMAND", "KEY_DELETE_COMMAND", "v4", "uuid", "ObjectID", "React", "ObjectID", "DecoratorNode", "ServerInlineBlockNode", "__cacheBuster", "__fields", "constructor", "cacheBuster", "fields", "key", "clone", "node", "__key", "getType", "importDOM", "importJSON", "serializedNode", "$createServerInlineBlockNode", "isInline", "canIndent", "createDOM", "element", "document", "createElement", "classList", "add", "decorate", "editor", "config", "exportDOM", "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", "_jsx", "cacheBuster", "getCacheBuster", "formData", "getFields", "nodeKey", "getKey", "exportJSON", "id", "ObjectID", "toHexString", "$isInlineBlockNode", "baseClass", "InlineBlockComponentContext", "createContext", "initialState", "useInlineBlockComponentContext", "React", "useContext", "InlineBlockComponent", "props", "cacheBuster", "formData", "nodeKey", "editor", "useLexicalComposerContext", "i18n", "t", "useTranslation", "createdInlineBlock", "fieldProps", "featureClientSchemaMap", "initialLexicalFormState", "permissions", "readOnly", "schemaPath", "setCreatedInlineBlock", "uuid", "uuidFromContext", "useEditorConfigContext", "getFormState", "useServerFunctions", "editDepth", "useEditDepth", "firstTimeDrawer", "useRef", "setInitialState", "useState", "id", "formState", "useEffect", "CustomLabel", "setCustomLabel", "customComponents", "BlockLabel", "CustomBlock", "setCustomBlock", "Block", "drawerSlug", "formatDrawerSlug", "slug", "depth", "toggleDrawer", "useLexicalDrawer", "inlineBlockElemElemRef", "isSelected", "setSelected", "clearSelection", "useLexicalNodeSelection", "collectionSlug", "getDocPreferences", "globalSlug", "useDocumentInfo", "componentMapRenderedBlockPath", "blockType", "clientBlock", "blocks", "current", "getKey", "fields", "length", "undefined", "removeInlineBlock", "useCallback", "update", "$getNodeByKey", "remove", "$onDelete", "event", "deleteSelection", "$getSelection", "$isNodeSelection", "preventDefault", "getNodes", "forEach", "node", "$isInlineBlockNode", "onClick", "payload", "target", "contains", "shiftKey", "mergeRegister", "registerCommand", "CLICK_COMMAND", "COMMAND_PRIORITY_LOW", "KEY_DELETE_COMMAND", "KEY_BACKSPACE_COMMAND", "blockDisplayName", "labels", "singular", "getTranslation", "onChangeAbortControllerRef", "AbortController", "schemaFieldsPath", "abortController", "state", "data", "docPermissions", "docPreferences", "operation", "renderAllFields", "signal", "abortAndIgnore", "onChange", "prevFormState", "submit", "controller", "onFormSubmit", "newData", "setFields", "RemoveButton", "useMemo", "_jsx", "Button", "buttonStyle", "className", "disabled", "icon", "e", "round", "size", "tooltip", "label", "EditButton", "el", "InlineBlockContainer", "children", "filter", "Boolean", "join", "ref", "Label", "_jsxs", "Form", "beforeSubmit", "disableValidationOnSubmit", "onSubmit", "EditDepthProvider", "Drawer", "title", "_Fragment", "RenderFields", "forceRender", "parentIndexPath", "parentPath", "parentSchemaPath", "FormSubmit", "programmaticSubmit", "Provider", "value", "ShimmerEffect", "height", "width", "isEditable"]
7
+ }
@@ -1,2 +1,2 @@
1
- import{createCommand as u}from"lexical";var x=u("INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND");import{jsx as _}from"react/jsx-runtime";import*as l from"react";import{DecoratorBlockNode as c}from"@lexical/react/LexicalDecoratorBlockNode.js";function p(a){let t=a.getAttribute("data-lexical-relationship-id"),e=a.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:r}){super(e,r),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},r=o(e);return r.setFormat(t.format),r}static isInline(){return!1}decorate(t,e){return null}exportDOM(){let t=document.createElement("div");t.setAttribute("data-lexical-relationship-id",String(typeof this.__data?.value=="object"?this.__data?.value?.id: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 ${typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value}`}setData(t){let e=this.getWritable();e.__data=t}};function o(a){return new n({data:a})}var h=l.lazy(()=>import("./RelationshipComponent-AAFBGDZ5.js").then(a=>({default:a.RelationshipComponent})));function d(a){let t=a.getAttribute("data-lexical-relationship-id"),e=a.getAttribute("data-lexical-relationship-relationTo");return t!=null&&e!=null?{node: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:d,priority:2}}}static importJSON(t){t.version===1&&t?.value?.id&&(t.value=t.value.id);let e={relationTo:t.relationTo,value:t.value},r=s(e);return r.setFormat(t.format),r}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(a){return new i({data:a})}function R(a){return a instanceof i}export{x as a,i as b,s as c,R as d};
2
- //# sourceMappingURL=chunk-CGFQWJ56.js.map
1
+ import{createCommand as u}from"lexical";var x=u("INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND");import{jsx as _}from"react/jsx-runtime";import*as l from"react";import{DecoratorBlockNode as c}from"@lexical/react/LexicalDecoratorBlockNode.js";function p(a){let t=a.getAttribute("data-lexical-relationship-id"),e=a.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:r}){super(e,r),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},r=o(e);return r.setFormat(t.format),r}static isInline(){return!1}decorate(t,e){return null}exportDOM(){let t=document.createElement("div");t.setAttribute("data-lexical-relationship-id",String(typeof this.__data?.value=="object"?this.__data?.value?.id: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 ${typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value}`}setData(t){let e=this.getWritable();e.__data=t}};function o(a){return new n({data:a})}var h=l.lazy(()=>import("./RelationshipComponent-SOY5AKWW.js").then(a=>({default:a.RelationshipComponent})));function d(a){let t=a.getAttribute("data-lexical-relationship-id"),e=a.getAttribute("data-lexical-relationship-relationTo");return t!=null&&e!=null?{node: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:d,priority:2}}}static importJSON(t){t.version===1&&t?.value?.id&&(t.value=t.value.id);let e={relationTo:t.relationTo,value:t.value},r=s(e);return r.setFormat(t.format),r}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(a){return new i({data:a})}function R(a){return a instanceof i}export{x as a,i as b,s as c,R as d};
2
+ //# sourceMappingURL=chunk-JNGXYK2K.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/features/relationship/client/drawer/commands.ts", "../../../src/features/relationship/client/nodes/RelationshipNode.tsx", "../../../src/features/relationship/server/nodes/RelationshipNode.tsx"],
4
+ "sourcesContent": ["import type { LexicalCommand } from 'lexical'\n\nimport { createCommand } from 'lexical'\n\nexport const INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND: LexicalCommand<{\n replace: { nodeKey: string } | false\n}> = createCommand('INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND')\n", "'use client'\nimport type {\n DOMConversionMap,\n DOMConversionOutput,\n EditorConfig,\n LexicalEditor,\n LexicalNode,\n} from 'lexical'\nimport type { JSX } from 'react'\n\nimport * as React from 'react'\n\nimport type {\n RelationshipData,\n SerializedRelationshipNode,\n} from '../../server/nodes/RelationshipNode.js'\n\nimport { RelationshipServerNode } from '../../server/nodes/RelationshipNode.js'\n\nconst RelationshipComponent = React.lazy(() =>\n import('../components/RelationshipComponent.js').then((module) => ({\n default: module.RelationshipComponent,\n })),\n)\n\nfunction $relationshipElementToNode(domNode: HTMLDivElement): DOMConversionOutput | null {\n const id = domNode.getAttribute('data-lexical-relationship-id')\n const relationTo = domNode.getAttribute('data-lexical-relationship-relationTo')\n\n if (id != null && relationTo != null) {\n const node = $createRelationshipNode({\n relationTo,\n value: id,\n })\n return { node }\n }\n return null\n}\n\nexport class RelationshipNode extends RelationshipServerNode {\n static override clone(node: RelationshipServerNode): RelationshipServerNode {\n return super.clone(node)\n }\n\n static override getType(): string {\n return super.getType()\n }\n\n static override importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {\n div: (domNode: HTMLDivElement) => {\n if (\n !domNode.hasAttribute('data-lexical-relationship-relationTo') ||\n !domNode.hasAttribute('data-lexical-relationship-id')\n ) {\n return null\n }\n return {\n conversion: $relationshipElementToNode,\n priority: 2,\n }\n },\n }\n }\n\n static override importJSON(serializedNode: SerializedRelationshipNode): RelationshipNode {\n if (serializedNode.version === 1 && (serializedNode?.value as unknown as { id: string })?.id) {\n serializedNode.value = (serializedNode.value as unknown as { id: string }).id\n }\n\n const importedData: RelationshipData = {\n relationTo: serializedNode.relationTo,\n value: serializedNode.value,\n }\n const node = $createRelationshipNode(importedData)\n node.setFormat(serializedNode.format)\n return node\n }\n\n override decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element {\n return (\n <RelationshipComponent\n className={config.theme.relationship ?? 'LexicalEditorTheme__relationship'}\n data={this.__data}\n format={this.__format}\n nodeKey={this.getKey()}\n />\n )\n }\n\n override exportJSON(): SerializedRelationshipNode {\n return super.exportJSON()\n }\n}\n\nexport function $createRelationshipNode(data: RelationshipData): RelationshipNode {\n return new RelationshipNode({\n data,\n })\n}\n\nexport function $isRelationshipNode(\n node: LexicalNode | null | RelationshipNode | undefined,\n): node is RelationshipNode {\n return node instanceof RelationshipNode\n}\n", "import type { SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport type {\n DOMConversionMap,\n DOMConversionOutput,\n DOMExportOutput,\n EditorConfig,\n ElementFormatType,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n Spread,\n} from 'lexical'\nimport type { CollectionSlug, DataFromCollectionSlug } from 'payload'\nimport type { JSX } from 'react'\n\nimport { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\n\nexport type RelationshipData = {\n [TCollectionSlug in CollectionSlug]: {\n relationTo: TCollectionSlug\n value: DataFromCollectionSlug<TCollectionSlug> | number | string\n }\n}[CollectionSlug]\n\nexport type SerializedRelationshipNode = {\n children?: never // required so that our typed editor state doesn't automatically add children\n type: 'relationship'\n} & Spread<RelationshipData, SerializedDecoratorBlockNode>\n\nfunction $relationshipElementToServerNode(domNode: HTMLDivElement): DOMConversionOutput | null {\n const id = domNode.getAttribute('data-lexical-relationship-id')\n const relationTo = domNode.getAttribute('data-lexical-relationship-relationTo')\n\n if (id != null && relationTo != null) {\n const node = $createServerRelationshipNode({\n relationTo,\n value: id,\n })\n return { node }\n }\n return null\n}\n\nexport class RelationshipServerNode extends DecoratorBlockNode {\n __data: RelationshipData\n\n constructor({\n data,\n format,\n key,\n }: {\n data: RelationshipData\n format?: ElementFormatType\n key?: NodeKey\n }) {\n super(format, key)\n this.__data = data\n }\n\n static override clone(node: RelationshipServerNode): RelationshipServerNode {\n return new this({\n data: node.__data,\n format: node.__format,\n key: node.__key,\n })\n }\n\n static override getType(): string {\n return 'relationship'\n }\n\n static override importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {\n div: (domNode: HTMLDivElement) => {\n if (\n !domNode.hasAttribute('data-lexical-relationship-relationTo') ||\n !domNode.hasAttribute('data-lexical-relationship-id')\n ) {\n return null\n }\n return {\n conversion: $relationshipElementToServerNode,\n priority: 2,\n }\n },\n }\n }\n\n static override importJSON(serializedNode: SerializedRelationshipNode): RelationshipServerNode {\n if (serializedNode.version === 1 && (serializedNode?.value as unknown as { id: string })?.id) {\n serializedNode.value = (serializedNode.value as unknown as { id: string }).id\n }\n\n const importedData: RelationshipData = {\n relationTo: serializedNode.relationTo,\n value: serializedNode.value,\n }\n const node = $createServerRelationshipNode(importedData)\n node.setFormat(serializedNode.format)\n return node\n }\n\n static isInline(): false {\n return false\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('div')\n element.setAttribute(\n 'data-lexical-relationship-id',\n String(typeof this.__data?.value === 'object' ? this.__data?.value?.id : this.__data?.value),\n )\n element.setAttribute('data-lexical-relationship-relationTo', this.__data?.relationTo)\n\n const text = document.createTextNode(this.getTextContent())\n element.append(text)\n return { element }\n }\n\n override exportJSON(): SerializedRelationshipNode {\n return {\n ...super.exportJSON(),\n ...this.getData(),\n type: 'relationship',\n version: 2,\n }\n }\n\n getData(): RelationshipData {\n return this.getLatest().__data\n }\n\n override getTextContent(): string {\n return `${this.__data?.relationTo} relation to ${typeof this.__data?.value === 'object' ? this.__data?.value?.id : this.__data?.value}`\n }\n\n setData(data: RelationshipData): void {\n const writable = this.getWritable()\n writable.__data = data\n }\n}\n\nexport function $createServerRelationshipNode(data: RelationshipData): RelationshipServerNode {\n return new RelationshipServerNode({\n data,\n })\n}\n\nexport function $isServerRelationshipNode(\n node: LexicalNode | null | RelationshipServerNode | undefined,\n): node is RelationshipServerNode {\n return node instanceof RelationshipServerNode\n}\n"],
5
+ "mappings": "AAEA,OAASA,iBAAAA,MAA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CAChC,OAAO,MAAMA,QAAA,CACf,CAEA,OAAgBC,WAAqD,CACnE,MAAO,CACLC,IAAMZ,GAEF,CAACA,EAAQa,aAAa,sCAAA,GACtB,CAACb,EAAQa,aAAa,8BAAA,EAEf,KAEF,CACLC,WAAYf,EACZgB,SAAU,CACZ,CAEJ,CACF,CAEA,OAAgBC,WAAWC,EAA8D,CACnFA,EAAeC,UAAY,GAAMD,GAAgBX,OAAqCL,KACxFgB,EAAeX,MAAQW,EAAgBX,MAAoCL,IAG7E,IAAMkB,EAAiC,CACrChB,WAAYc,EAAed,WAC3BG,MAAOW,EAAeX,KACxB,EACMF,EAAOC,EAAwBc,CAAA,EACrCf,OAAAA,EAAKgB,UAAUH,EAAeI,MAAM,EAC7BjB,CACT,CAESkB,SAASC,EAAuBC,EAAmC,CAC1E,OACEC,EAAC/B,EAAA,CACCgC,UAAWF,EAAOG,MAAMC,cAAgB,mCACxCC,KAAM,KAAKC,OACXT,OAAQ,KAAKU,SACbC,QAAS,KAAKC,OAAM,GAG1B,CAESC,YAAyC,CAChD,OAAO,MAAMA,WAAA,CACf,CACF,EAEO,SAAS7B,EAAwBwB,EAAsB,CAC5D,OAAO,IAAItB,EAAiB,CAC1BsB,KAAAA,CACF,CAAA,CACF,CAEO,SAASM,EACd/B,EAAuD,CAEvD,OAAOA,aAAgBG,CACzB",
6
+ "names": ["createCommand", "INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND", "React", "DecoratorBlockNode", "$relationshipElementToServerNode", "domNode", "id", "getAttribute", "relationTo", "node", "$createServerRelationshipNode", "value", "RelationshipServerNode", "__data", "constructor", "data", "format", "key", "clone", "__format", "__key", "getType", "importDOM", "div", "hasAttribute", "conversion", "priority", "importJSON", "serializedNode", "version", "importedData", "setFormat", "isInline", "decorate", "_editor", "_config", "exportDOM", "element", "document", "createElement", "setAttribute", "String", "text", "createTextNode", "getTextContent", "append", "exportJSON", "getData", "type", "getLatest", "setData", "writable", "getWritable", "RelationshipComponent", "lazy", "then", "module", "default", "$relationshipElementToNode", "domNode", "id", "getAttribute", "relationTo", "node", "$createRelationshipNode", "value", "RelationshipNode", "RelationshipServerNode", "clone", "getType", "importDOM", "div", "hasAttribute", "conversion", "priority", "importJSON", "serializedNode", "version", "importedData", "setFormat", "format", "decorate", "editor", "config", "_jsx", "className", "theme", "relationship", "data", "__data", "__format", "nodeKey", "getKey", "exportJSON", "$isRelationshipNode"]
7
+ }
@@ -1,2 +1,2 @@
1
- import{b as P}from"./chunk-3LGFOM34.js";import{c as Y}from"react/compiler-runtime";import{jsx as R}from"react/jsx-runtime";import{Drawer as Z,EditDepthProvider as N,useModal as z}from"@payloadcms/ui";import"react";import{jsx as T,jsxs as W}from"react/jsx-runtime";import{Form as H,FormSubmit as J,RenderFields as K,useDocumentInfo as L,useServerFunctions as B,useTranslation as G}from"@payloadcms/ui";import{abortAndIgnore as y}from"@payloadcms/ui/shared";import{useCallback as V,useEffect as I,useRef as q,useState as Q}from"react";import{v4 as X}from"uuid";var j=({data:e,featureKey:t,fieldMapOverride:r,handleDrawerSubmit:n,schemaFieldsPathOverride:o,schemaPath:p,schemaPathSuffix:m})=>{let{t:d}=G(),{id:s,collectionSlug:c,getDocPreferences:u,globalSlug:l}=L(),i=q(new AbortController),[f,a]=Q(!1),{fieldProps:{featureClientSchemaMap:h,permissions:w}}=P(),{getFormState:x}=B(),g=o??`${p}.lexical_internal_feature.${t}${m?`.${m}`:""}`,S=r??h[t]?.[g];I(()=>{let _=new AbortController;return(async()=>{let{state:v}=await x({id:s,collectionSlug:c,data:e??{},docPermissions:{fields:!0},docPreferences:await u(),globalSlug:l,operation:"update",renderAllFields:!0,schemaPath:g,signal:_.signal});a(v)})(),()=>{y(_)}},[g,s,e,x,c,l,u]);let E=V(async({formState:_})=>{y(i.current);let C=new AbortController;i.current=C;let{state:v}=await x({id:s,collectionSlug:c,docPermissions:{fields:!0},docPreferences:await u(),formState:_,globalSlug:l,operation:"update",schemaPath:g,signal:C.signal});return v||_},[x,s,c,u,l,g]);return I(()=>()=>{y(i.current)},[]),f===!1?null:W(H,{beforeSubmit:[E],disableValidationOnSubmit:!0,fields:Array.isArray(S)?S:[],initialState:f,onChange:[E],onSubmit:n,uuid:X(),children:[T(K,{fields:Array.isArray(S)?S:[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:g,permissions:w,readOnly:!1}),T(J,{children:d("fields:saveChanges")})]})};var Pt=e=>{let t=Y(15),{className:r,data:n,drawerSlug:o,drawerTitle:p,featureKey:m,fieldMapOverride:d,handleDrawerSubmit:s,schemaFieldsPathOverride:c,schemaPath:u,schemaPathSuffix:l}=e,{closeModal:i}=z(),f=p??"",a;t[0]!==i||t[1]!==o||t[2]!==s?(a=(w,x)=>{i(o),setTimeout(()=>{s(w,x)},1)},t[0]=i,t[1]=o,t[2]=s,t[3]=a):a=t[3];let h;return t[4]!==r||t[5]!==n||t[6]!==o||t[7]!==m||t[8]!==d||t[9]!==c||t[10]!==u||t[11]!==l||t[12]!==f||t[13]!==a?(h=R(N,{children:R(Z,{className:r,slug:o,title:f,children:R(j,{data:n,featureKey:m,fieldMapOverride:d,handleDrawerSubmit:a,schemaFieldsPathOverride:c,schemaPath:u,schemaPathSuffix:l})})}),t[4]=r,t[5]=n,t[6]=o,t[7]=m,t[8]=d,t[9]=c,t[10]=u,t[11]=l,t[12]=f,t[13]=a,t[14]=h):h=t[14],h};import{c as tt}from"react/compiler-runtime";import{jsx as et}from"react/jsx-runtime";import{useAuth as rt,useConfig as nt,useEntityVisibility as ot}from"@payloadcms/ui";import*as D from"react";var at=(e,t)=>e.filter(({slug:r,admin:{enableRichTextRelationship:n},upload:o})=>t?.visibleEntities.collections.includes(r)?t?.uploads?n&&!!o:o?!1:n:!1),Mt=e=>{let t=tt(20),r,n,o,p;t[0]!==e?({children:n,FallbackComponent:r,uploads:p,...o}=e,t[0]=e,t[1]=r,t[2]=n,t[3]=o,t[4]=p):(r=t[1],n=t[2],o=t[3],p=t[4]);let m=p===void 0?!1:p,{config:d}=nt(),{collections:s}=d,{user:c}=rt(),{visibleEntities:u}=ot(),l;t[5]!==s||t[6]!==m||t[7]!==c||t[8]!==u?(l=()=>at(s,{uploads:m,user:c,visibleEntities:u}).map(it),t[5]=s,t[6]=m,t[7]=c,t[8]=u,t[9]=l):l=t[9];let[i]=D.useState(l);if(!i.length){let a;return t[10]!==r||t[11]!==o?(a=r?et(r,{...o}):null,t[10]=r,t[11]=o,t[12]=a):a=t[12],a}let f;if(t[13]!==n||t[14]!==i||t[15]!==o){let a;t[17]!==i||t[18]!==o?(a={...o,enabledCollectionSlugs:i},t[17]=i,t[18]=o,t[19]=a):a=t[19],f=D.cloneElement(n,a),t[13]=n,t[14]=i,t[15]=o,t[16]=f}else f=t[16];return f};function it(e){let{slug:t}=e;return t}import{createCommand as lt}from"lexical";var kt=lt("INSERT_UPLOAD_WITH_DRAWER_COMMAND");import{jsx as mt}from"react/jsx-runtime";import F from"bson-objectid";import{$applyNodeReplacement as pt}from"lexical";import*as U from"react";import{jsx as st}from"react/jsx-runtime";import{DecoratorBlockNode as ct}from"@lexical/react/LexicalDecoratorBlockNode.js";import $ from"bson-objectid";import{$applyNodeReplacement as ut}from"lexical";import"react";function O(e){return e.parentElement!=null&&e.parentElement.tagName==="LI"&&e.previousSibling===null&&e.getAttribute("aria-roledescription")==="checkbox"}function ft(e){if(e.hasAttribute("data-lexical-upload-relation-to")&&e.hasAttribute("data-lexical-upload-id")){let r=e.getAttribute("data-lexical-upload-id"),n=e.getAttribute("data-lexical-upload-relation-to");if(r!=null&&n!=null)return{node:M({data:{fields:{},relationTo:n,value:r}})}}let t=e;return t.src.startsWith("file:///")||O(t),null}var b=class extends ct{__data;constructor({data:t,format:r,key:n}){super(r,n),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:ft,priority:0})}}static importJSON(t){t.version===1&&t?.value?.id&&(t.value=t.value.id),t.version===2&&!t?.id&&(t.id=new $.default().toHexString(),t.version=3);let r={id:t.id,fields:t.fields,relationTo:t.relationTo,value:t.value},n=M({data:r});return n.setFormat(t.format),n}static isInline(){return!1}decorate(){return st(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 r=this.getWritable();r.__data=t}updateDOM(){return!1}};function M({data:e}){return e?.id||(e.id=new $.default().toHexString()),ut(new b({data:e}))}var dt=U.lazy(()=>import("./component-NUQPQ2MC.js").then(e=>({default:e.UploadComponent})));function ht(e){if(e.hasAttribute("data-lexical-upload-relation-to")&&e.hasAttribute("data-lexical-upload-id")){let r=e.getAttribute("data-lexical-upload-id"),n=e.getAttribute("data-lexical-upload-relation-to");if(r!=null&&n!=null)return{node:k({data:{fields:{},relationTo:n,value:r}})}}let t=e;return t.src.startsWith("file:///")||O(t),null}var A=class extends b{static clone(t){return super.clone(t)}static getType(){return super.getType()}static importDOM(){return{img:t=>({conversion:ht,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 r={id:t.id,fields:t.fields,relationTo:t.relationTo,value:t.value},n=k({data:r});return n.setFormat(t.format),n}decorate(){return mt(dt,{data:this.__data,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function k({data:e}){return e?.id||(e.id=new F.default().toHexString()),pt(new A({data:e}))}function Yt(e){return e instanceof A}export{Pt as a,Mt as b,kt as c,A as d,k as e,Yt as f};
2
- //# sourceMappingURL=chunk-XXNV22UZ.js.map
1
+ import{b as P}from"./chunk-3LGFOM34.js";import{c as Y}from"react/compiler-runtime";import{jsx as R}from"react/jsx-runtime";import{Drawer as Z,EditDepthProvider as N,useModal as z}from"@payloadcms/ui";import"react";import{jsx as T,jsxs as W}from"react/jsx-runtime";import{Form as H,FormSubmit as J,RenderFields as K,useDocumentInfo as L,useServerFunctions as B,useTranslation as G}from"@payloadcms/ui";import{abortAndIgnore as y}from"@payloadcms/ui/shared";import{useCallback as V,useEffect as I,useRef as q,useState as Q}from"react";import{v4 as X}from"uuid";var j=({data:e,featureKey:t,fieldMapOverride:r,handleDrawerSubmit:n,schemaFieldsPathOverride:o,schemaPath:p,schemaPathSuffix:m})=>{let{t:d}=G(),{id:s,collectionSlug:c,getDocPreferences:u,globalSlug:l}=L(),i=q(new AbortController),[f,a]=Q(!1),{fieldProps:{featureClientSchemaMap:h,permissions:w}}=P(),{getFormState:x}=B(),g=o??`${p}.lexical_internal_feature.${t}${m?`.${m}`:""}`,S=r??h[t]?.[g];I(()=>{let _=new AbortController;return(async()=>{let{state:v}=await x({id:s,collectionSlug:c,data:e??{},docPermissions:{fields:!0},docPreferences:await u(),globalSlug:l,operation:"update",renderAllFields:!0,schemaPath:g,signal:_.signal});a(v)})(),()=>{y(_)}},[g,s,e,x,c,l,u]);let E=V(async({formState:_})=>{y(i.current);let C=new AbortController;i.current=C;let{state:v}=await x({id:s,collectionSlug:c,docPermissions:{fields:!0},docPreferences:await u(),formState:_,globalSlug:l,operation:"update",schemaPath:g,signal:C.signal});return v||_},[x,s,c,u,l,g]);return I(()=>()=>{y(i.current)},[]),f===!1?null:W(H,{beforeSubmit:[E],disableValidationOnSubmit:!0,fields:Array.isArray(S)?S:[],initialState:f,onChange:[E],onSubmit:n,uuid:X(),children:[T(K,{fields:Array.isArray(S)?S:[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:g,permissions:w,readOnly:!1}),T(J,{children:d("fields:saveChanges")})]})};var Pt=e=>{let t=Y(15),{className:r,data:n,drawerSlug:o,drawerTitle:p,featureKey:m,fieldMapOverride:d,handleDrawerSubmit:s,schemaFieldsPathOverride:c,schemaPath:u,schemaPathSuffix:l}=e,{closeModal:i}=z(),f=p??"",a;t[0]!==i||t[1]!==o||t[2]!==s?(a=(w,x)=>{i(o),setTimeout(()=>{s(w,x)},1)},t[0]=i,t[1]=o,t[2]=s,t[3]=a):a=t[3];let h;return t[4]!==r||t[5]!==n||t[6]!==o||t[7]!==m||t[8]!==d||t[9]!==c||t[10]!==u||t[11]!==l||t[12]!==f||t[13]!==a?(h=R(N,{children:R(Z,{className:r,slug:o,title:f,children:R(j,{data:n,featureKey:m,fieldMapOverride:d,handleDrawerSubmit:a,schemaFieldsPathOverride:c,schemaPath:u,schemaPathSuffix:l})})}),t[4]=r,t[5]=n,t[6]=o,t[7]=m,t[8]=d,t[9]=c,t[10]=u,t[11]=l,t[12]=f,t[13]=a,t[14]=h):h=t[14],h};import{c as tt}from"react/compiler-runtime";import{jsx as et}from"react/jsx-runtime";import{useAuth as rt,useConfig as nt,useEntityVisibility as ot}from"@payloadcms/ui";import*as D from"react";var at=(e,t)=>e.filter(({slug:r,admin:{enableRichTextRelationship:n},upload:o})=>t?.visibleEntities.collections.includes(r)?t?.uploads?n&&!!o:o?!1:n:!1),Mt=e=>{let t=tt(20),r,n,o,p;t[0]!==e?({children:n,FallbackComponent:r,uploads:p,...o}=e,t[0]=e,t[1]=r,t[2]=n,t[3]=o,t[4]=p):(r=t[1],n=t[2],o=t[3],p=t[4]);let m=p===void 0?!1:p,{config:d}=nt(),{collections:s}=d,{user:c}=rt(),{visibleEntities:u}=ot(),l;t[5]!==s||t[6]!==m||t[7]!==c||t[8]!==u?(l=()=>at(s,{uploads:m,user:c,visibleEntities:u}).map(it),t[5]=s,t[6]=m,t[7]=c,t[8]=u,t[9]=l):l=t[9];let[i]=D.useState(l);if(!i.length){let a;return t[10]!==r||t[11]!==o?(a=r?et(r,{...o}):null,t[10]=r,t[11]=o,t[12]=a):a=t[12],a}let f;if(t[13]!==n||t[14]!==i||t[15]!==o){let a;t[17]!==i||t[18]!==o?(a={...o,enabledCollectionSlugs:i},t[17]=i,t[18]=o,t[19]=a):a=t[19],f=D.cloneElement(n,a),t[13]=n,t[14]=i,t[15]=o,t[16]=f}else f=t[16];return f};function it(e){let{slug:t}=e;return t}import{createCommand as lt}from"lexical";var kt=lt("INSERT_UPLOAD_WITH_DRAWER_COMMAND");import{jsx as mt}from"react/jsx-runtime";import F from"bson-objectid";import{$applyNodeReplacement as pt}from"lexical";import*as U from"react";import{jsx as st}from"react/jsx-runtime";import{DecoratorBlockNode as ct}from"@lexical/react/LexicalDecoratorBlockNode.js";import $ from"bson-objectid";import{$applyNodeReplacement as ut}from"lexical";import"react";function O(e){return e.parentElement!=null&&e.parentElement.tagName==="LI"&&e.previousSibling===null&&e.getAttribute("aria-roledescription")==="checkbox"}function ft(e){if(e.hasAttribute("data-lexical-upload-relation-to")&&e.hasAttribute("data-lexical-upload-id")){let r=e.getAttribute("data-lexical-upload-id"),n=e.getAttribute("data-lexical-upload-relation-to");if(r!=null&&n!=null)return{node:M({data:{fields:{},relationTo:n,value:r}})}}let t=e;return t.src.startsWith("file:///")||O(t),null}var b=class extends ct{__data;constructor({data:t,format:r,key:n}){super(r,n),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:ft,priority:0})}}static importJSON(t){t.version===1&&t?.value?.id&&(t.value=t.value.id),t.version===2&&!t?.id&&(t.id=new $.default().toHexString(),t.version=3);let r={id:t.id,fields:t.fields,relationTo:t.relationTo,value:t.value},n=M({data:r});return n.setFormat(t.format),n}static isInline(){return!1}decorate(){return st(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 r=this.getWritable();r.__data=t}updateDOM(){return!1}};function M({data:e}){return e?.id||(e.id=new $.default().toHexString()),ut(new b({data:e}))}var dt=U.lazy(()=>import("./component-VZEKUT7Y.js").then(e=>({default:e.UploadComponent})));function ht(e){if(e.hasAttribute("data-lexical-upload-relation-to")&&e.hasAttribute("data-lexical-upload-id")){let r=e.getAttribute("data-lexical-upload-id"),n=e.getAttribute("data-lexical-upload-relation-to");if(r!=null&&n!=null)return{node:k({data:{fields:{},relationTo:n,value:r}})}}let t=e;return t.src.startsWith("file:///")||O(t),null}var A=class extends b{static clone(t){return super.clone(t)}static getType(){return super.getType()}static importDOM(){return{img:t=>({conversion:ht,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 r={id:t.id,fields:t.fields,relationTo:t.relationTo,value:t.value},n=k({data:r});return n.setFormat(t.format),n}decorate(){return mt(dt,{data:this.__data,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function k({data:e}){return e?.id||(e.id=new F.default().toHexString()),pt(new A({data:e}))}function Yt(e){return e instanceof A}export{Pt as a,Mt as b,kt as c,A as d,k as e,Yt as f};
2
+ //# sourceMappingURL=chunk-RIV4NGKY.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/utilities/fieldsDrawer/Drawer.tsx", "../../../src/utilities/fieldsDrawer/DrawerContent.tsx", "../../../src/features/relationship/client/utils/EnabledRelationshipsCondition.tsx", "../../../src/features/upload/client/drawer/commands.ts", "../../../src/features/upload/client/nodes/UploadNode.tsx", "../../../src/features/upload/server/nodes/UploadNode.tsx"],
4
- "sourcesContent": ["'use client'\nimport type { ClientField, Data, FormState, JsonObject } from 'payload'\n\nimport { Drawer, EditDepthProvider, useModal } from '@payloadcms/ui'\nimport React from 'react'\n\nimport { DrawerContent } from './DrawerContent.js'\n\nexport type FieldsDrawerProps = {\n readonly className?: string\n readonly data?: Data\n readonly drawerSlug: string\n readonly drawerTitle?: string\n readonly featureKey: string\n readonly fieldMapOverride?: ClientField[]\n readonly handleDrawerSubmit: (fields: FormState, data: JsonObject) => void\n readonly schemaFieldsPathOverride?: string\n readonly schemaPath: string\n readonly schemaPathSuffix?: string\n}\n\n/**\n * This FieldsDrawer component can be used to easily create a Drawer that contains a form with fields within your feature.\n * The fields are taken directly from the schema map based on your `featureKey` and `schemaPathSuffix`. Thus, this can only\n * be used if you provide your field schema inside the `generateSchemaMap` prop of your feature.server.ts.\n */\nexport const FieldsDrawer: React.FC<FieldsDrawerProps> = ({\n className,\n data,\n drawerSlug,\n drawerTitle,\n featureKey,\n fieldMapOverride,\n handleDrawerSubmit,\n schemaFieldsPathOverride,\n schemaPath,\n schemaPathSuffix,\n}) => {\n const { closeModal } = useModal()\n // The Drawer only renders its children (and itself) if it's open. Thus, by extracting the main content\n // to DrawerContent, this should be faster\n return (\n <EditDepthProvider>\n <Drawer className={className} slug={drawerSlug} title={drawerTitle ?? ''}>\n <DrawerContent\n data={data}\n featureKey={featureKey}\n fieldMapOverride={fieldMapOverride}\n handleDrawerSubmit={(args, args2) => {\n // Simply close drawer - no need for useLexicalDrawer here as at this point,\n // we don't need to restore the cursor position. This is handled by the useEffect in useLexicalDrawer.\n closeModal(drawerSlug)\n\n // Actual drawer submit logic needs to be triggered after the drawer is closed.\n // That's because the lexical selection / cursor restore logic that is striggerer by\n // `useLexicalDrawer` neeeds to be triggered before any editor.update calls that may happen\n // in the `handleDrawerSubmit` function.\n setTimeout(() => {\n handleDrawerSubmit(args, args2)\n }, 1)\n }}\n schemaFieldsPathOverride={schemaFieldsPathOverride}\n schemaPath={schemaPath}\n schemaPathSuffix={schemaPathSuffix}\n />\n </Drawer>\n </EditDepthProvider>\n )\n}\n", "'use client'\nimport type { FormState } from 'payload'\n\nimport {\n Form,\n FormSubmit,\n RenderFields,\n useDocumentInfo,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport React, { useCallback, useEffect, useRef, useState } from 'react'\nimport { v4 as uuid } from 'uuid'\n\nimport type { FieldsDrawerProps } from './Drawer.js'\n\nimport { useEditorConfigContext } from '../../lexical/config/client/EditorConfigProvider.js'\n\nexport const DrawerContent: React.FC<Omit<FieldsDrawerProps, 'drawerSlug' | 'drawerTitle'>> = ({\n data,\n featureKey,\n fieldMapOverride,\n handleDrawerSubmit,\n schemaFieldsPathOverride,\n schemaPath,\n schemaPathSuffix,\n}) => {\n const { t } = useTranslation()\n const { id, collectionSlug, getDocPreferences, globalSlug } = useDocumentInfo()\n\n const onChangeAbortControllerRef = useRef(new AbortController())\n\n const [initialState, setInitialState] = useState<false | FormState | undefined>(false)\n\n const {\n fieldProps: { featureClientSchemaMap, permissions },\n } = useEditorConfigContext()\n\n const { getFormState } = useServerFunctions()\n\n const schemaFieldsPath =\n schemaFieldsPathOverride ??\n `${schemaPath}.lexical_internal_feature.${featureKey}${schemaPathSuffix ? `.${schemaPathSuffix}` : ''}`\n\n const fields: any = fieldMapOverride ?? featureClientSchemaMap[featureKey]?.[schemaFieldsPath] // Field Schema\n\n useEffect(() => {\n const controller = new AbortController()\n\n const awaitInitialState = async () => {\n const { state } = await getFormState({\n id,\n collectionSlug,\n data: data ?? {},\n docPermissions: {\n fields: true,\n },\n docPreferences: await getDocPreferences(),\n globalSlug,\n operation: 'update',\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n setInitialState(state)\n }\n\n void awaitInitialState()\n\n return () => {\n abortAndIgnore(controller)\n }\n }, [schemaFieldsPath, id, data, getFormState, collectionSlug, globalSlug, getDocPreferences])\n\n const onChange = useCallback(\n async ({ formState: prevFormState }: { formState: FormState }) => {\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 formState: prevFormState,\n globalSlug,\n operation: 'update',\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n if (!state) {\n return prevFormState\n }\n\n return state\n },\n [getFormState, id, collectionSlug, getDocPreferences, globalSlug, schemaFieldsPath],\n )\n\n // cleanup effect\n useEffect(() => {\n return () => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [])\n\n if (initialState === false) {\n return null\n }\n\n return (\n <Form\n beforeSubmit={[onChange]}\n disableValidationOnSubmit\n fields={Array.isArray(fields) ? fields : []}\n initialState={initialState}\n onChange={[onChange]}\n onSubmit={handleDrawerSubmit}\n uuid={uuid()}\n >\n <RenderFields\n fields={Array.isArray(fields) ? fields : []}\n forceRender\n parentIndexPath=\"\"\n parentPath=\"\" // See Blocks feature path for details as for why this is empty\n parentSchemaPath={schemaFieldsPath}\n permissions={permissions}\n readOnly={false}\n />\n <FormSubmit>{t('fields:saveChanges')}</FormSubmit>\n </Form>\n )\n}\n", "'use client'\nimport type { ClientCollectionConfig, ClientUser, VisibleEntities } from 'payload'\n\nimport { useAuth, useConfig, useEntityVisibility } from '@payloadcms/ui'\nimport * as React from 'react'\n\ntype Options = {\n uploads: boolean\n user: ClientUser\n visibleEntities: VisibleEntities\n}\n\ntype FilteredCollectionsT = (\n collections: ClientCollectionConfig[],\n options?: Options,\n) => ClientCollectionConfig[]\n\nconst filterRichTextCollections: FilteredCollectionsT = (collections, options) => {\n return collections.filter(({ slug, admin: { enableRichTextRelationship }, upload }) => {\n if (!options?.visibleEntities.collections.includes(slug)) {\n return false\n }\n\n if (options?.uploads) {\n return enableRichTextRelationship && Boolean(upload) === true\n }\n\n return upload ? false : enableRichTextRelationship\n })\n}\n\nexport const EnabledRelationshipsCondition: React.FC<{\n children: any\n FallbackComponent?: React.FC\n uploads?: boolean\n}> = (props) => {\n const { children, FallbackComponent, uploads = false, ...rest } = props\n const {\n config: { collections },\n } = useConfig()\n const { user } = useAuth()\n const { visibleEntities } = useEntityVisibility()\n\n const [enabledCollectionSlugs] = React.useState(() =>\n filterRichTextCollections(collections, { uploads, user: user!, visibleEntities }).map(\n ({ slug }) => slug,\n ),\n )\n\n if (!enabledCollectionSlugs.length) {\n return FallbackComponent ? <FallbackComponent {...rest} /> : null\n }\n\n return React.cloneElement(children, { ...rest, enabledCollectionSlugs })\n}\n", "'use client'\nimport type { LexicalCommand } from 'lexical'\n\nimport { createCommand } from 'lexical'\n\nexport const INSERT_UPLOAD_WITH_DRAWER_COMMAND: LexicalCommand<{\n replace: { nodeKey: string } | false\n}> = createCommand('INSERT_UPLOAD_WITH_DRAWER_COMMAND')\n", "'use client'\nimport type { SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport type { DOMConversionMap, DOMConversionOutput, LexicalNode, Spread } from 'lexical'\nimport type { JSX } from 'react'\n\nimport ObjectID from 'bson-objectid'\nimport { $applyNodeReplacement } from 'lexical'\nimport * as React from 'react'\n\nimport type { UploadData } from '../../server/nodes/UploadNode.js'\n\nimport { isGoogleDocCheckboxImg, UploadServerNode } from '../../server/nodes/UploadNode.js'\n\nconst RawUploadComponent = React.lazy(() =>\n import('../../client/component/index.js').then((module) => ({ default: module.UploadComponent })),\n)\n\nfunction $convertUploadElement(domNode: HTMLImageElement): DOMConversionOutput | null {\n if (\n domNode.hasAttribute('data-lexical-upload-relation-to') &&\n domNode.hasAttribute('data-lexical-upload-id')\n ) {\n const id = domNode.getAttribute('data-lexical-upload-id')\n const relationTo = domNode.getAttribute('data-lexical-upload-relation-to')\n\n if (id != null && relationTo != null) {\n const node = $createUploadNode({\n data: {\n fields: {},\n relationTo,\n value: id,\n },\n })\n return { node }\n }\n }\n const img = domNode\n if (img.src.startsWith('file:///') || isGoogleDocCheckboxImg(img)) {\n return null\n }\n // TODO: Auto-upload functionality here!\n //}\n return null\n}\n\nexport type SerializedUploadNode = {\n children?: never // required so that our typed editor state doesn't automatically add children\n type: 'upload'\n} & Spread<UploadData, SerializedDecoratorBlockNode>\n\nexport class UploadNode extends UploadServerNode {\n static clone(node: UploadServerNode): UploadServerNode {\n return super.clone(node)\n }\n\n static getType(): string {\n return super.getType()\n }\n\n static importDOM(): DOMConversionMap<HTMLImageElement> {\n return {\n img: (node) => ({\n conversion: $convertUploadElement,\n priority: 0,\n }),\n }\n }\n\n static importJSON(serializedNode: SerializedUploadNode): UploadNode {\n if (serializedNode.version === 1 && (serializedNode?.value as unknown as { id: string })?.id) {\n serializedNode.value = (serializedNode.value as unknown as { id: string }).id\n }\n if (serializedNode.version === 2 && !serializedNode?.id) {\n serializedNode.id = new ObjectID.default().toHexString()\n serializedNode.version = 3\n }\n\n const importedData: UploadData = {\n id: serializedNode.id,\n fields: serializedNode.fields,\n relationTo: serializedNode.relationTo,\n value: serializedNode.value,\n }\n\n const node = $createUploadNode({ data: importedData })\n node.setFormat(serializedNode.format)\n\n return node\n }\n\n decorate(): JSX.Element {\n return <RawUploadComponent data={this.__data} nodeKey={this.getKey()} />\n }\n\n exportJSON(): SerializedUploadNode {\n return super.exportJSON()\n }\n}\n\nexport function $createUploadNode({\n data,\n}: {\n data: Omit<UploadData, 'id'> & Partial<Pick<UploadData, 'id'>>\n}): UploadNode {\n if (!data?.id) {\n data.id = new ObjectID.default().toHexString()\n }\n return $applyNodeReplacement(new UploadNode({ data: data as UploadData }))\n}\n\nexport function $isUploadNode(node: LexicalNode | null | undefined): node is UploadNode {\n return node instanceof UploadNode\n}\n", "import type { SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport type {\n DOMConversionMap,\n DOMConversionOutput,\n DOMExportOutput,\n ElementFormatType,\n LexicalNode,\n NodeKey,\n Spread,\n} from 'lexical'\nimport type { CollectionSlug, DataFromCollectionSlug, JsonObject } from 'payload'\nimport type { JSX } from 'react'\n\nimport { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport ObjectID from 'bson-objectid'\nimport { $applyNodeReplacement } from 'lexical'\nimport * as React from 'react'\n\nexport type UploadData<TUploadExtraFieldsData extends JsonObject = JsonObject> = {\n [TCollectionSlug in CollectionSlug]: {\n fields: TUploadExtraFieldsData\n // Every lexical node that has sub-fields needs to have a unique ID. This is the ID of this upload node, not the ID of the linked upload document\n id: string\n relationTo: TCollectionSlug\n // Value can be just the document ID, or the full, populated document\n value: DataFromCollectionSlug<TCollectionSlug> | number | string\n }\n}[CollectionSlug]\n\nexport function isGoogleDocCheckboxImg(img: HTMLImageElement): boolean {\n return (\n img.parentElement != null &&\n img.parentElement.tagName === 'LI' &&\n img.previousSibling === null &&\n img.getAttribute('aria-roledescription') === 'checkbox'\n )\n}\n\nfunction $convertUploadServerElement(domNode: HTMLImageElement): DOMConversionOutput | null {\n if (\n domNode.hasAttribute('data-lexical-upload-relation-to') &&\n domNode.hasAttribute('data-lexical-upload-id')\n ) {\n const id = domNode.getAttribute('data-lexical-upload-id')\n const relationTo = domNode.getAttribute('data-lexical-upload-relation-to')\n\n if (id != null && relationTo != null) {\n const node = $createUploadServerNode({\n data: {\n fields: {},\n relationTo,\n value: id,\n },\n })\n return { node }\n }\n }\n const img = domNode\n if (img.src.startsWith('file:///') || isGoogleDocCheckboxImg(img)) {\n return null\n }\n // TODO: Auto-upload functionality here!\n //}\n return null\n}\n\nexport type SerializedUploadNode = {\n children?: never // required so that our typed editor state doesn't automatically add children\n type: 'upload'\n} & Spread<UploadData, SerializedDecoratorBlockNode>\n\nexport class UploadServerNode extends DecoratorBlockNode {\n __data: UploadData\n\n constructor({\n data,\n format,\n key,\n }: {\n data: UploadData\n format?: ElementFormatType\n key?: NodeKey\n }) {\n super(format, key)\n this.__data = data\n }\n\n static clone(node: UploadServerNode): UploadServerNode {\n return new this({\n data: node.__data,\n format: node.__format,\n key: node.__key,\n })\n }\n\n static getType(): string {\n return 'upload'\n }\n\n static importDOM(): DOMConversionMap<HTMLImageElement> {\n return {\n img: (node) => ({\n conversion: $convertUploadServerElement,\n priority: 0,\n }),\n }\n }\n\n static importJSON(serializedNode: SerializedUploadNode): UploadServerNode {\n if (serializedNode.version === 1 && (serializedNode?.value as unknown as { id: string })?.id) {\n serializedNode.value = (serializedNode.value as unknown as { id: string }).id\n }\n if (serializedNode.version === 2 && !serializedNode?.id) {\n serializedNode.id = new ObjectID.default().toHexString()\n serializedNode.version = 3\n }\n\n const importedData: UploadData = {\n id: serializedNode.id,\n fields: serializedNode.fields,\n relationTo: serializedNode.relationTo,\n value: serializedNode.value,\n }\n\n const node = $createUploadServerNode({ data: importedData })\n node.setFormat(serializedNode.format)\n\n return node\n }\n\n static isInline(): false {\n return false\n }\n\n decorate(): JSX.Element {\n // @ts-expect-error\n return <RawUploadComponent data={this.__data} format={this.__format} nodeKey={this.getKey()} />\n }\n\n exportDOM(): DOMExportOutput {\n const element = document.createElement('img')\n element.setAttribute('data-lexical-upload-id', String(this.__data?.value))\n element.setAttribute('data-lexical-upload-relation-to', this.__data?.relationTo)\n\n return { element }\n }\n\n exportJSON(): SerializedUploadNode {\n return {\n ...super.exportJSON(),\n ...this.getData(),\n type: 'upload',\n version: 3,\n }\n }\n\n getData(): UploadData {\n return this.getLatest().__data\n }\n\n setData(data: UploadData): void {\n const writable = this.getWritable()\n writable.__data = data\n }\n\n updateDOM(): false {\n return false\n }\n}\n\nexport function $createUploadServerNode({\n data,\n}: {\n data: Omit<UploadData, 'id'> & Partial<Pick<UploadData, 'id'>>\n}): UploadServerNode {\n if (!data?.id) {\n data.id = new ObjectID.default().toHexString()\n }\n return $applyNodeReplacement(new UploadServerNode({ data: data as UploadData }))\n}\n\nexport function $isUploadServerNode(\n node: LexicalNode | null | undefined,\n): node is UploadServerNode {\n return node instanceof UploadServerNode\n}\n"],
5
- "mappings": "wCAAA,OAAAA,KAAAC,MAAA,iEAGA,OAASC,UAAAA,EAAQC,qBAAAA,EAAmBC,YAAAA,MAAgB,iBACpD,MAAkB,0DCDlB,OACEC,QAAAA,EACAC,cAAAA,EACAC,gBAAAA,EACAC,mBAAAA,EACAC,sBAAAA,EACAC,kBAAAA,MACK,iBACP,OAASC,kBAAAA,MAAsB,wBAC/B,OAAgBC,eAAAA,EAAaC,aAAAA,EAAW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CAChE,OAAOA,aAAgBS,CACzB",
4
+ "sourcesContent": ["'use client'\nimport type { ClientField, Data, FormState, JsonObject } from 'payload'\n\nimport { Drawer, EditDepthProvider, useModal } from '@payloadcms/ui'\nimport React from 'react'\n\nimport { DrawerContent } from './DrawerContent.js'\n\nexport type FieldsDrawerProps = {\n readonly className?: string\n readonly data?: Data\n readonly drawerSlug: string\n readonly drawerTitle?: string\n readonly featureKey: string\n readonly fieldMapOverride?: ClientField[]\n readonly handleDrawerSubmit: (fields: FormState, data: JsonObject) => void\n readonly schemaFieldsPathOverride?: string\n readonly schemaPath: string\n readonly schemaPathSuffix?: string\n}\n\n/**\n * This FieldsDrawer component can be used to easily create a Drawer that contains a form with fields within your feature.\n * The fields are taken directly from the schema map based on your `featureKey` and `schemaPathSuffix`. Thus, this can only\n * be used if you provide your field schema inside the `generateSchemaMap` prop of your feature.server.ts.\n */\nexport const FieldsDrawer: React.FC<FieldsDrawerProps> = ({\n className,\n data,\n drawerSlug,\n drawerTitle,\n featureKey,\n fieldMapOverride,\n handleDrawerSubmit,\n schemaFieldsPathOverride,\n schemaPath,\n schemaPathSuffix,\n}) => {\n const { closeModal } = useModal()\n // The Drawer only renders its children (and itself) if it's open. Thus, by extracting the main content\n // to DrawerContent, this should be faster\n return (\n <EditDepthProvider>\n <Drawer className={className} slug={drawerSlug} title={drawerTitle ?? ''}>\n <DrawerContent\n data={data}\n featureKey={featureKey}\n fieldMapOverride={fieldMapOverride}\n handleDrawerSubmit={(args, args2) => {\n // Simply close drawer - no need for useLexicalDrawer here as at this point,\n // we don't need to restore the cursor position. This is handled by the useEffect in useLexicalDrawer.\n closeModal(drawerSlug)\n\n // Actual drawer submit logic needs to be triggered after the drawer is closed.\n // That's because the lexical selection / cursor restore logic that is striggerer by\n // `useLexicalDrawer` neeeds to be triggered before any editor.update calls that may happen\n // in the `handleDrawerSubmit` function.\n setTimeout(() => {\n handleDrawerSubmit(args, args2)\n }, 1)\n }}\n schemaFieldsPathOverride={schemaFieldsPathOverride}\n schemaPath={schemaPath}\n schemaPathSuffix={schemaPathSuffix}\n />\n </Drawer>\n </EditDepthProvider>\n )\n}\n", "'use client'\nimport type { FormState } from 'payload'\n\nimport {\n Form,\n FormSubmit,\n RenderFields,\n useDocumentInfo,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport React, { useCallback, useEffect, useRef, useState } from 'react'\nimport { v4 as uuid } from 'uuid'\n\nimport type { FieldsDrawerProps } from './Drawer.js'\n\nimport { useEditorConfigContext } from '../../lexical/config/client/EditorConfigProvider.js'\n\nexport const DrawerContent: React.FC<Omit<FieldsDrawerProps, 'drawerSlug' | 'drawerTitle'>> = ({\n data,\n featureKey,\n fieldMapOverride,\n handleDrawerSubmit,\n schemaFieldsPathOverride,\n schemaPath,\n schemaPathSuffix,\n}) => {\n const { t } = useTranslation()\n const { id, collectionSlug, getDocPreferences, globalSlug } = useDocumentInfo()\n\n const onChangeAbortControllerRef = useRef(new AbortController())\n\n const [initialState, setInitialState] = useState<false | FormState | undefined>(false)\n\n const {\n fieldProps: { featureClientSchemaMap, permissions },\n } = useEditorConfigContext()\n\n const { getFormState } = useServerFunctions()\n\n const schemaFieldsPath =\n schemaFieldsPathOverride ??\n `${schemaPath}.lexical_internal_feature.${featureKey}${schemaPathSuffix ? `.${schemaPathSuffix}` : ''}`\n\n const fields: any = fieldMapOverride ?? featureClientSchemaMap[featureKey]?.[schemaFieldsPath] // Field Schema\n\n useEffect(() => {\n const controller = new AbortController()\n\n const awaitInitialState = async () => {\n const { state } = await getFormState({\n id,\n collectionSlug,\n data: data ?? {},\n docPermissions: {\n fields: true,\n },\n docPreferences: await getDocPreferences(),\n globalSlug,\n operation: 'update',\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n setInitialState(state)\n }\n\n void awaitInitialState()\n\n return () => {\n abortAndIgnore(controller)\n }\n }, [schemaFieldsPath, id, data, getFormState, collectionSlug, globalSlug, getDocPreferences])\n\n const onChange = useCallback(\n async ({ formState: prevFormState }: { formState: FormState }) => {\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 formState: prevFormState,\n globalSlug,\n operation: 'update',\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n if (!state) {\n return prevFormState\n }\n\n return state\n },\n [getFormState, id, collectionSlug, getDocPreferences, globalSlug, schemaFieldsPath],\n )\n\n // cleanup effect\n useEffect(() => {\n return () => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [])\n\n if (initialState === false) {\n return null\n }\n\n return (\n <Form\n beforeSubmit={[onChange]}\n disableValidationOnSubmit\n fields={Array.isArray(fields) ? fields : []}\n initialState={initialState}\n onChange={[onChange]}\n onSubmit={handleDrawerSubmit}\n uuid={uuid()}\n >\n <RenderFields\n fields={Array.isArray(fields) ? fields : []}\n forceRender\n parentIndexPath=\"\"\n parentPath=\"\" // See Blocks feature path for details as for why this is empty\n parentSchemaPath={schemaFieldsPath}\n permissions={permissions}\n readOnly={false}\n />\n <FormSubmit>{t('fields:saveChanges')}</FormSubmit>\n </Form>\n )\n}\n", "'use client'\nimport type { ClientCollectionConfig, ClientUser, VisibleEntities } from 'payload'\n\nimport { useAuth, useConfig, useEntityVisibility } from '@payloadcms/ui'\nimport * as React from 'react'\n\ntype Options = {\n uploads: boolean\n user: ClientUser\n visibleEntities: VisibleEntities\n}\n\ntype FilteredCollectionsT = (\n collections: ClientCollectionConfig[],\n options?: Options,\n) => ClientCollectionConfig[]\n\nconst filterRichTextCollections: FilteredCollectionsT = (collections, options) => {\n return collections.filter(({ slug, admin: { enableRichTextRelationship }, upload }) => {\n if (!options?.visibleEntities.collections.includes(slug)) {\n return false\n }\n\n if (options?.uploads) {\n return enableRichTextRelationship && Boolean(upload) === true\n }\n\n return upload ? false : enableRichTextRelationship\n })\n}\n\nexport const EnabledRelationshipsCondition: React.FC<{\n children: any\n FallbackComponent?: React.FC\n uploads?: boolean\n}> = (props) => {\n const { children, FallbackComponent, uploads = false, ...rest } = props\n const {\n config: { collections },\n } = useConfig()\n const { user } = useAuth()\n const { visibleEntities } = useEntityVisibility()\n\n const [enabledCollectionSlugs] = React.useState(() =>\n filterRichTextCollections(collections, { uploads, user: user!, visibleEntities }).map(\n ({ slug }) => slug,\n ),\n )\n\n if (!enabledCollectionSlugs.length) {\n return FallbackComponent ? <FallbackComponent {...rest} /> : null\n }\n\n return React.cloneElement(children, { ...rest, enabledCollectionSlugs })\n}\n", "'use client'\nimport type { LexicalCommand } from 'lexical'\n\nimport { createCommand } from 'lexical'\n\nexport const INSERT_UPLOAD_WITH_DRAWER_COMMAND: LexicalCommand<{\n replace: { nodeKey: string } | false\n}> = createCommand('INSERT_UPLOAD_WITH_DRAWER_COMMAND')\n", "'use client'\nimport type { SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport type { DOMConversionMap, DOMConversionOutput, LexicalNode, Spread } from 'lexical'\nimport type { JSX } from 'react'\n\nimport ObjectID from 'bson-objectid'\nimport { $applyNodeReplacement } from 'lexical'\nimport * as React from 'react'\n\nimport type { UploadData } from '../../server/nodes/UploadNode.js'\n\nimport { isGoogleDocCheckboxImg, UploadServerNode } from '../../server/nodes/UploadNode.js'\n\nconst RawUploadComponent = React.lazy(() =>\n import('../../client/component/index.js').then((module) => ({ default: module.UploadComponent })),\n)\n\nfunction $convertUploadElement(domNode: HTMLImageElement): DOMConversionOutput | null {\n if (\n domNode.hasAttribute('data-lexical-upload-relation-to') &&\n domNode.hasAttribute('data-lexical-upload-id')\n ) {\n const id = domNode.getAttribute('data-lexical-upload-id')\n const relationTo = domNode.getAttribute('data-lexical-upload-relation-to')\n\n if (id != null && relationTo != null) {\n const node = $createUploadNode({\n data: {\n fields: {},\n relationTo,\n value: id,\n },\n })\n return { node }\n }\n }\n const img = domNode\n if (img.src.startsWith('file:///') || isGoogleDocCheckboxImg(img)) {\n return null\n }\n // TODO: Auto-upload functionality here!\n //}\n return null\n}\n\nexport type SerializedUploadNode = {\n children?: never // required so that our typed editor state doesn't automatically add children\n type: 'upload'\n} & Spread<UploadData, SerializedDecoratorBlockNode>\n\nexport class UploadNode extends UploadServerNode {\n static override clone(node: UploadServerNode): UploadServerNode {\n return super.clone(node)\n }\n\n static override getType(): string {\n return super.getType()\n }\n\n static override importDOM(): DOMConversionMap<HTMLImageElement> {\n return {\n img: (node) => ({\n conversion: $convertUploadElement,\n priority: 0,\n }),\n }\n }\n\n static override importJSON(serializedNode: SerializedUploadNode): UploadNode {\n if (serializedNode.version === 1 && (serializedNode?.value as unknown as { id: string })?.id) {\n serializedNode.value = (serializedNode.value as unknown as { id: string }).id\n }\n if (serializedNode.version === 2 && !serializedNode?.id) {\n serializedNode.id = new ObjectID.default().toHexString()\n serializedNode.version = 3\n }\n\n const importedData: UploadData = {\n id: serializedNode.id,\n fields: serializedNode.fields,\n relationTo: serializedNode.relationTo,\n value: serializedNode.value,\n }\n\n const node = $createUploadNode({ data: importedData })\n node.setFormat(serializedNode.format)\n\n return node\n }\n\n override decorate(): JSX.Element {\n return <RawUploadComponent data={this.__data} nodeKey={this.getKey()} />\n }\n\n override exportJSON(): SerializedUploadNode {\n return super.exportJSON()\n }\n}\n\nexport function $createUploadNode({\n data,\n}: {\n data: Omit<UploadData, 'id'> & Partial<Pick<UploadData, 'id'>>\n}): UploadNode {\n if (!data?.id) {\n data.id = new ObjectID.default().toHexString()\n }\n return $applyNodeReplacement(new UploadNode({ data: data as UploadData }))\n}\n\nexport function $isUploadNode(node: LexicalNode | null | undefined): node is UploadNode {\n return node instanceof UploadNode\n}\n", "import type { SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport type {\n DOMConversionMap,\n DOMConversionOutput,\n DOMExportOutput,\n ElementFormatType,\n LexicalNode,\n NodeKey,\n Spread,\n} from 'lexical'\nimport type { CollectionSlug, DataFromCollectionSlug, JsonObject } from 'payload'\nimport type { JSX } from 'react'\n\nimport { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport ObjectID from 'bson-objectid'\nimport { $applyNodeReplacement } from 'lexical'\nimport * as React from 'react'\n\nexport type UploadData<TUploadExtraFieldsData extends JsonObject = JsonObject> = {\n [TCollectionSlug in CollectionSlug]: {\n fields: TUploadExtraFieldsData\n // Every lexical node that has sub-fields needs to have a unique ID. This is the ID of this upload node, not the ID of the linked upload document\n id: string\n relationTo: TCollectionSlug\n // Value can be just the document ID, or the full, populated document\n value: DataFromCollectionSlug<TCollectionSlug> | number | string\n }\n}[CollectionSlug]\n\nexport function isGoogleDocCheckboxImg(img: HTMLImageElement): boolean {\n return (\n img.parentElement != null &&\n img.parentElement.tagName === 'LI' &&\n img.previousSibling === null &&\n img.getAttribute('aria-roledescription') === 'checkbox'\n )\n}\n\nfunction $convertUploadServerElement(domNode: HTMLImageElement): DOMConversionOutput | null {\n if (\n domNode.hasAttribute('data-lexical-upload-relation-to') &&\n domNode.hasAttribute('data-lexical-upload-id')\n ) {\n const id = domNode.getAttribute('data-lexical-upload-id')\n const relationTo = domNode.getAttribute('data-lexical-upload-relation-to')\n\n if (id != null && relationTo != null) {\n const node = $createUploadServerNode({\n data: {\n fields: {},\n relationTo,\n value: id,\n },\n })\n return { node }\n }\n }\n const img = domNode\n if (img.src.startsWith('file:///') || isGoogleDocCheckboxImg(img)) {\n return null\n }\n // TODO: Auto-upload functionality here!\n //}\n return null\n}\n\nexport type SerializedUploadNode = {\n children?: never // required so that our typed editor state doesn't automatically add children\n type: 'upload'\n} & Spread<UploadData, SerializedDecoratorBlockNode>\n\nexport class UploadServerNode extends DecoratorBlockNode {\n __data: UploadData\n\n constructor({\n data,\n format,\n key,\n }: {\n data: UploadData\n format?: ElementFormatType\n key?: NodeKey\n }) {\n super(format, key)\n this.__data = data\n }\n\n static override clone(node: UploadServerNode): UploadServerNode {\n return new this({\n data: node.__data,\n format: node.__format,\n key: node.__key,\n })\n }\n\n static override getType(): string {\n return 'upload'\n }\n\n static override importDOM(): DOMConversionMap<HTMLImageElement> {\n return {\n img: (node) => ({\n conversion: $convertUploadServerElement,\n priority: 0,\n }),\n }\n }\n\n static override importJSON(serializedNode: SerializedUploadNode): UploadServerNode {\n if (serializedNode.version === 1 && (serializedNode?.value as unknown as { id: string })?.id) {\n serializedNode.value = (serializedNode.value as unknown as { id: string }).id\n }\n if (serializedNode.version === 2 && !serializedNode?.id) {\n serializedNode.id = new ObjectID.default().toHexString()\n serializedNode.version = 3\n }\n\n const importedData: UploadData = {\n id: serializedNode.id,\n fields: serializedNode.fields,\n relationTo: serializedNode.relationTo,\n value: serializedNode.value,\n }\n\n const node = $createUploadServerNode({ data: importedData })\n node.setFormat(serializedNode.format)\n\n return node\n }\n\n static isInline(): false {\n return false\n }\n\n override decorate(): JSX.Element {\n // @ts-expect-error\n return <RawUploadComponent data={this.__data} format={this.__format} nodeKey={this.getKey()} />\n }\n\n override exportDOM(): DOMExportOutput {\n const element = document.createElement('img')\n element.setAttribute('data-lexical-upload-id', String(this.__data?.value))\n element.setAttribute('data-lexical-upload-relation-to', this.__data?.relationTo)\n\n return { element }\n }\n\n override exportJSON(): SerializedUploadNode {\n return {\n ...super.exportJSON(),\n ...this.getData(),\n type: 'upload',\n version: 3,\n }\n }\n\n getData(): UploadData {\n return this.getLatest().__data\n }\n\n setData(data: UploadData): void {\n const writable = this.getWritable()\n writable.__data = data\n }\n\n override updateDOM(): false {\n return false\n }\n}\n\nexport function $createUploadServerNode({\n data,\n}: {\n data: Omit<UploadData, 'id'> & Partial<Pick<UploadData, 'id'>>\n}): UploadServerNode {\n if (!data?.id) {\n data.id = new ObjectID.default().toHexString()\n }\n return $applyNodeReplacement(new UploadServerNode({ data: data as UploadData }))\n}\n\nexport function $isUploadServerNode(\n node: LexicalNode | null | undefined,\n): node is UploadServerNode {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,KAAM,KAAKwB,OAAQC,QAAS,KAAKC,OAAM,GACpE,CAESC,YAAmC,CAC1C,OAAO,MAAMA,WAAA,CACf,CACF,EAEO,SAAS5B,EAAkB,CAChCC,KAAAA,CAAI,EAGL,CACC,OAAKA,GAAML,KACTK,EAAKL,GAAK,IAAIsB,EAAS3B,QAAO,EAAG4B,YAAW,GAEvCU,GAAsB,IAAIrB,EAAW,CAAEP,KAAMA,CAAmB,CAAA,CAAA,CACzE,CAEO,SAAS6B,GAAc/B,EAAoC,CAChE,OAAOA,aAAgBS,CACzB",
6
6
  "names": ["c", "_c", "Drawer", "EditDepthProvider", "useModal", "Form", "FormSubmit", "RenderFields", "useDocumentInfo", "useServerFunctions", "useTranslation", "abortAndIgnore", "useCallback", "useEffect", "useRef", "useState", "v4", "uuid", "DrawerContent", "data", "featureKey", "fieldMapOverride", "handleDrawerSubmit", "schemaFieldsPathOverride", "schemaPath", "schemaPathSuffix", "t", "useTranslation", "id", "collectionSlug", "getDocPreferences", "globalSlug", "useDocumentInfo", "onChangeAbortControllerRef", "useRef", "AbortController", "initialState", "setInitialState", "useState", "fieldProps", "featureClientSchemaMap", "permissions", "useEditorConfigContext", "getFormState", "useServerFunctions", "schemaFieldsPath", "fields", "useEffect", "controller", "state", "docPermissions", "docPreferences", "operation", "renderAllFields", "signal", "abortAndIgnore", "onChange", "useCallback", "formState", "prevFormState", "current", "_jsxs", "Form", "beforeSubmit", "disableValidationOnSubmit", "Array", "isArray", "onSubmit", "uuid", "_jsx", "RenderFields", "forceRender", "parentIndexPath", "parentPath", "parentSchemaPath", "readOnly", "FormSubmit", "FieldsDrawer", "t0", "$", "_c", "className", "data", "drawerSlug", "drawerTitle", "featureKey", "fieldMapOverride", "handleDrawerSubmit", "schemaFieldsPathOverride", "schemaPath", "schemaPathSuffix", "closeModal", "useModal", "t1", "t2", "args", "args2", "setTimeout", "t3", "_jsx", "EditDepthProvider", "children", "Drawer", "slug", "title", "DrawerContent", "c", "_c", "useAuth", "useConfig", "useEntityVisibility", "React", "filterRichTextCollections", "collections", "options", "filter", "slug", "admin", "enableRichTextRelationship", "upload", "visibleEntities", "includes", "uploads", "Boolean", "EnabledRelationshipsCondition", "props", "$", "FallbackComponent", "children", "rest", "t0", "undefined", "config", "t1", "user", "t2", "map", "_temp", "enabledCollectionSlugs", "useState", "length", "t3", "_jsx", "t4", "cloneElement", "createCommand", "INSERT_UPLOAD_WITH_DRAWER_COMMAND", "ObjectID", "$applyNodeReplacement", "React", "DecoratorBlockNode", "ObjectID", "$applyNodeReplacement", "isGoogleDocCheckboxImg", "img", "parentElement", "tagName", "previousSibling", "getAttribute", "$convertUploadServerElement", "domNode", "hasAttribute", "id", "relationTo", "node", "$createUploadServerNode", "data", "fields", "value", "src", "startsWith", "UploadServerNode", "__data", "constructor", "format", "key", "clone", "__format", "__key", "getType", "importDOM", "conversion", "priority", "importJSON", "serializedNode", "version", "default", "toHexString", "importedData", "setFormat", "isInline", "decorate", "_jsx", "RawUploadComponent", "nodeKey", "getKey", "exportDOM", "element", "document", "createElement", "setAttribute", "String", "exportJSON", "getData", "type", "getLatest", "setData", "writable", "getWritable", "updateDOM", "RawUploadComponent", "lazy", "then", "module", "default", "UploadComponent", "$convertUploadElement", "domNode", "hasAttribute", "id", "getAttribute", "relationTo", "node", "$createUploadNode", "data", "fields", "value", "img", "src", "startsWith", "isGoogleDocCheckboxImg", "UploadNode", "UploadServerNode", "clone", "getType", "importDOM", "conversion", "priority", "importJSON", "serializedNode", "version", "ObjectID", "toHexString", "importedData", "setFormat", "format", "decorate", "_jsx", "__data", "nodeKey", "getKey", "exportJSON", "$applyNodeReplacement", "$isUploadNode"]
7
7
  }
@@ -1,3 +1,3 @@
1
1
  import{jsx as m}from"react/jsx-runtime";import{$applyNodeReplacement as d}from"lexical";import*as a from"react";import{addClassNamesToElement as u}from"@lexical/utils";import{$applyNodeReplacement as l,createCommand as c,DecoratorNode as s}from"lexical";var O=c("INSERT_HORIZONTAL_RULE_COMMAND"),r=class extends s{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:p,priority:0})}}static importJSON(e){return i()}createDOM(e){let o=document.createElement("hr");return u(o,e.theme.hr),o}decorate(){return null}exportDOM(){return{element:document.createElement("hr")}}exportJSON(){return{type:"horizontalrule",version:1}}getTextContent(){return`
2
- `}isInline(){return!1}updateDOM(){return!1}};function p(){return{node:i()}}function i(){return l(new r)}var N=a.lazy(()=>import("./component-SX36AJXS.js").then(t=>({default:t.HorizontalRuleComponent}))),n=class extends r{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return f()}decorate(){return m(N,{nodeKey:this.__key})}exportJSON(){return super.exportJSON()}};function f(){return d(new n)}function E(t){return t instanceof n}export{O as a,n as b,f as c,E as d};
3
- //# sourceMappingURL=chunk-AXXPUMFU.js.map
2
+ `}isInline(){return!1}updateDOM(){return!1}};function p(){return{node:i()}}function i(){return l(new r)}var N=a.lazy(()=>import("./component-FU65NQBY.js").then(t=>({default:t.HorizontalRuleComponent}))),n=class extends r{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return f()}decorate(){return m(N,{nodeKey:this.__key})}exportJSON(){return super.exportJSON()}};function f(){return d(new n)}function E(t){return t instanceof n}export{O as a,n as b,f as c,E as d};
3
+ //# sourceMappingURL=chunk-RJTGMBHA.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/features/horizontalRule/client/nodes/HorizontalRuleNode.tsx", "../../../src/features/horizontalRule/server/nodes/HorizontalRuleNode.tsx"],
4
+ "sourcesContent": ["'use client'\nimport type { DOMConversionOutput, LexicalNode, SerializedLexicalNode } from 'lexical'\n\nimport { $applyNodeReplacement } from 'lexical'\nimport * as React from 'react'\n\nimport type { SerializedHorizontalRuleNode } from '../../server/nodes/HorizontalRuleNode.js'\n\nimport { HorizontalRuleServerNode } from '../../server/nodes/HorizontalRuleNode.js'\n\nconst HorizontalRuleComponent = React.lazy(() =>\n import('../../client/component/index.js').then((module) => ({\n default: module.HorizontalRuleComponent,\n })),\n)\n\nexport class HorizontalRuleNode extends HorizontalRuleServerNode {\n static override clone(node: HorizontalRuleServerNode): HorizontalRuleServerNode {\n return super.clone(node)\n }\n\n static override getType(): string {\n return super.getType()\n }\n\n /**\n * The data for this node is stored serialized as JSON. This is the \"load function\" of that node: it takes the saved data and converts it into a node.\n */\n static override importJSON(serializedNode: SerializedHorizontalRuleNode): HorizontalRuleNode {\n return $createHorizontalRuleNode()\n }\n\n /**\n * Allows you to render a React component within whatever createDOM returns.\n */\n override decorate(): React.ReactElement {\n return <HorizontalRuleComponent nodeKey={this.__key} />\n }\n\n override exportJSON(): SerializedLexicalNode {\n return super.exportJSON()\n }\n}\n\nfunction $convertHorizontalRuleElement(): DOMConversionOutput {\n return { node: $createHorizontalRuleNode() }\n}\n\nexport function $createHorizontalRuleNode(): HorizontalRuleNode {\n return $applyNodeReplacement(new HorizontalRuleNode())\n}\n\nexport function $isHorizontalRuleNode(\n node: LexicalNode | null | undefined,\n): node is HorizontalRuleNode {\n return node instanceof HorizontalRuleNode\n}\n", "import type {\n DOMConversionMap,\n DOMConversionOutput,\n DOMExportOutput,\n EditorConfig,\n LexicalCommand,\n LexicalNode,\n SerializedLexicalNode,\n Spread,\n} from 'lexical'\nimport type * as React from 'react'\n\nimport { addClassNamesToElement } from '@lexical/utils'\nimport { $applyNodeReplacement, createCommand, DecoratorNode } from 'lexical'\n\n/**\n * Serialized representation of a horizontal rule node. Serialized = converted to JSON. This is what is stored in the database / in the lexical editor state.\n */\nexport type SerializedHorizontalRuleNode = Spread<\n {\n children?: never // required so that our typed editor state doesn't automatically add children\n type: 'horizontalrule'\n },\n SerializedLexicalNode\n>\n\nexport const INSERT_HORIZONTAL_RULE_COMMAND: LexicalCommand<void> = createCommand(\n 'INSERT_HORIZONTAL_RULE_COMMAND',\n)\n\n/**\n * This node is a DecoratorNode. DecoratorNodes allow you to render React components in the editor.\n *\n * They need both createDom and decorate functions. createDom => outside of the html. decorate => React Component inside of the html.\n *\n * If we used DecoratorBlockNode instead, we would only need a decorate method\n */\nexport class HorizontalRuleServerNode extends DecoratorNode<null | React.ReactElement> {\n static override clone(node: HorizontalRuleServerNode): HorizontalRuleServerNode {\n return new this(node.__key)\n }\n\n static override getType(): string {\n return 'horizontalrule'\n }\n\n /**\n * Defines what happens if you copy an hr element from another page and paste it into the lexical editor\n *\n * This also determines the behavior of lexical's internal HTML -> Lexical converter\n */\n static override importDOM(): DOMConversionMap | null {\n return {\n hr: () => ({\n conversion: $convertHorizontalRuleElement,\n priority: 0,\n }),\n }\n }\n\n /**\n * The data for this node is stored serialized as JSON. This is the \"load function\" of that node: it takes the saved data and converts it into a node.\n */\n static override importJSON(\n serializedNode: SerializedHorizontalRuleNode,\n ): HorizontalRuleServerNode {\n return $createHorizontalRuleServerNode()\n }\n\n /**\n * Determines how the hr element is rendered in the lexical editor. This is only the \"initial\" / \"outer\" HTML element.\n */\n override createDOM(config: EditorConfig): HTMLElement {\n const element = document.createElement('hr')\n addClassNamesToElement(element, config.theme.hr)\n return element\n }\n\n override decorate(): null | React.ReactElement {\n return null\n }\n\n /**\n * Opposite of importDOM, this function defines what happens when you copy an hr element from the lexical editor and paste it into another page.\n *\n * This also determines the behavior of lexical's internal Lexical -> HTML converter\n */\n override exportDOM(): DOMExportOutput {\n return { element: document.createElement('hr') }\n }\n /**\n * Opposite of importJSON. This determines what data is saved in the database / in the lexical editor state.\n */\n override exportJSON(): SerializedLexicalNode {\n return {\n type: 'horizontalrule',\n version: 1,\n }\n }\n\n override getTextContent(): string {\n return '\\n'\n }\n\n override isInline(): false {\n return false\n }\n\n override updateDOM(): boolean {\n return false\n }\n}\n\nfunction $convertHorizontalRuleElement(): DOMConversionOutput {\n return { node: $createHorizontalRuleServerNode() }\n}\n\nexport function $createHorizontalRuleServerNode(): HorizontalRuleServerNode {\n return $applyNodeReplacement(new HorizontalRuleServerNode())\n}\n\nexport function $isHorizontalRuleServerNode(\n node: LexicalNode | null | undefined,\n): node is HorizontalRuleServerNode {\n return node instanceof HorizontalRuleServerNode\n}\n"],
5
+ "mappings": "wCAGA,OAASA,yBAAAA,MAA6B,UACtC,UAAYC,MAAW,QCQvB,OAASC,0BAAAA,MAA8B,iBACvC,OAASC,yBAAAA,EAAuBC,iBAAAA,EAAeC,iBAAAA,MAAqB,UAa7D,IAAMC,EAAuDF,EAClE,gCAAA,EAUWG,EAAN,cAAuCF,CAAA,CAC5C,OAAgBG,MAAMC,EAA0D,CAC9E,OAAO,IAAI,KAAKA,EAAKC,KAAK,CAC5B,CAEA,OAAgBC,SAAkB,CAChC,MAAO,gBACT,CAOA,OAAgBC,WAAqC,CACnD,MAAO,CACLC,GAAIA,KAAO,CACTC,WAAYC,EACZC,SAAU,CACZ,EACF,CACF,CAKA,OAAgBC,WACdC,EAC0B,CAC1B,OAAOC,EAAA,CACT,CAKAC,UAAmBC,EAAmC,CACpD,IAAMC,EAAUC,SAASC,cAAc,IAAA,EACvCtB,OAAAA,EAAuBoB,EAASD,EAAOI,MAAMZ,EAAE,EACxCS,CACT,CAESI,UAAsC,CAC7C,OAAO,IACT,CAOAC,WAAsC,CACpC,MAAO,CAAEL,QAASC,SAASC,cAAc,IAAA,CAAM,CACjD,CAIAI,YAA6C,CAC3C,MAAO,CACLC,KAAM,iBACNC,QAAS,CACX,CACF,CAESC,gBAAyB,CAChC,MAAO;CACT,CAESC,UAAkB,CACzB,MAAO,EACT,CAESC,WAAqB,CAC5B,MAAO,EACT,CACF,EAEA,SAASlB,GAAA,CACP,MAAO,CAAEN,KAAMU,EAAA,CAAkC,CACnD,CAEO,SAASA,GAAA,CACd,OAAOhB,EAAsB,IAAII,CAAA,CACnC,CD7GA,IAAM2B,EAAgCC,OAAK,IACzC,OAAO,yBAAA,EAAmCC,KAAMC,IAAY,CAC1DC,QAASD,EAAOH,uBAClB,EAAA,CAAA,EAGWK,EAAN,cAAiCC,CAAA,CACtC,OAAgBC,MAAMC,EAA0D,CAC9E,OAAO,MAAMD,MAAMC,CAAA,CACrB,CAEA,OAAgBC,SAAkB,CAChC,OAAO,MAAMA,QAAA,CACf,CAKA,OAAgBC,WAAWC,EAAkE,CAC3F,OAAOC,EAAA,CACT,CAKAC,UAAwC,CACtC,OAAOC,EAACd,EAAA,CAAwBe,QAAS,KAAKC,OAChD,CAESC,YAAoC,CAC3C,OAAO,MAAMA,WAAA,CACf,CACF,EAMO,SAASC,GAAA,CACd,OAAOC,EAAsB,IAAIC,CAAA,CACnC,CAEO,SAASC,EACdC,EAAoC,CAEpC,OAAOA,aAAgBF,CACzB",
6
+ "names": ["$applyNodeReplacement", "React", "addClassNamesToElement", "$applyNodeReplacement", "createCommand", "DecoratorNode", "INSERT_HORIZONTAL_RULE_COMMAND", "HorizontalRuleServerNode", "clone", "node", "__key", "getType", "importDOM", "hr", "conversion", "$convertHorizontalRuleElement", "priority", "importJSON", "serializedNode", "$createHorizontalRuleServerNode", "createDOM", "config", "element", "document", "createElement", "theme", "decorate", "exportDOM", "exportJSON", "type", "version", "getTextContent", "isInline", "updateDOM", "HorizontalRuleComponent", "lazy", "then", "module", "default", "HorizontalRuleNode", "HorizontalRuleServerNode", "clone", "node", "getType", "importJSON", "serializedNode", "$createHorizontalRuleNode", "decorate", "_jsx", "nodeKey", "__key", "exportJSON", "$createHorizontalRuleNode", "$applyNodeReplacement", "HorizontalRuleNode", "$isHorizontalRuleNode", "node"]
7
+ }
@@ -1,2 +1,2 @@
1
- "use client";import{d as p}from"./chunk-AXXPUMFU.js";import{c as S}from"react/compiler-runtime";import{useLexicalComposerContext as _}from"@lexical/react/LexicalComposerContext.js";import{useLexicalNodeSelection as K}from"@lexical/react/useLexicalNodeSelection.js";import{addClassNamesToElement as M,mergeRegister as D,removeClassNamesFromElement as y}from"@lexical/utils";import{$getSelection as A,$isNodeSelection as O,CLICK_COMMAND as L,COMMAND_PRIORITY_LOW as E,KEY_BACKSPACE_COMMAND as R,KEY_DELETE_COMMAND as $}from"lexical";import{useEffect as N}from"react";var g="selected";function P(i){let e=S(16),{nodeKey:l}=i,[t]=_(),[o,n,m]=K(l),c;e[0]!==t||e[1]!==o?(c=r=>{let d=A();return o&&O(d)&&(r.preventDefault(),t.update(()=>{d.getNodes().forEach(h)})),!1},e[0]=t,e[1]=o,e[2]=c):c=e[2];let s=c,f,a;e[3]!==s||e[4]!==m||e[5]!==t||e[6]!==o||e[7]!==l||e[8]!==n?(f=()=>D(t.registerCommand(L,r=>{let d=t.getElementByKey(l);return r.target===d?(r.shiftKey||m(),n(!o),!0):!1},E),t.registerCommand($,s,E),t.registerCommand(R,s,E)),a=[m,t,o,l,s,n],e[3]=s,e[4]=m,e[5]=t,e[6]=o,e[7]=l,e[8]=n,e[9]=f,e[10]=a):(f=e[9],a=e[10]),N(f,a);let u,C;return e[11]!==t||e[12]!==o||e[13]!==l?(u=()=>{let r=t.getElementByKey(l);r!==null&&(o?M(r,g):y(r,g))},C=[t,o,l],e[11]=t,e[12]=o,e[13]=l,e[14]=u,e[15]=C):(u=e[14],C=e[15]),N(u,C),null}function h(i){p(i)&&i.remove()}export{P as HorizontalRuleComponent};
2
- //# sourceMappingURL=component-SX36AJXS.js.map
1
+ "use client";import{d as p}from"./chunk-RJTGMBHA.js";import{c as S}from"react/compiler-runtime";import{useLexicalComposerContext as _}from"@lexical/react/LexicalComposerContext.js";import{useLexicalNodeSelection as K}from"@lexical/react/useLexicalNodeSelection.js";import{addClassNamesToElement as M,mergeRegister as D,removeClassNamesFromElement as y}from"@lexical/utils";import{$getSelection as A,$isNodeSelection as O,CLICK_COMMAND as L,COMMAND_PRIORITY_LOW as E,KEY_BACKSPACE_COMMAND as R,KEY_DELETE_COMMAND as $}from"lexical";import{useEffect as N}from"react";var g="selected";function P(i){let e=S(16),{nodeKey:l}=i,[t]=_(),[o,n,m]=K(l),c;e[0]!==t||e[1]!==o?(c=r=>{let d=A();return o&&O(d)&&(r.preventDefault(),t.update(()=>{d.getNodes().forEach(h)})),!1},e[0]=t,e[1]=o,e[2]=c):c=e[2];let s=c,f,a;e[3]!==s||e[4]!==m||e[5]!==t||e[6]!==o||e[7]!==l||e[8]!==n?(f=()=>D(t.registerCommand(L,r=>{let d=t.getElementByKey(l);return r.target===d?(r.shiftKey||m(),n(!o),!0):!1},E),t.registerCommand($,s,E),t.registerCommand(R,s,E)),a=[m,t,o,l,s,n],e[3]=s,e[4]=m,e[5]=t,e[6]=o,e[7]=l,e[8]=n,e[9]=f,e[10]=a):(f=e[9],a=e[10]),N(f,a);let u,C;return e[11]!==t||e[12]!==o||e[13]!==l?(u=()=>{let r=t.getElementByKey(l);r!==null&&(o?M(r,g):y(r,g))},C=[t,o,l],e[11]=t,e[12]=o,e[13]=l,e[14]=u,e[15]=C):(u=e[14],C=e[15]),N(u,C),null}function h(i){p(i)&&i.remove()}export{P as HorizontalRuleComponent};
2
+ //# sourceMappingURL=component-FU65NQBY.js.map
@@ -1,2 +1,2 @@
1
- "use client";import{a as M,b as A,c as T,f as O}from"./chunk-XXNV22UZ.js";import{a as y}from"./chunk-INBEEENE.js";import{a as U}from"./chunk-F26IQ5RE.js";import{b}from"./chunk-3LGFOM34.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}=y(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(M,{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-NUQPQ2MC.js.map
1
+ "use client";import{a as M,b as A,c as T,f as O}from"./chunk-RIV4NGKY.js";import{a as y}from"./chunk-INBEEENE.js";import{a as U}from"./chunk-F26IQ5RE.js";import{b}from"./chunk-3LGFOM34.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}=y(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(M,{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-VZEKUT7Y.js.map
@@ -0,0 +1,2 @@
1
+ "use client";import{a,b}from"./chunk-DIR6RNSY.js";import"./chunk-INBEEENE.js";import"./chunk-3LGFOM34.js";export{b as InlineBlockComponent,a as useInlineBlockComponentContext};
2
+ //# sourceMappingURL=componentInline-MX6DTKSG.js.map