@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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/richtext-lexical",
3
- "version": "3.17.1",
3
+ "version": "3.18.0-canary.030d28e",
4
4
  "description": "The officially supported Lexical richtext adapter for Payload",
5
5
  "homepage": "https://payloadcms.com",
6
6
  "repository": {
@@ -352,8 +352,8 @@
352
352
  "react-error-boundary": "4.1.2",
353
353
  "ts-essentials": "10.0.3",
354
354
  "uuid": "10.0.0",
355
- "@payloadcms/translations": "3.17.1",
356
- "@payloadcms/ui": "3.17.1"
355
+ "@payloadcms/translations": "3.18.0-canary.030d28e",
356
+ "@payloadcms/ui": "3.18.0-canary.030d28e"
357
357
  },
358
358
  "devDependencies": {
359
359
  "@babel/cli": "7.25.9",
@@ -374,7 +374,7 @@
374
374
  "eslint-plugin-react-compiler": "19.0.0-beta-df7b47d-20241124",
375
375
  "swc-plugin-transform-remove-imports": "2.0.0",
376
376
  "@payloadcms/eslint-config": "3.9.0",
377
- "payload": "3.17.1"
377
+ "payload": "3.18.0-canary.030d28e"
378
378
  },
379
379
  "peerDependencies": {
380
380
  "@faceless-ui/modal": "3.0.0-beta.2",
@@ -392,8 +392,8 @@
392
392
  "lexical": "0.21.0",
393
393
  "react": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
394
394
  "react-dom": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
395
- "@payloadcms/next": "3.17.1",
396
- "payload": "3.17.1"
395
+ "@payloadcms/next": "3.18.0-canary.030d28e",
396
+ "payload": "3.18.0-canary.030d28e"
397
397
  },
398
398
  "engines": {
399
399
  "node": "^18.20.2 || >=20.9.0"
@@ -1,7 +0,0 @@
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 clone(node: HorizontalRuleServerNode): HorizontalRuleServerNode {\n return super.clone(node)\n }\n\n static 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 importJSON(serializedNode: SerializedHorizontalRuleNode): HorizontalRuleNode {\n return $createHorizontalRuleNode()\n }\n\n /**\n * Allows you to render a React component within whatever createDOM returns.\n */\n decorate(): React.ReactElement {\n return <HorizontalRuleComponent nodeKey={this.__key} />\n }\n\n 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 clone(node: HorizontalRuleServerNode): HorizontalRuleServerNode {\n return new this(node.__key)\n }\n\n static 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 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 importJSON(serializedNode: SerializedHorizontalRuleNode): 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 createDOM(config: EditorConfig): HTMLElement {\n const element = document.createElement('hr')\n addClassNamesToElement(element, config.theme.hr)\n return element\n }\n\n 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 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 exportJSON(): SerializedLexicalNode {\n return {\n type: 'horizontalrule',\n version: 1,\n }\n }\n\n getTextContent(): string {\n return '\\n'\n }\n\n isInline(): false {\n return false\n }\n\n 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,OAAOG,MAAMC,EAA0D,CACrE,OAAO,IAAI,KAAKA,EAAKC,KAAK,CAC5B,CAEA,OAAOC,SAAkB,CACvB,MAAO,gBACT,CAOA,OAAOC,WAAqC,CAC1C,MAAO,CACLC,GAAIA,KAAO,CACTC,WAAYC,EACZC,SAAU,CACZ,EACF,CACF,CAKA,OAAOC,WAAWC,EAAwE,CACxF,OAAOC,EAAA,CACT,CAKAC,UAAUC,EAAmC,CAC3C,IAAMC,EAAUC,SAASC,cAAc,IAAA,EACvCtB,OAAAA,EAAuBoB,EAASD,EAAOI,MAAMZ,EAAE,EACxCS,CACT,CAEAI,UAAsC,CACpC,OAAO,IACT,CAOAC,WAA6B,CAC3B,MAAO,CAAEL,QAASC,SAASC,cAAc,IAAA,CAAM,CACjD,CAIAI,YAAoC,CAClC,MAAO,CACLC,KAAM,iBACNC,QAAS,CACX,CACF,CAEAC,gBAAyB,CACvB,MAAO;CACT,CAEAC,UAAkB,CAChB,MAAO,EACT,CAEAC,WAAqB,CACnB,MAAO,EACT,CACF,EAEA,SAASlB,GAAA,CACP,MAAO,CAAEN,KAAMU,EAAA,CAAkC,CACnD,CAEO,SAASA,GAAA,CACd,OAAOhB,EAAsB,IAAII,CAAA,CACnC,CD3GA,IAAM2B,EAAgCC,OAAK,IACzC,OAAO,yBAAA,EAAmCC,KAAMC,IAAY,CAC1DC,QAASD,EAAOH,uBAClB,EAAA,CAAA,EAGWK,EAAN,cAAiCC,CAAA,CACtC,OAAOC,MAAMC,EAA0D,CACrE,OAAO,MAAMD,MAAMC,CAAA,CACrB,CAEA,OAAOC,SAAkB,CACvB,OAAO,MAAMA,QAAA,CACf,CAKA,OAAOC,WAAWC,EAAkE,CAClF,OAAOC,EAAA,CACT,CAKAC,UAA+B,CAC7B,OAAOC,EAACd,EAAA,CAAwBe,QAAS,KAAKC,OAChD,CAEAC,YAAoC,CAClC,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,7 +0,0 @@
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 clone(node: RelationshipServerNode): RelationshipServerNode {\n return super.clone(node)\n }\n\n static getType(): string {\n return super.getType()\n }\n\n static 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 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 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 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 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 getType(): string {\n return 'relationship'\n }\n\n static 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 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 decorate(_editor: LexicalEditor, _config: EditorConfig): JSX.Element | null {\n return null\n }\n\n 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 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 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,MAAqB,UAEvB,IAAMC,EAERD,EAAc,yCAAA,0CCInB,UAAYE,MAAW,QCKvB,OAASC,sBAAAA,MAA0B,8CAcnC,SAASC,EAAiCC,EAAuB,CAC/D,IAAMC,EAAKD,EAAQE,aAAa,8BAAA,EAC1BC,EAAaH,EAAQE,aAAa,sCAAA,EAExC,OAAID,GAAM,MAAQE,GAAc,KAKvB,CAAEC,KAJIC,EAA8B,CACzCF,WAAAA,EACAG,MAAOL,CACT,CAAA,CACc,EAET,IACT,CAEO,IAAMM,EAAN,cAAqCT,CAAA,CAC1CU,OAEAC,YAAY,CACVC,KAAAA,EACAC,OAAAA,EACAC,IAAAA,CAAG,EAKF,CACD,MAAMD,EAAQC,CAAA,EACd,KAAKJ,OAASE,CAChB,CAEA,OAAOG,MAAMT,EAAsD,CACjE,OAAO,IAAI,KAAK,CACdM,KAAMN,EAAKI,OACXG,OAAQP,EAAKU,SACbF,IAAKR,EAAKW,KACZ,CAAA,CACF,CAEA,OAAOC,SAAkB,CACvB,MAAO,cACT,CAEA,OAAOC,WAAqD,CAC1D,MAAO,CACLC,IAAMlB,GAEF,CAACA,EAAQmB,aAAa,sCAAA,GACtB,CAACnB,EAAQmB,aAAa,8BAAA,EAEf,KAEF,CACLC,WAAYrB,EACZsB,SAAU,CACZ,CAEJ,CACF,CAEA,OAAOC,WAAWC,EAAoE,CAChFA,EAAeC,UAAY,GAAMD,GAAgBjB,OAAqCL,KACxFsB,EAAejB,MAAQiB,EAAgBjB,MAAoCL,IAG7E,IAAMwB,EAAiC,CACrCtB,WAAYoB,EAAepB,WAC3BG,MAAOiB,EAAejB,KACxB,EACMF,EAAOC,EAA8BoB,CAAA,EAC3CrB,OAAAA,EAAKsB,UAAUH,EAAeZ,MAA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,EACAG,MAAOL,CACT,CAAA,CACc,EAET,IACT,CAEO,IAAMM,EAAN,cAA+BC,CAAA,CACpC,OAAOC,MAAML,EAAsD,CACjE,OAAO,MAAMK,MAAML,CAAA,CACrB,CAEA,OAAOM,SAAkB,CACvB,OAAO,MAAMA,QAAA,CACf,CAEA,OAAOC,WAAqD,CAC1D,MAAO,CACLC,IAAMZ,GAEF,CAACA,EAAQa,aAAa,sCAAA,GACtB,CAACb,EAAQa,aAAa,8BAAA,EAEf,KAEF,CACLC,WAAYf,EACZgB,SAAU,CACZ,CAEJ,CACF,CAEA,OAAOC,WAAWC,EAA8D,CAC1EA,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,CAEAkB,SAASC,EAAuBC,EAAmC,CACjE,OACEC,EAAC/B,EAAA,CACCgC,UAAWF,EAAOG,MAAMC,cAAgB,mCACxCC,KAAM,KAAKC,OACXT,OAAQ,KAAKU,SACbC,QAAS,KAAKC,OAAM,GAG1B,CAEAC,YAAyC,CACvC,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 +0,0 @@
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 ye}from"react/jsx-runtime";import F,{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 we}from"@lexical/react/useLexicalNodeSelection";import{mergeRegister as ve}from"@lexical/utils";import{getTranslation as ie}from"@payloadcms/translations";import{Button as se,Drawer as $e,EditDepthProvider as Fe,Form as Ee,formatDrawerSlug as Oe,FormSubmit as Pe,RenderFields as Te,ShimmerEffect as Le,useDocumentInfo as Me,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{reduceFieldsToValues as Ve}from"payload/shared";import{v4 as We}from"uuid";import{jsx as Ce}from"react/jsx-runtime";import Be from"bson-objectid";import xe 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 Se=xe.lazy(()=>import("./componentInline-KDFOWBR5.js").then(s=>({default:s.InlineBlockComponent}))),v=class extends k{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return De(e.fields)}decorate(e,t){return Ce(Se,{cacheBuster:this.getCacheBuster(),formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function De(s){return new v({fields:{...s,id:s?.id||new Be.default().toHexString()}})}function K(s){return s instanceof v}var m="inline-block",ae=Ie({initialState:!1}),kt=()=>F.useContext(ae),_t=s=>{let{cacheBuster:e,formData:t,nodeKey:l}=s,[c]=Ne(),{i18n:E,t:f}=Ke(),{createdInlineBlock:Y,fieldProps:{featureClientSchemaMap:ue,initialLexicalFormState:de,permissions:me,readOnly:B,schemaPath:H},setCreatedInlineBlock:V,uuid:fe}=re(),{getFormState:x}=Re(),pe=Ae(),W=j(!1),[u,q]=F.useState(de?.[t.id]?.formState);C(()=>{q(!1)},[e]);let[O,G]=F.useState(u?._components?.customComponents?.BlockLabel),[Q,U]=F.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,S,T]=we(l),{id:D,collectionSlug:y,getDocPreferences:I,globalSlug:N}=Me(),be=`${H}.lexical_internal_feature.blocks.lexical_inline_blocks.${t.blockType}`,a=ue.blocks[be]?.[0]?.blocks?.[0];C(()=>{!W.current&&Y?.getKey()===l&&(a?.fields?.length>2&&b(),V?.(void 0),W.current=!0)},[a?.fields?.length,Y,l,V,b]);let Z=_(()=>{c.update(()=>{ce(l)?.remove()})},[c,l]),L=_(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?S(!d):d||(T(),S(!0)),!0):!1},[d,S,T]);C(()=>ve(c.registerCommand(ze,ee,z),c.registerCommand(He,L,z),c.registerCommand(Ye,L,z)),[T,c,d,l,L,S,ee]);let h=a?.labels?.singular?ie(a?.labels.singular,E):a?.slug,M=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 x({id:D,collectionSlug:y,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)}},[x,g,D,t,u,y,N,I]);let te=_(async({formState:n,submit:o})=>{J(M.current);let i=new AbortController;M.current=i;let{state:w}=await x({id:D,collectionSlug:y,docPermissions:{fields:!0},docPreferences:await I(),formState:n,globalSlug:N,operation:"update",renderAllFields:!!o,schemaPath:g,signal:i.signal});return w?(o&&(G(w._components?.customComponents?.BlockLabel),U(w._components?.customComponents?.Block)),w):n},[x,D,y,I,N,g]);C(()=>()=>{J(M.current)},[]);let he=_(n=>{let o=Ve(n);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,E):""}),[O,a?.labels,E]);return a?p(Ee,{beforeSubmit:[async({formState:n})=>await te({formState:n,submit:!0})],disableValidationOnSubmit:!0,fields:a?.fields,initialState:u||{},onChange:[te],onSubmit:n=>{he(n),b()},uuid:We(),children:[r(Fe,{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(ye,{children:[r(Te,{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(Le,{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{kt as a,_t as b,v as c,De as d,K as e};
2
- //# sourceMappingURL=chunk-XI5JV5QT.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/features/blocks/client/componentInline/index.tsx", "../../../src/features/blocks/client/nodes/InlineBlocksNode.tsx", "../../../src/features/blocks/server/nodes/InlineBlocksNode.tsx"],
4
- "sourcesContent": ["'use client'\n\nimport React, { createContext, useCallback, useEffect, useMemo, useRef } from 'react'\nconst baseClass = 'inline-block'\n\nimport type { BlocksFieldClient, 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'\nimport { reduceFieldsToValues } from 'payload/shared'\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) => {\n const newData: any = reduceFieldsToValues(formState)\n newData.blockType = formData.blockType\n editor.update(() => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n node.setFields(newData, 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) => {\n onFormSubmit(formState)\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 clone(node: ServerInlineBlockNode): ServerInlineBlockNode {\n return super.clone(node)\n }\n\n static getType(): string {\n return super.getType()\n }\n\n static importJSON(serializedNode: SerializedInlineBlockNode): InlineBlockNode {\n const node = $createInlineBlockNode(serializedNode.fields)\n return node\n }\n\n 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 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 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 getType(): string {\n return 'inlineBlock'\n }\n\n static importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {}\n }\n\n static 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 createDOM() {\n const element = document.createElement('span')\n element.classList.add('inline-block-container')\n\n return element\n }\n\n decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element | null {\n return null\n }\n\n exportDOM(): DOMExportOutput {\n const element = document.createElement('span')\n element.classList.add('inline-block-container')\n\n const text = document.createTextNode(this.getTextContent())\n element.append(text)\n return { element }\n }\n\n exportJSON(): SerializedInlineBlockNode {\n return {\n type: 'inlineBlock',\n fields: this.getFields(),\n version: 1,\n }\n }\n\n getCacheBuster(): number {\n return this.getLatest().__cacheBuster\n }\n\n getFields(): InlineBlockFields {\n return this.getLatest().__fields\n }\n\n getTextContent(): string {\n return `Block Field`\n }\n\n isInline() {\n return true\n }\n\n setFields(fields: InlineBlockFields, preventFormStateUpdate?: boolean): void {\n const writable = this.getWritable()\n writable.__fields = fields\n if (!preventFormStateUpdate) {\n writable.__cacheBuster++\n }\n }\n\n 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,iBAAAA,GACAC,wBAAAA,EACAC,yBAAAA,GACAC,sBAAAA,OACK,UACP,OAASC,wBAAAA,OAA4B,iBAIrC,OAASC,MAAMC,OAAY,gDCpC3B,OAAOC,OAAc,gBACrB,OAAOC,OAAyB,QCUhC,OAAOC,OAAc,gBACrB,OAASC,iBAAAA,OAAqB,UAgBvB,IAAMC,EAAN,cAAoCD,EAAA,CACzCE,cACAC,SAEAC,YAAY,CACVC,YAAAA,EACAC,OAAAA,EACAC,IAAAA,CAAG,EAKF,CACD,MAAMA,CAAA,EACN,KAAKJ,SAAWG,EAChB,KAAKJ,cAAgBG,GAAe,CACtC,CAEA,OAAOG,MAAMC,EAAoD,CAC/D,OAAO,IAAI,KAAK,CACdJ,YAAaI,EAAKP,cAClBI,OAAQG,EAAKN,SACbI,IAAKE,EAAKC,KACZ,CAAA,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,CAAIG,UAAW,GAAG7H,CAAA,qBACjB0H,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", "reduceFieldsToValues", "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", "reduceFieldsToValues", "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 +0,0 @@
1
- "use client";import{a,b}from"./chunk-XI5JV5QT.js";import"./chunk-INBEEENE.js";import"./chunk-3LGFOM34.js";export{b as InlineBlockComponent,a as useInlineBlockComponentContext};
2
- //# sourceMappingURL=componentInline-KDFOWBR5.js.map