@payloadcms/richtext-lexical 3.0.0-beta.127 → 3.0.0-beta.129

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 (237) hide show
  1. package/LICENSE.md +1 -1
  2. package/dist/cell/rscEntry.d.ts +12 -0
  3. package/dist/cell/rscEntry.d.ts.map +1 -0
  4. package/dist/cell/rscEntry.js +82 -0
  5. package/dist/cell/rscEntry.js.map +1 -0
  6. package/dist/exports/client/Field-SHUAQNQD.js +2 -0
  7. package/dist/exports/client/Field-SHUAQNQD.js.map +7 -0
  8. package/dist/exports/client/RelationshipComponent-IMM4CFBE.js +2 -0
  9. package/dist/exports/client/RelationshipComponent-IMM4CFBE.js.map +7 -0
  10. package/dist/exports/client/bundled.css +1 -1
  11. package/dist/exports/client/{chunk-NEO76RJK.js → chunk-352SHIZR.js} +2 -2
  12. package/dist/exports/client/chunk-75T7MDBH.js +2 -0
  13. package/dist/exports/client/chunk-75T7MDBH.js.map +7 -0
  14. package/dist/exports/client/{chunk-XY4TCSM7.js → chunk-O4IOO4EU.js} +2 -2
  15. package/dist/exports/client/chunk-OOBB5GCO.js +2 -0
  16. package/dist/exports/client/chunk-OOBB5GCO.js.map +7 -0
  17. package/dist/exports/client/chunk-PDAZFJVO.js +2 -0
  18. package/dist/exports/client/chunk-PDAZFJVO.js.map +7 -0
  19. package/dist/exports/client/{chunk-32KXGBIQ.js → chunk-ZOYGBIAN.js} +2 -2
  20. package/dist/exports/client/component-EHTN2BHZ.js +2 -0
  21. package/dist/exports/client/component-EHTN2BHZ.js.map +7 -0
  22. package/dist/exports/client/component-YE2TDR5O.js +2 -0
  23. package/dist/exports/client/component-YE2TDR5O.js.map +7 -0
  24. package/dist/exports/client/componentInline-N5LJ2LY2.js +2 -0
  25. package/dist/exports/client/componentInline-N5LJ2LY2.js.map +7 -0
  26. package/dist/exports/client/index.d.ts +0 -1
  27. package/dist/exports/client/index.d.ts.map +1 -1
  28. package/dist/exports/client/index.js +8 -8
  29. package/dist/exports/client/index.js.map +4 -4
  30. package/dist/exports/server/rsc.d.ts +3 -0
  31. package/dist/exports/server/rsc.d.ts.map +1 -0
  32. package/dist/exports/server/rsc.js +3 -0
  33. package/dist/exports/server/rsc.js.map +1 -0
  34. package/dist/features/blocks/client/component/BlockContent.d.ts +1 -0
  35. package/dist/features/blocks/client/component/BlockContent.d.ts.map +1 -1
  36. package/dist/features/blocks/client/component/BlockContent.js +15 -15
  37. package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
  38. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  39. package/dist/features/blocks/client/component/index.js +68 -52
  40. package/dist/features/blocks/client/component/index.js.map +1 -1
  41. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  42. package/dist/features/blocks/client/componentInline/index.js +14 -19
  43. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  44. package/dist/features/blocks/client/index.d.ts.map +1 -1
  45. package/dist/features/blocks/client/index.js +26 -24
  46. package/dist/features/blocks/client/index.js.map +1 -1
  47. package/dist/features/blocks/client/plugin/index.d.ts.map +1 -1
  48. package/dist/features/blocks/client/plugin/index.js +83 -75
  49. package/dist/features/blocks/client/plugin/index.js.map +1 -1
  50. package/dist/features/blocks/server/index.d.ts.map +1 -1
  51. package/dist/features/blocks/server/index.js +20 -10
  52. package/dist/features/blocks/server/index.js.map +1 -1
  53. package/dist/features/blocks/server/validate.d.ts.map +1 -1
  54. package/dist/features/blocks/server/validate.js +8 -5
  55. package/dist/features/blocks/server/validate.js.map +1 -1
  56. package/dist/features/debug/testRecorder/client/plugin/index.js +25 -14
  57. package/dist/features/debug/testRecorder/client/plugin/index.js.map +1 -1
  58. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js +19 -7
  59. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +1 -1
  60. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js +16 -3
  61. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js.map +1 -1
  62. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.d.ts.map +1 -1
  63. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js +58 -19
  64. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -1
  65. package/dist/features/experimental_table/client/plugins/TablePlugin/index.d.ts.map +1 -1
  66. package/dist/features/experimental_table/client/plugins/TablePlugin/index.js +38 -32
  67. package/dist/features/experimental_table/client/plugins/TablePlugin/index.js.map +1 -1
  68. package/dist/features/experimental_table/server/index.d.ts.map +1 -1
  69. package/dist/features/experimental_table/server/index.js +3 -1
  70. package/dist/features/experimental_table/server/index.js.map +1 -1
  71. package/dist/features/format/bold/feature.client.d.ts.map +1 -1
  72. package/dist/features/format/bold/feature.client.js +2 -1
  73. package/dist/features/format/bold/feature.client.js.map +1 -1
  74. package/dist/features/format/inlineCode/feature.client.d.ts.map +1 -1
  75. package/dist/features/format/inlineCode/feature.client.js +2 -1
  76. package/dist/features/format/inlineCode/feature.client.js.map +1 -1
  77. package/dist/features/format/italic/feature.client.d.ts.map +1 -1
  78. package/dist/features/format/italic/feature.client.js +2 -1
  79. package/dist/features/format/italic/feature.client.js.map +1 -1
  80. package/dist/features/format/strikethrough/feature.client.d.ts.map +1 -1
  81. package/dist/features/format/strikethrough/feature.client.js +2 -1
  82. package/dist/features/format/strikethrough/feature.client.js.map +1 -1
  83. package/dist/features/format/subscript/feature.client.d.ts.map +1 -1
  84. package/dist/features/format/subscript/feature.client.js +2 -1
  85. package/dist/features/format/subscript/feature.client.js.map +1 -1
  86. package/dist/features/format/superscript/feature.client.d.ts.map +1 -1
  87. package/dist/features/format/superscript/feature.client.js +2 -1
  88. package/dist/features/format/superscript/feature.client.js.map +1 -1
  89. package/dist/features/format/underline/feature.client.d.ts.map +1 -1
  90. package/dist/features/format/underline/feature.client.js +2 -1
  91. package/dist/features/format/underline/feature.client.js.map +1 -1
  92. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
  93. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +52 -15
  94. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  95. package/dist/features/link/client/plugins/floatingLinkEditor/index.js +1 -1
  96. package/dist/features/link/client/plugins/floatingLinkEditor/index.js.map +1 -1
  97. package/dist/features/link/server/i18n.d.ts.map +1 -1
  98. package/dist/features/link/server/i18n.js +64 -32
  99. package/dist/features/link/server/i18n.js.map +1 -1
  100. package/dist/features/link/server/index.d.ts.map +1 -1
  101. package/dist/features/link/server/index.js +3 -1
  102. package/dist/features/link/server/index.js.map +1 -1
  103. package/dist/features/link/server/validate.d.ts.map +1 -1
  104. package/dist/features/link/server/validate.js +8 -5
  105. package/dist/features/link/server/validate.js.map +1 -1
  106. package/dist/features/relationship/client/components/RelationshipComponent.d.ts.map +1 -1
  107. package/dist/features/relationship/client/components/RelationshipComponent.js +6 -4
  108. package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
  109. package/dist/features/toolbars/fixed/client/Toolbar/index.d.ts.map +1 -1
  110. package/dist/features/toolbars/fixed/client/Toolbar/index.js +77 -49
  111. package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
  112. package/dist/features/toolbars/inline/client/Toolbar/index.js +93 -52
  113. package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
  114. package/dist/features/toolbars/shared/ToolbarButton/index.js +1 -1
  115. package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
  116. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +2 -2
  117. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
  118. package/dist/features/toolbars/shared/ToolbarDropdown/index.d.ts.map +1 -1
  119. package/dist/features/toolbars/shared/ToolbarDropdown/index.js +25 -22
  120. package/dist/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
  121. package/dist/features/toolbars/types.d.ts +3 -1
  122. package/dist/features/toolbars/types.d.ts.map +1 -1
  123. package/dist/features/toolbars/types.js.map +1 -1
  124. package/dist/features/typesServer.d.ts +4 -17
  125. package/dist/features/typesServer.d.ts.map +1 -1
  126. package/dist/features/typesServer.js.map +1 -1
  127. package/dist/features/upload/client/component/index.d.ts.map +1 -1
  128. package/dist/features/upload/client/component/index.js +8 -4
  129. package/dist/features/upload/client/component/index.js.map +1 -1
  130. package/dist/features/upload/server/feature.server.d.ts.map +1 -1
  131. package/dist/features/upload/server/feature.server.js +3 -1
  132. package/dist/features/upload/server/feature.server.js.map +1 -1
  133. package/dist/features/upload/server/validate.d.ts.map +1 -1
  134. package/dist/features/upload/server/validate.js +7 -4
  135. package/dist/features/upload/server/validate.js.map +1 -1
  136. package/dist/field/Field.d.ts.map +1 -1
  137. package/dist/field/Field.js +27 -41
  138. package/dist/field/Field.js.map +1 -1
  139. package/dist/field/bundled.css +1 -1
  140. package/dist/field/index.d.ts.map +1 -1
  141. package/dist/field/index.js +26 -27
  142. package/dist/field/index.js.map +1 -1
  143. package/dist/field/rscEntry.d.ts +9 -0
  144. package/dist/field/rscEntry.d.ts.map +1 -0
  145. package/dist/field/rscEntry.js +37 -0
  146. package/dist/field/rscEntry.js.map +1 -0
  147. package/dist/index.d.ts.map +1 -1
  148. package/dist/index.js +8 -14
  149. package/dist/index.js.map +1 -1
  150. package/dist/lexical/LexicalProvider.d.ts +1 -1
  151. package/dist/lexical/LexicalProvider.d.ts.map +1 -1
  152. package/dist/lexical/LexicalProvider.js +2 -2
  153. package/dist/lexical/LexicalProvider.js.map +1 -1
  154. package/dist/lexical/config/client/EditorConfigProvider.d.ts +4 -3
  155. package/dist/lexical/config/client/EditorConfigProvider.d.ts.map +1 -1
  156. package/dist/lexical/config/client/EditorConfigProvider.js +5 -5
  157. package/dist/lexical/config/client/EditorConfigProvider.js.map +1 -1
  158. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts +4 -4
  159. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts.map +1 -1
  160. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +14 -5
  161. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
  162. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.d.ts +2 -2
  163. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.d.ts.map +1 -1
  164. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js +5 -5
  165. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js.map +1 -1
  166. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts +3 -2
  167. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts.map +1 -1
  168. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js.map +1 -1
  169. package/dist/lexical/plugins/SlashMenu/index.d.ts.map +1 -1
  170. package/dist/lexical/plugins/SlashMenu/index.js +15 -24
  171. package/dist/lexical/plugins/SlashMenu/index.js.map +1 -1
  172. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js +6 -4
  173. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
  174. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +6 -4
  175. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  176. package/dist/lexical/theme/EditorTheme.d.ts.map +1 -1
  177. package/dist/lexical/theme/EditorTheme.js +0 -2
  178. package/dist/lexical/theme/EditorTheme.js.map +1 -1
  179. package/dist/types.d.ts +15 -2
  180. package/dist/types.d.ts.map +1 -1
  181. package/dist/types.js.map +1 -1
  182. package/dist/utilities/fieldsDrawer/Drawer.d.ts +1 -0
  183. package/dist/utilities/fieldsDrawer/Drawer.d.ts.map +1 -1
  184. package/dist/utilities/fieldsDrawer/Drawer.js +25 -20
  185. package/dist/utilities/fieldsDrawer/Drawer.js.map +1 -1
  186. package/dist/utilities/fieldsDrawer/DrawerContent.d.ts.map +1 -1
  187. package/dist/utilities/fieldsDrawer/DrawerContent.js +99 -143
  188. package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
  189. package/dist/utilities/fieldsDrawer/useLexicalDrawer.js +1 -1
  190. package/dist/utilities/fieldsDrawer/useLexicalDrawer.js.map +1 -1
  191. package/dist/utilities/generateImportMap.d.ts.map +1 -1
  192. package/dist/utilities/generateImportMap.js +2 -3
  193. package/dist/utilities/generateImportMap.js.map +1 -1
  194. package/dist/utilities/generateSchemaMap.d.ts.map +1 -1
  195. package/dist/utilities/generateSchemaMap.js +13 -10
  196. package/dist/utilities/generateSchemaMap.js.map +1 -1
  197. package/dist/utilities/initLexicalFeatures.d.ts +18 -0
  198. package/dist/utilities/initLexicalFeatures.d.ts.map +1 -0
  199. package/dist/utilities/initLexicalFeatures.js +95 -0
  200. package/dist/utilities/initLexicalFeatures.js.map +1 -0
  201. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.d.ts.map +1 -1
  202. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js +5 -1
  203. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js.map +1 -1
  204. package/dist/utilities/useLexicalFeature.d.ts.map +1 -1
  205. package/dist/utilities/useLexicalFeature.js +12 -4
  206. package/dist/utilities/useLexicalFeature.js.map +1 -1
  207. package/dist/validate/index.d.ts.map +1 -1
  208. package/dist/validate/index.js +1 -1
  209. package/dist/validate/index.js.map +1 -1
  210. package/package.json +43 -35
  211. package/dist/cell/index.d.ts +0 -9
  212. package/dist/cell/index.d.ts.map +0 -1
  213. package/dist/cell/index.js +0 -120
  214. package/dist/cell/index.js.map +0 -1
  215. package/dist/exports/client/Field-Y47DV2NP.js +0 -2
  216. package/dist/exports/client/Field-Y47DV2NP.js.map +0 -7
  217. package/dist/exports/client/RelationshipComponent-LBWKOBGF.js +0 -2
  218. package/dist/exports/client/RelationshipComponent-LBWKOBGF.js.map +0 -7
  219. package/dist/exports/client/chunk-7SR2HYD6.js +0 -2
  220. package/dist/exports/client/chunk-7SR2HYD6.js.map +0 -7
  221. package/dist/exports/client/chunk-GD6LBQBJ.js +0 -2
  222. package/dist/exports/client/chunk-GD6LBQBJ.js.map +0 -7
  223. package/dist/exports/client/chunk-IIWHHN4J.js +0 -2
  224. package/dist/exports/client/chunk-IIWHHN4J.js.map +0 -7
  225. package/dist/exports/client/component-4TP4L5EV.js +0 -2
  226. package/dist/exports/client/component-4TP4L5EV.js.map +0 -7
  227. package/dist/exports/client/component-XMR5NN36.js +0 -2
  228. package/dist/exports/client/component-XMR5NN36.js.map +0 -7
  229. package/dist/exports/client/componentInline-NUDJIIQ4.js +0 -2
  230. package/dist/exports/client/componentInline-NUDJIIQ4.js.map +0 -7
  231. package/dist/utilities/generateComponentMap.d.ts +0 -6
  232. package/dist/utilities/generateComponentMap.d.ts.map +0 -1
  233. package/dist/utilities/generateComponentMap.js +0 -93
  234. package/dist/utilities/generateComponentMap.js.map +0 -1
  235. /package/dist/exports/client/{chunk-NEO76RJK.js.map → chunk-352SHIZR.js.map} +0 -0
  236. /package/dist/exports/client/{chunk-XY4TCSM7.js.map → chunk-O4IOO4EU.js.map} +0 -0
  237. /package/dist/exports/client/{chunk-32KXGBIQ.js.map → chunk-ZOYGBIAN.js.map} +0 -0
@@ -34,7 +34,7 @@ export function DropDownItem({
34
34
  className: className,
35
35
  onClick: () => {
36
36
  if (enabled !== false) {
37
- editor._updateTags = new Set([...editor._updateTags, 'toolbar']) // without setting the tags, our onSelect will not be able to trigger our onChange as focus onChanges are ignored.
37
+ editor._updateTags = new Set(['toolbar', ...editor._updateTags]) // without setting the tags, our onSelect will not be able to trigger our onChange as focus onChanges are ignored.
38
38
  ;
39
39
  editor.focus(() => {
40
40
  // We need to wrap the onSelect in the callback, so the editor is properly focused before the onSelect is called.
@@ -171,7 +171,7 @@ export function DropDown({
171
171
  };
172
172
  }
173
173
  }, [dropDownRef, buttonRef, showDropDown, stopCloseOnClickSelf]);
174
- const portal = /*#__PURE__*/createPortal( /*#__PURE__*/_jsx(DropDownItems, {
174
+ const portal = /*#__PURE__*/createPortal(/*#__PURE__*/_jsx(DropDownItems, {
175
175
  dropDownRef: dropDownRef,
176
176
  itemsContainerClassNames: itemsContainerClassNames,
177
177
  onClose: handleClose,
@@ -1 +1 @@
1
- {"version":3,"file":"DropDown.js","names":["React","useCallback","useEffect","useMemo","useRef","useState","createPortal","baseClass","DropDownContext","createContext","DropDownItem","active","children","editor","enabled","item","title","className","setClassName","key","filter","Boolean","join","ref","dropDownContext","useContext","Error","registerItem","current","_jsx","onClick","_updateTags","Set","focus","onSelect","isActive","onMouseDown","e","preventDefault","type","DropDownItems","dropDownRef","itemsContainerClassNames","onClose","items","setItems","highlightedItem","setHighlightedItem","itemRef","prev","handleKeyDown","event","includes","index","indexOf","length","contextValue","Provider","value","onKeyDown","DropDown","buttonAriaLabel","buttonClassName","disabled","Icon","label","stopCloseOnClickSelf","buttonRef","showDropDown","setShowDropDown","handleClose","button","dropDown","left","top","getBoundingClientRect","scrollTopOffset","window","scrollY","document","documentElement","scrollTop","style","offsetHeight","Math","min","innerWidth","offsetWidth","handle","target","contains","addEventListener","removeEventListener","portal","body","_jsxs","Fragment"],"sources":["../../../../../src/features/toolbars/shared/ToolbarDropdown/DropDown.tsx"],"sourcesContent":["'use client'\nimport type { LexicalEditor } from 'lexical'\n\nimport React, { type ReactNode, useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport type { ToolbarGroupItem } from '../../types.js'\n\nconst baseClass = 'toolbar-popup__dropdown-item'\n\ninterface DropDownContextType {\n registerItem: (ref: React.RefObject<HTMLButtonElement | null>) => void\n}\n\nconst DropDownContext = React.createContext<DropDownContextType | null>(null)\n\nexport function DropDownItem({\n active,\n children,\n editor,\n enabled,\n item,\n title,\n}: {\n active?: boolean\n children: React.ReactNode\n editor: LexicalEditor\n enabled?: boolean\n item: ToolbarGroupItem\n title?: string\n}): React.ReactNode {\n const [className, setClassName] = useState<string>(baseClass)\n\n useEffect(() => {\n setClassName(\n [\n baseClass,\n enabled === false ? 'disabled' : '',\n active ? 'active' : '',\n item?.key ? `${baseClass}-${item.key}` : '',\n ]\n .filter(Boolean)\n .join(' '),\n )\n }, [enabled, active, className, item.key])\n\n const ref = useRef<HTMLButtonElement>(null)\n\n const dropDownContext = React.useContext(DropDownContext)\n\n if (dropDownContext === null) {\n throw new Error('DropDownItem must be used within a DropDown')\n }\n\n const { registerItem } = dropDownContext\n\n useEffect(() => {\n if (ref?.current != null) {\n registerItem(ref)\n }\n }, [ref, registerItem])\n\n return (\n <button\n className={className}\n onClick={() => {\n if (enabled !== false) {\n editor._updateTags = new Set([...editor._updateTags, 'toolbar']) // without setting the tags, our onSelect will not be able to trigger our onChange as focus onChanges are ignored.\n\n editor.focus(() => {\n // We need to wrap the onSelect in the callback, so the editor is properly focused before the onSelect is called.\n item.onSelect?.({\n editor,\n isActive: active!,\n })\n })\n }\n }}\n onMouseDown={(e) => {\n // This is required for Firefox compatibility. Without it, the dropdown will disappear without the onClick being called.\n // This only happens in Firefox. Must be something about how Firefox handles focus events differently.\n e.preventDefault()\n }}\n ref={ref}\n title={title}\n type=\"button\"\n >\n {children}\n </button>\n )\n}\n\nfunction DropDownItems({\n children,\n dropDownRef,\n itemsContainerClassNames,\n onClose,\n}: {\n children: React.ReactNode\n dropDownRef: React.Ref<HTMLDivElement>\n itemsContainerClassNames?: string[]\n onClose: () => void\n}): React.ReactElement {\n const [items, setItems] = useState<Array<React.RefObject<HTMLButtonElement | null>>>()\n const [highlightedItem, setHighlightedItem] =\n useState<React.RefObject<HTMLButtonElement | null>>()\n\n const registerItem = useCallback(\n (itemRef: React.RefObject<HTMLButtonElement | null>) => {\n setItems((prev) => (prev != null ? [...prev, itemRef] : [itemRef]))\n },\n [setItems],\n )\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>): void => {\n if (items == null) {\n return\n }\n\n const { key } = event\n\n if (['ArrowDown', 'ArrowUp', 'Escape', 'Tab'].includes(key)) {\n event.preventDefault()\n }\n\n if (key === 'Escape' || key === 'Tab') {\n onClose()\n } else if (key === 'ArrowUp') {\n setHighlightedItem((prev) => {\n if (prev == null) {\n return items[0]\n }\n const index = items.indexOf(prev) - 1\n return items[index === -1 ? items.length - 1 : index]\n })\n } else if (key === 'ArrowDown') {\n setHighlightedItem((prev) => {\n if (prev == null) {\n return items[0]\n }\n return items[items.indexOf(prev) + 1]\n })\n }\n }\n\n const contextValue = useMemo(\n () => ({\n registerItem,\n }),\n [registerItem],\n )\n\n useEffect(() => {\n if (items != null && highlightedItem == null) {\n setHighlightedItem(items[0])\n }\n\n if (highlightedItem != null && highlightedItem?.current != null) {\n highlightedItem.current.focus()\n }\n }, [items, highlightedItem])\n\n return (\n <DropDownContext.Provider value={contextValue}>\n <div\n className={(itemsContainerClassNames ?? ['toolbar-popup__dropdown-items']).join(' ')}\n onKeyDown={handleKeyDown}\n ref={dropDownRef}\n >\n {children}\n </div>\n </DropDownContext.Provider>\n )\n}\n\nexport function DropDown({\n buttonAriaLabel,\n buttonClassName,\n children,\n disabled = false,\n Icon,\n itemsContainerClassNames,\n label,\n stopCloseOnClickSelf,\n}: {\n buttonAriaLabel?: string\n buttonClassName: string\n children: ReactNode\n disabled?: boolean\n Icon?: React.FC\n itemsContainerClassNames?: string[]\n label?: string\n stopCloseOnClickSelf?: boolean\n}): React.ReactNode {\n const dropDownRef = useRef<HTMLDivElement>(null)\n const buttonRef = useRef<HTMLButtonElement>(null)\n const [showDropDown, setShowDropDown] = useState(false)\n\n const handleClose = (): void => {\n setShowDropDown(false)\n if (buttonRef?.current != null) {\n buttonRef.current.focus()\n }\n }\n\n useEffect(() => {\n const button = buttonRef.current\n const dropDown = dropDownRef.current\n\n if (showDropDown && button !== null && dropDown !== null) {\n const { left, top } = button.getBoundingClientRect()\n const scrollTopOffset = window.scrollY || document.documentElement.scrollTop\n dropDown.style.top = `${top + scrollTopOffset + button.offsetHeight + 5}px`\n dropDown.style.left = `${Math.min(left - 5, window.innerWidth - dropDown.offsetWidth - 20)}px`\n }\n }, [dropDownRef, buttonRef, showDropDown])\n\n useEffect(() => {\n const button = buttonRef.current\n\n if (button !== null && showDropDown) {\n const handle = (event: MouseEvent): void => {\n const { target } = event\n if (stopCloseOnClickSelf != null) {\n if (dropDownRef.current != null && dropDownRef.current.contains(target as Node)) {\n return\n }\n }\n if (!button.contains(target as Node)) {\n setShowDropDown(false)\n }\n }\n document.addEventListener('click', handle)\n\n return () => {\n document.removeEventListener('click', handle)\n }\n }\n }, [dropDownRef, buttonRef, showDropDown, stopCloseOnClickSelf])\n\n const portal = createPortal(\n <DropDownItems\n dropDownRef={dropDownRef}\n itemsContainerClassNames={itemsContainerClassNames}\n onClose={handleClose}\n >\n {children}\n </DropDownItems>,\n document.body,\n )\n\n return (\n <React.Fragment>\n <button\n aria-label={buttonAriaLabel}\n className={buttonClassName + (showDropDown ? ' active' : '')}\n disabled={disabled}\n onClick={(event) => {\n event.preventDefault()\n setShowDropDown(!showDropDown)\n }}\n onMouseDown={(e) => {\n // This fixes a bug where you are unable to click the button if you are in a NESTED editor (editor in blocks field in editor).\n // Thus only happens if you click on the SVG of the button. Clicking on the outside works. Related issue: https://github.com/payloadcms/payload/issues/4025\n // TODO: Find out why exactly it happens and why e.preventDefault() on the mouseDown fixes it. Write that down here, or potentially fix a root cause, if there is any.\n e.preventDefault()\n }}\n ref={buttonRef}\n type=\"button\"\n >\n {Icon && <Icon />}\n {label && <span className=\"toolbar-popup__dropdown-label\">{label}</span>}\n <i className=\"toolbar-popup__dropdown-caret\" />\n </button>\n\n {showDropDown && <React.Fragment>{portal}</React.Fragment>}\n </React.Fragment>\n )\n}\n"],"mappings":"AAAA;;;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CAACD,MAAA,GAAiB;UACpCpB,eAAA,CAAgB;QAClB;MACF;MACAU,QAAA,CAASY,gBAAgB,CAAC,SAASH,MAAA;MAEnC,OAAO;QACLT,QAAA,CAASa,mBAAmB,CAAC,SAASJ,MAAA;MACxC;IACF;EACF,GAAG,CAAC/C,WAAA,EAAa0B,SAAA,EAAWC,YAAA,EAAcF,oBAAA,CAAqB;EAE/D,MAAM2B,MAAA,gBAASvF,YAAA,eACbuB,IAAA,CAACW,aAAA;IACCC,WAAA,EAAaA,WAAA;IACbC,wBAAA,EAA0BA,wBAAA;IAC1BC,OAAA,EAAS2B,WAAA;cAER1D;MAEHmE,QAAA,CAASe,IAAI;EAGf,oBACEC,KAAA,CAAC/F,KAAA,CAAMgG,QAAQ;4BACbD,KAAA,CAAC;MACC,cAAYlC,eAAA;MACZ5C,SAAA,EAAW6C,eAAA,IAAmBM,YAAA,GAAe,YAAY,EAAC;MAC1DL,QAAA,EAAUA,QAAA;MACVjC,OAAA,EAAUqB,OAAA;QACRA,OAAA,CAAMb,cAAc;QACpB+B,eAAA,CAAgB,CAACD,YAAA;MACnB;MACAhC,WAAA,EAAcC,CAAA;QACZ;QACA;QACA;QACAA,CAAA,CAAEC,cAAc;MAClB;MACAf,GAAA,EAAK4C,SAAA;MACL5B,IAAA,EAAK;iBAEJyB,IAAA,iBAAQnC,IAAA,CAACmC,IAAA,OACTC,KAAA,iBAASpC,IAAA,CAAC;QAAKZ,SAAA,EAAU;kBAAiCgD;uBAC3DpC,IAAA,CAAC;QAAEZ,SAAA,EAAU;;QAGdmD,YAAA,iBAAgBvC,IAAA,CAAC7B,KAAA,CAAMgG,QAAQ;gBAAEH;;;AAGxC","ignoreList":[]}
1
+ {"version":3,"file":"DropDown.js","names":["React","useCallback","useEffect","useMemo","useRef","useState","createPortal","baseClass","DropDownContext","createContext","DropDownItem","active","children","editor","enabled","item","title","className","setClassName","key","filter","Boolean","join","ref","dropDownContext","useContext","Error","registerItem","current","_jsx","onClick","_updateTags","Set","focus","onSelect","isActive","onMouseDown","e","preventDefault","type","DropDownItems","dropDownRef","itemsContainerClassNames","onClose","items","setItems","highlightedItem","setHighlightedItem","itemRef","prev","handleKeyDown","event","includes","index","indexOf","length","contextValue","Provider","value","onKeyDown","DropDown","buttonAriaLabel","buttonClassName","disabled","Icon","label","stopCloseOnClickSelf","buttonRef","showDropDown","setShowDropDown","handleClose","button","dropDown","left","top","getBoundingClientRect","scrollTopOffset","window","scrollY","document","documentElement","scrollTop","style","offsetHeight","Math","min","innerWidth","offsetWidth","handle","target","contains","addEventListener","removeEventListener","portal","body","_jsxs","Fragment"],"sources":["../../../../../src/features/toolbars/shared/ToolbarDropdown/DropDown.tsx"],"sourcesContent":["'use client'\nimport type { LexicalEditor } from 'lexical'\n\nimport React, { type ReactNode, useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport type { ToolbarGroupItem } from '../../types.js'\n\nconst baseClass = 'toolbar-popup__dropdown-item'\n\ninterface DropDownContextType {\n registerItem: (ref: React.RefObject<HTMLButtonElement | null>) => void\n}\n\nconst DropDownContext = React.createContext<DropDownContextType | null>(null)\n\nexport function DropDownItem({\n active,\n children,\n editor,\n enabled,\n item,\n title,\n}: {\n active?: boolean\n children: React.ReactNode\n editor: LexicalEditor\n enabled?: boolean\n item: ToolbarGroupItem\n title?: string\n}): React.ReactNode {\n const [className, setClassName] = useState<string>(baseClass)\n\n useEffect(() => {\n setClassName(\n [\n baseClass,\n enabled === false ? 'disabled' : '',\n active ? 'active' : '',\n item?.key ? `${baseClass}-${item.key}` : '',\n ]\n .filter(Boolean)\n .join(' '),\n )\n }, [enabled, active, className, item.key])\n\n const ref = useRef<HTMLButtonElement>(null)\n\n const dropDownContext = React.useContext(DropDownContext)\n\n if (dropDownContext === null) {\n throw new Error('DropDownItem must be used within a DropDown')\n }\n\n const { registerItem } = dropDownContext\n\n useEffect(() => {\n if (ref?.current != null) {\n registerItem(ref)\n }\n }, [ref, registerItem])\n\n return (\n <button\n className={className}\n onClick={() => {\n if (enabled !== false) {\n editor._updateTags = new Set(['toolbar', ...editor._updateTags]) // without setting the tags, our onSelect will not be able to trigger our onChange as focus onChanges are ignored.\n\n editor.focus(() => {\n // We need to wrap the onSelect in the callback, so the editor is properly focused before the onSelect is called.\n item.onSelect?.({\n editor,\n isActive: active!,\n })\n })\n }\n }}\n onMouseDown={(e) => {\n // This is required for Firefox compatibility. Without it, the dropdown will disappear without the onClick being called.\n // This only happens in Firefox. Must be something about how Firefox handles focus events differently.\n e.preventDefault()\n }}\n ref={ref}\n title={title}\n type=\"button\"\n >\n {children}\n </button>\n )\n}\n\nfunction DropDownItems({\n children,\n dropDownRef,\n itemsContainerClassNames,\n onClose,\n}: {\n children: React.ReactNode\n dropDownRef: React.Ref<HTMLDivElement>\n itemsContainerClassNames?: string[]\n onClose: () => void\n}): React.ReactElement {\n const [items, setItems] = useState<Array<React.RefObject<HTMLButtonElement | null>>>()\n const [highlightedItem, setHighlightedItem] =\n useState<React.RefObject<HTMLButtonElement | null>>()\n\n const registerItem = useCallback(\n (itemRef: React.RefObject<HTMLButtonElement | null>) => {\n setItems((prev) => (prev != null ? [...prev, itemRef] : [itemRef]))\n },\n [setItems],\n )\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>): void => {\n if (items == null) {\n return\n }\n\n const { key } = event\n\n if (['ArrowDown', 'ArrowUp', 'Escape', 'Tab'].includes(key)) {\n event.preventDefault()\n }\n\n if (key === 'Escape' || key === 'Tab') {\n onClose()\n } else if (key === 'ArrowUp') {\n setHighlightedItem((prev) => {\n if (prev == null) {\n return items[0]\n }\n const index = items.indexOf(prev) - 1\n return items[index === -1 ? items.length - 1 : index]\n })\n } else if (key === 'ArrowDown') {\n setHighlightedItem((prev) => {\n if (prev == null) {\n return items[0]\n }\n return items[items.indexOf(prev) + 1]\n })\n }\n }\n\n const contextValue = useMemo(\n () => ({\n registerItem,\n }),\n [registerItem],\n )\n\n useEffect(() => {\n if (items != null && highlightedItem == null) {\n setHighlightedItem(items[0])\n }\n\n if (highlightedItem != null && highlightedItem?.current != null) {\n highlightedItem.current.focus()\n }\n }, [items, highlightedItem])\n\n return (\n <DropDownContext.Provider value={contextValue}>\n <div\n className={(itemsContainerClassNames ?? ['toolbar-popup__dropdown-items']).join(' ')}\n onKeyDown={handleKeyDown}\n ref={dropDownRef}\n >\n {children}\n </div>\n </DropDownContext.Provider>\n )\n}\n\nexport function DropDown({\n buttonAriaLabel,\n buttonClassName,\n children,\n disabled = false,\n Icon,\n itemsContainerClassNames,\n label,\n stopCloseOnClickSelf,\n}: {\n buttonAriaLabel?: string\n buttonClassName: string\n children: ReactNode\n disabled?: boolean\n Icon?: React.FC\n itemsContainerClassNames?: string[]\n label?: string\n stopCloseOnClickSelf?: boolean\n}): React.ReactNode {\n const dropDownRef = useRef<HTMLDivElement>(null)\n const buttonRef = useRef<HTMLButtonElement>(null)\n const [showDropDown, setShowDropDown] = useState(false)\n\n const handleClose = (): void => {\n setShowDropDown(false)\n if (buttonRef?.current != null) {\n buttonRef.current.focus()\n }\n }\n\n useEffect(() => {\n const button = buttonRef.current\n const dropDown = dropDownRef.current\n\n if (showDropDown && button !== null && dropDown !== null) {\n const { left, top } = button.getBoundingClientRect()\n const scrollTopOffset = window.scrollY || document.documentElement.scrollTop\n dropDown.style.top = `${top + scrollTopOffset + button.offsetHeight + 5}px`\n dropDown.style.left = `${Math.min(left - 5, window.innerWidth - dropDown.offsetWidth - 20)}px`\n }\n }, [dropDownRef, buttonRef, showDropDown])\n\n useEffect(() => {\n const button = buttonRef.current\n\n if (button !== null && showDropDown) {\n const handle = (event: MouseEvent): void => {\n const { target } = event\n if (stopCloseOnClickSelf != null) {\n if (dropDownRef.current != null && dropDownRef.current.contains(target as Node)) {\n return\n }\n }\n if (!button.contains(target as Node)) {\n setShowDropDown(false)\n }\n }\n document.addEventListener('click', handle)\n\n return () => {\n document.removeEventListener('click', handle)\n }\n }\n }, [dropDownRef, buttonRef, showDropDown, stopCloseOnClickSelf])\n\n const portal = createPortal(\n <DropDownItems\n dropDownRef={dropDownRef}\n itemsContainerClassNames={itemsContainerClassNames}\n onClose={handleClose}\n >\n {children}\n </DropDownItems>,\n document.body,\n )\n\n return (\n <React.Fragment>\n <button\n aria-label={buttonAriaLabel}\n className={buttonClassName + (showDropDown ? ' active' : '')}\n disabled={disabled}\n onClick={(event) => {\n event.preventDefault()\n setShowDropDown(!showDropDown)\n }}\n onMouseDown={(e) => {\n // This fixes a bug where you are unable to click the button if you are in a NESTED editor (editor in blocks field in editor).\n // Thus only happens if you click on the SVG of the button. Clicking on the outside works. Related issue: https://github.com/payloadcms/payload/issues/4025\n // TODO: Find out why exactly it happens and why e.preventDefault() on the mouseDown fixes it. Write that down here, or potentially fix a root cause, if there is any.\n e.preventDefault()\n }}\n ref={buttonRef}\n type=\"button\"\n >\n {Icon && <Icon />}\n {label && <span className=\"toolbar-popup__dropdown-label\">{label}</span>}\n <i className=\"toolbar-popup__dropdown-caret\" />\n </button>\n\n {showDropDown && <React.Fragment>{portal}</React.Fragment>}\n </React.Fragment>\n )\n}\n"],"mappings":"AAAA;;;AAGA,OAAOA,KAAA,IAAyBC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ;AACzF,SAASC,YAAY,QAAQ;AAI7B,MAAMC,SAAA,GAAY;AAMlB,MAAMC,eAAA,gBAAkBR,KAAA,CAAMS,aAAa,CAA6B;AAExE,OAAO,SAASC,aAAa;EAC3BC,MAAM;EACNC,QAAQ;EACRC,MAAM;EACNC,OAAO;EACPC,IAAI;EACJC;AAAK,CAQN;EACC,MAAM,CAACC,SAAA,EAAWC,YAAA,CAAa,GAAGb,QAAA,CAAiBE,SAAA;EAEnDL,SAAA,CAAU;IACRgB,YAAA,CACE,CACEX,SAAA,EACAO,OAAA,KAAY,QAAQ,aAAa,IACjCH,MAAA,GAAS,WAAW,IACpBI,IAAA,EAAMI,GAAA,GAAM,GAAGZ,SAA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eAAA,IAAmBM,YAAA,GAAe,YAAY,EAAC;MAC1DL,QAAA,EAAUA,QAAA;MACVjC,OAAA,EAAUqB,OAAA;QACRA,OAAA,CAAMb,cAAc;QACpB+B,eAAA,CAAgB,CAACD,YAAA;MACnB;MACAhC,WAAA,EAAcC,CAAA;QACZ;QACA;QACA;QACAA,CAAA,CAAEC,cAAc;MAClB;MACAf,GAAA,EAAK4C,SAAA;MACL5B,IAAA,EAAK;iBAEJyB,IAAA,iBAAQnC,IAAA,CAACmC,IAAA,OACTC,KAAA,iBAASpC,IAAA,CAAC;QAAKZ,SAAA,EAAU;kBAAiCgD;uBAC3DpC,IAAA,CAAC;QAAEZ,SAAA,EAAU;;QAGdmD,YAAA,iBAAgBvC,IAAA,CAAC7B,KAAA,CAAMgG,QAAQ;gBAAEH;;;AAGxC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/toolbars/shared/ToolbarDropdown/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAiC,MAAM,OAAO,CAAA;AAIrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAM5C,OAAO,KAAK,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAI5E,OAAO,cAAc,CAAA;AAqDrB,eAAO,MAAM,eAAe,sHAUzB;IACD,UAAU,EAAE,WAAW,CAAA;IACvB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,MAAM,EAAE,aAAa,CAAA;IACrB,KAAK,EAAE,oBAAoB,CAAA;IAC3B,IAAI,CAAC,EAAE,KAAK,CAAC,EAAE,CAAA;IACf,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAA;IACnC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,cAAc,CAAC,EAAE,CAAC,EAAE,WAAW,EAAE,EAAE;QAAE,WAAW,EAAE,gBAAgB,EAAE,CAAA;KAAE,KAAK,IAAI,CAAA;CAChF,sBAsFA,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/toolbars/shared/ToolbarDropdown/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAiC,MAAM,OAAO,CAAA;AAIrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAM5C,OAAO,KAAK,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAI5E,OAAO,cAAc,CAAA;AAuDrB,eAAO,MAAM,eAAe,sHAUzB;IACD,UAAU,EAAE,WAAW,CAAA;IACvB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,MAAM,EAAE,aAAa,CAAA;IACrB,KAAK,EAAE,oBAAoB,CAAA;IAC3B,IAAI,CAAC,EAAE,KAAK,CAAC,EAAE,CAAA;IACf,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAA;IACnC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,cAAc,CAAC,EAAE,CAAC,EAAE,WAAW,EAAE,EAAE;QAAE,WAAW,EAAE,gBAAgB,EAAE,CAAA;KAAE,KAAK,IAAI,CAAA;CAChF,sBAsFA,CAAA"}
@@ -10,7 +10,7 @@ import { $getSelection } from 'lexical';
10
10
  import { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js';
11
11
  import { DropDown, DropDownItem } from './DropDown.js';
12
12
  const ToolbarItem = t0 => {
13
- const $ = _c(19);
13
+ const $ = _c(20);
14
14
  const {
15
15
  active,
16
16
  anchorElem,
@@ -22,10 +22,11 @@ const ToolbarItem = t0 => {
22
22
  i18n
23
23
  } = useTranslation();
24
24
  const {
25
- field: t1
25
+ fieldProps: t1
26
26
  } = useEditorConfigContext();
27
27
  const {
28
- richTextComponentMap
28
+ featureClientSchemaMap,
29
+ schemaPath
29
30
  } = t1;
30
31
  if (item.Component) {
31
32
  let t2;
@@ -51,17 +52,19 @@ const ToolbarItem = t0 => {
51
52
  let title = item.key;
52
53
  if (item.label) {
53
54
  let t2;
54
- if ($[6] !== item || $[7] !== i18n || $[8] !== richTextComponentMap) {
55
+ if ($[6] !== item || $[7] !== featureClientSchemaMap || $[8] !== i18n || $[9] !== schemaPath) {
55
56
  t2 = typeof item.label === "function" ? item.label({
57
+ featureClientSchemaMap,
56
58
  i18n,
57
- richTextComponentMap
59
+ schemaPath
58
60
  }) : item.label;
59
61
  $[6] = item;
60
- $[7] = i18n;
61
- $[8] = richTextComponentMap;
62
- $[9] = t2;
62
+ $[7] = featureClientSchemaMap;
63
+ $[8] = i18n;
64
+ $[9] = schemaPath;
65
+ $[10] = t2;
63
66
  } else {
64
- t2 = $[9];
67
+ t2 = $[10];
65
68
  }
66
69
  title = t2;
67
70
  }
@@ -69,15 +72,15 @@ const ToolbarItem = t0 => {
69
72
  title = title.substring(0, 25) + "...";
70
73
  }
71
74
  let t2;
72
- if ($[10] !== item) {
75
+ if ($[11] !== item?.ChildComponent) {
73
76
  t2 = item?.ChildComponent && _jsx(item.ChildComponent, {});
74
- $[10] = item;
75
- $[11] = t2;
77
+ $[11] = item?.ChildComponent;
78
+ $[12] = t2;
76
79
  } else {
77
- t2 = $[11];
80
+ t2 = $[12];
78
81
  }
79
82
  let t3;
80
- if ($[12] !== title || $[13] !== t2 || $[14] !== active || $[15] !== editor || $[16] !== enabled || $[17] !== item) {
83
+ if ($[13] !== title || $[14] !== t2 || $[15] !== active || $[16] !== editor || $[17] !== enabled || $[18] !== item) {
81
84
  t3 = _jsxs(DropDownItem, {
82
85
  active,
83
86
  editor,
@@ -88,15 +91,15 @@ const ToolbarItem = t0 => {
88
91
  children: title
89
92
  })]
90
93
  }, item.key);
91
- $[12] = title;
92
- $[13] = t2;
93
- $[14] = active;
94
- $[15] = editor;
95
- $[16] = enabled;
96
- $[17] = item;
97
- $[18] = t3;
94
+ $[13] = title;
95
+ $[14] = t2;
96
+ $[15] = active;
97
+ $[16] = editor;
98
+ $[17] = enabled;
99
+ $[18] = item;
100
+ $[19] = t3;
98
101
  } else {
99
- t3 = $[18];
102
+ t3 = $[19];
100
103
  }
101
104
  return t3;
102
105
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","React","useCallback","useEffect","baseClass","mergeRegister","useTranslation","$getSelection","useEditorConfigContext","DropDown","DropDownItem","ToolbarItem","t0","$","active","anchorElem","editor","enabled","item","i18n","field","t1","richTextComponentMap","Component","t2","_jsx","key","title","label","length","substring","ChildComponent","t3","_jsxs","children","className","ToolbarDropdown","classNames","group","Icon","itemsContainerClassNames","maxActiveItems","onActiveChange","Symbol","for","activeItemKeys","setActiveItemKeys","useState","enabledItemKeys","setEnabledItemKeys","enabledGroup","setEnabledGroup","editorConfigContext","items","groupKey","getEditorState","read","selection","_activeItemKeys","_activeItems","_enabledItemKeys","isActive","push","isEnabled","activeItems","updateStates","t4","t5","t6","t7","registerUpdateListener","t8","t9","t10","t11","filter","Boolean","t12","join","t13","t14","t15","t16","map","item_0","includes","buttonAriaLabel","buttonClassName","disabled"],"sources":["../../../../../src/features/toolbars/shared/ToolbarDropdown/index.tsx"],"sourcesContent":["'use client'\nimport React, { useCallback, useEffect } from 'react'\n\nconst baseClass = 'toolbar-popup__dropdown'\n\nimport type { LexicalEditor } from 'lexical'\n\nimport { mergeRegister } from '@lexical/utils'\nimport { useTranslation } from '@payloadcms/ui'\nimport { $getSelection } from 'lexical'\n\nimport type { ToolbarDropdownGroup, ToolbarGroupItem } from '../../types.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport { DropDown, DropDownItem } from './DropDown.js'\nimport './index.scss'\n\nconst ToolbarItem = ({\n active,\n anchorElem,\n editor,\n enabled,\n item,\n}: {\n active?: boolean\n anchorElem: HTMLElement\n editor: LexicalEditor\n enabled?: boolean\n item: ToolbarGroupItem\n}) => {\n const { i18n } = useTranslation()\n const {\n field: { richTextComponentMap },\n } = useEditorConfigContext()\n\n if (item.Component) {\n return (\n item?.Component && (\n <item.Component\n active={active}\n anchorElem={anchorElem}\n editor={editor}\n enabled={enabled}\n item={item}\n key={item.key}\n />\n )\n )\n }\n\n let title = item.key\n if (item.label) {\n title =\n typeof item.label === 'function' ? item.label({ i18n, richTextComponentMap }) : item.label\n }\n // Crop title to max. 25 characters\n if (title.length > 25) {\n title = title.substring(0, 25) + '...'\n }\n\n return (\n <DropDownItem active={active} editor={editor} enabled={enabled} item={item} key={item.key}>\n {item?.ChildComponent && <item.ChildComponent />}\n <span className=\"text\">{title}</span>\n </DropDownItem>\n )\n}\n\nexport const ToolbarDropdown = ({\n anchorElem,\n classNames,\n editor,\n group,\n Icon,\n itemsContainerClassNames,\n label,\n maxActiveItems,\n onActiveChange,\n}: {\n anchorElem: HTMLElement\n classNames?: string[]\n editor: LexicalEditor\n group: ToolbarDropdownGroup\n Icon?: React.FC\n itemsContainerClassNames?: string[]\n label?: string\n /**\n * Maximum number of active items allowed. This is a performance optimization to prevent\n * unnecessary item active checks when the maximum number of active items is reached.\n */\n maxActiveItems?: number\n onActiveChange?: ({ activeItems }: { activeItems: ToolbarGroupItem[] }) => void\n}) => {\n const [activeItemKeys, setActiveItemKeys] = React.useState<string[]>([])\n const [enabledItemKeys, setEnabledItemKeys] = React.useState<string[]>([])\n const [enabledGroup, setEnabledGroup] = React.useState<boolean>(true)\n const editorConfigContext = useEditorConfigContext()\n const { items, key: groupKey } = group\n\n const updateStates = useCallback(() => {\n editor.getEditorState().read(() => {\n const selection = $getSelection()\n if (!selection) {\n return\n }\n\n const _activeItemKeys: string[] = []\n const _activeItems: ToolbarGroupItem[] = []\n const _enabledItemKeys: string[] = []\n\n for (const item of items) {\n if (item.isActive && (!maxActiveItems || _activeItemKeys.length < maxActiveItems)) {\n const isActive = item.isActive({ editor, editorConfigContext, selection })\n if (isActive) {\n _activeItemKeys.push(item.key)\n _activeItems.push(item)\n }\n }\n if (item.isEnabled) {\n const isEnabled = item.isEnabled({ editor, editorConfigContext, selection })\n if (isEnabled) {\n _enabledItemKeys.push(item.key)\n }\n } else {\n _enabledItemKeys.push(item.key)\n }\n }\n if (group.isEnabled) {\n setEnabledGroup(group.isEnabled({ editor, editorConfigContext, selection }))\n }\n setActiveItemKeys(_activeItemKeys)\n setEnabledItemKeys(_enabledItemKeys)\n\n if (onActiveChange) {\n onActiveChange({ activeItems: _activeItems })\n }\n })\n }, [editor, editorConfigContext, group, items, maxActiveItems, onActiveChange])\n\n useEffect(() => {\n updateStates()\n }, [updateStates])\n\n useEffect(() => {\n return mergeRegister(\n editor.registerUpdateListener(() => {\n updateStates()\n }),\n )\n }, [editor, updateStates])\n\n return (\n <DropDown\n buttonAriaLabel={`${groupKey} dropdown`}\n buttonClassName={[baseClass, `${baseClass}-${groupKey}`, ...(classNames || [])]\n .filter(Boolean)\n .join(' ')}\n disabled={!enabledGroup}\n Icon={Icon}\n itemsContainerClassNames={[`${baseClass}-items`, ...(itemsContainerClassNames || [])]}\n key={groupKey}\n label={label}\n >\n {items.length &&\n items.map((item) => {\n return (\n <ToolbarItem\n active={activeItemKeys.includes(item.key)}\n anchorElem={anchorElem}\n editor={editor}\n enabled={enabledItemKeys.includes(item.key)}\n item={item}\n key={item.key}\n />\n )\n })}\n </DropDown>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AACA,OAAOC,KAAA,IAASC,WAAW,EAAEC,SAAS,QAAQ;AAE9C,MAAMC,SAAA,GAAY;AAIlB,SAASC,aAAa,QAAQ;AAC9B,SAASC,cAAc,QAAQ;AAC/B,SAASC,aAAa,QAAQ;AAI9B,SAASC,sBAAsB,QAAQ;AACvC,SAASC,QAAQ,EAAEC,YAAY,QAAQ;AAGvC,MAAMC,WAAA,GAAcC,EAAA;EAAA,MAAAC,CAAA,GAAAb,EAAA;EAAC;IAAAc,MAAA;IAAAC,UAAA;IAAAC,MAAA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H,CAAA,OAAAmC,eAAA;MAAAnC,CAAA,OAAAqE,GAAA;IAAA;MAAAA,GAAA,GAAArE,CAAA;IAAA;IAvBJoE,GAAA,GAAAxD,IAAA,CAAAhB,QAAA;MAAA6E,eAAA,EACmBf,EAAsB;MAAAgB,eAAA,EACtBV,GAET;MAAAW,QAAA,EACET,GAAC;MAAAxC,IAAA;MAAAC,wBAAA,GAEgB,GAAApC,SAAA,QAAoB,KAAM4E,GAA8B;MAAApD,KAAA;MAAAM,QAAA,EAIlFgD;IAYC,GAfG5B,QAAA;IAAAzC,CAAA,OAAAmE,GAAA;IAAAnE,CAAA,OAAAwC,KAAA;IAAAxC,CAAA,OAAAgC,cAAA;IAAAhC,CAAA,OAAAE,UAAA;IAAAF,CAAA,OAAAG,MAAA;IAAAH,CAAA,OAAAmC,eAAA;IAAAnC,CAAA,OAAA0D,EAAA;IAAA1D,CAAA,OAAAgE,GAAA;IAAAhE,CAAA,OAAAkE,GAAA;IAAAlE,CAAA,OAAA0B,IAAA;IAAA1B,CAAA,OAAAe,KAAA;IAAAf,CAAA,OAAAyC,QAAA;IAAAzC,CAAA,OAAAoE,GAAA;EAAA;IAAAA,GAAA,GAAApE,CAAA;EAAA;EAAA,OARPoE,GAQO;AAAA,CAkBX","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["c","_c","React","useCallback","useEffect","baseClass","mergeRegister","useTranslation","$getSelection","useEditorConfigContext","DropDown","DropDownItem","ToolbarItem","t0","$","active","anchorElem","editor","enabled","item","i18n","fieldProps","t1","featureClientSchemaMap","schemaPath","Component","t2","_jsx","key","title","label","length","substring","ChildComponent","t3","_jsxs","children","className","ToolbarDropdown","classNames","group","Icon","itemsContainerClassNames","maxActiveItems","onActiveChange","Symbol","for","activeItemKeys","setActiveItemKeys","useState","enabledItemKeys","setEnabledItemKeys","enabledGroup","setEnabledGroup","editorConfigContext","items","groupKey","getEditorState","read","selection","_activeItemKeys","_activeItems","_enabledItemKeys","isActive","push","isEnabled","activeItems","updateStates","t4","t5","t6","t7","registerUpdateListener","t8","t9","t10","t11","filter","Boolean","t12","join","t13","t14","t15","t16","map","item_0","includes","buttonAriaLabel","buttonClassName","disabled"],"sources":["../../../../../src/features/toolbars/shared/ToolbarDropdown/index.tsx"],"sourcesContent":["'use client'\nimport React, { useCallback, useEffect } from 'react'\n\nconst baseClass = 'toolbar-popup__dropdown'\n\nimport type { LexicalEditor } from 'lexical'\n\nimport { mergeRegister } from '@lexical/utils'\nimport { useTranslation } from '@payloadcms/ui'\nimport { $getSelection } from 'lexical'\n\nimport type { ToolbarDropdownGroup, ToolbarGroupItem } from '../../types.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport { DropDown, DropDownItem } from './DropDown.js'\nimport './index.scss'\n\nconst ToolbarItem = ({\n active,\n anchorElem,\n editor,\n enabled,\n item,\n}: {\n active?: boolean\n anchorElem: HTMLElement\n editor: LexicalEditor\n enabled?: boolean\n item: ToolbarGroupItem\n}) => {\n const { i18n } = useTranslation()\n const {\n fieldProps: { featureClientSchemaMap, schemaPath },\n } = useEditorConfigContext()\n\n if (item.Component) {\n return (\n item?.Component && (\n <item.Component\n active={active}\n anchorElem={anchorElem}\n editor={editor}\n enabled={enabled}\n item={item}\n key={item.key}\n />\n )\n )\n }\n\n let title = item.key\n if (item.label) {\n title =\n typeof item.label === 'function'\n ? item.label({ featureClientSchemaMap, i18n, schemaPath })\n : item.label\n }\n // Crop title to max. 25 characters\n if (title.length > 25) {\n title = title.substring(0, 25) + '...'\n }\n\n return (\n <DropDownItem active={active} editor={editor} enabled={enabled} item={item} key={item.key}>\n {item?.ChildComponent && <item.ChildComponent />}\n <span className=\"text\">{title}</span>\n </DropDownItem>\n )\n}\n\nexport const ToolbarDropdown = ({\n anchorElem,\n classNames,\n editor,\n group,\n Icon,\n itemsContainerClassNames,\n label,\n maxActiveItems,\n onActiveChange,\n}: {\n anchorElem: HTMLElement\n classNames?: string[]\n editor: LexicalEditor\n group: ToolbarDropdownGroup\n Icon?: React.FC\n itemsContainerClassNames?: string[]\n label?: string\n /**\n * Maximum number of active items allowed. This is a performance optimization to prevent\n * unnecessary item active checks when the maximum number of active items is reached.\n */\n maxActiveItems?: number\n onActiveChange?: ({ activeItems }: { activeItems: ToolbarGroupItem[] }) => void\n}) => {\n const [activeItemKeys, setActiveItemKeys] = React.useState<string[]>([])\n const [enabledItemKeys, setEnabledItemKeys] = React.useState<string[]>([])\n const [enabledGroup, setEnabledGroup] = React.useState<boolean>(true)\n const editorConfigContext = useEditorConfigContext()\n const { items, key: groupKey } = group\n\n const updateStates = useCallback(() => {\n editor.getEditorState().read(() => {\n const selection = $getSelection()\n if (!selection) {\n return\n }\n\n const _activeItemKeys: string[] = []\n const _activeItems: ToolbarGroupItem[] = []\n const _enabledItemKeys: string[] = []\n\n for (const item of items) {\n if (item.isActive && (!maxActiveItems || _activeItemKeys.length < maxActiveItems)) {\n const isActive = item.isActive({ editor, editorConfigContext, selection })\n if (isActive) {\n _activeItemKeys.push(item.key)\n _activeItems.push(item)\n }\n }\n if (item.isEnabled) {\n const isEnabled = item.isEnabled({ editor, editorConfigContext, selection })\n if (isEnabled) {\n _enabledItemKeys.push(item.key)\n }\n } else {\n _enabledItemKeys.push(item.key)\n }\n }\n if (group.isEnabled) {\n setEnabledGroup(group.isEnabled({ editor, editorConfigContext, selection }))\n }\n setActiveItemKeys(_activeItemKeys)\n setEnabledItemKeys(_enabledItemKeys)\n\n if (onActiveChange) {\n onActiveChange({ activeItems: _activeItems })\n }\n })\n }, [editor, editorConfigContext, group, items, maxActiveItems, onActiveChange])\n\n useEffect(() => {\n updateStates()\n }, [updateStates])\n\n useEffect(() => {\n return mergeRegister(\n editor.registerUpdateListener(() => {\n updateStates()\n }),\n )\n }, [editor, updateStates])\n\n return (\n <DropDown\n buttonAriaLabel={`${groupKey} dropdown`}\n buttonClassName={[baseClass, `${baseClass}-${groupKey}`, ...(classNames || [])]\n .filter(Boolean)\n .join(' ')}\n disabled={!enabledGroup}\n Icon={Icon}\n itemsContainerClassNames={[`${baseClass}-items`, ...(itemsContainerClassNames || [])]}\n key={groupKey}\n label={label}\n >\n {items.length &&\n items.map((item) => {\n return (\n <ToolbarItem\n active={activeItemKeys.includes(item.key)}\n anchorElem={anchorElem}\n editor={editor}\n enabled={enabledItemKeys.includes(item.key)}\n item={item}\n key={item.key}\n />\n )\n })}\n </DropDown>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AACA,OAAOC,KAAA,IAASC,WAAW,EAAEC,SAAS,QAAQ;AAE9C,MAAMC,SAAA,GAAY;AAIlB,SAASC,aAAa,QAAQ;AAC9B,SAASC,cAAc,QAAQ;AAC/B,SAASC,aAAa,QAAQ;AAI9B,SAASC,sBAAsB,QAAQ;AACvC,SAASC,QAAQ,EAAEC,YAAY,QAAQ;AAGvC,MAAMC,WAAA,GAAcC,EAAA;EAAA,MAAAC,CAAA,GAAAb,EAAA;EAAC;IAAAc,MAAA;IAAAC,UAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC;EAAA,IAAAN,EAYpB;EACC;IAAAO;EAAA,IAAiBb,cAAA;EACjB;IAAAc,UAAA,EAAAC;EAAA,IAEIb,sBAAA;EADU;IAAAc,sBAAA;IAAAC;EAAA,IAAAF,EAAsC;EAAA,IAGhDH,IAAA,CAAAM,SAAA;IAAA,IAAAC,EAAA;IAAA,IAAAZ,CAAA,QAAAK,IAAA,IAAAL,CAAA,QAAAC,MAAA,IAAAD,CAAA,QAAAE,UAAA,IAAAF,CAAA,QAAAG,MAAA,IAAAH,CAAA,QAAAI,OAAA;MAEAQ,EAAA,GAAAP,IAAA,EAAAM,SAAA,IACEE,IAAA,CAACR,IAAA,CAAAM,SAAA;QAAAV,MAAA;QAAAC,UAAA;QAAAC,MAAA;QAAAC,OAAA;QAAAC;MAAA,GAMMA,IAAA,CAAAS,GAAQ;MAAAd,CAAA,MAAAK,IAAA;MAAAL,CAAA,MAAAC,MAAA;M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MAAA;IAAAH,CAAA,OAAAoC,eAAA;IAAApC,CAAA,OAAA2D,EAAA;IAAA3D,CAAA,OAAAiE,GAAA;IAAAjE,CAAA,OAAAmE,GAAA;IAAAnE,CAAA,OAAA2B,IAAA;IAAA3B,CAAA,OAAAgB,KAAA;IAAAhB,CAAA,OAAA0C,QAAA;IAAA1C,CAAA,OAAAqE,GAAA;EAAA;IAAAA,GAAA,GAAArE,CAAA;EAAA;EAAA,OARPqE,GAQO;AAAA,CAkBX","ignoreList":[]}
@@ -2,6 +2,7 @@ import type { I18nClient } from '@payloadcms/translations';
2
2
  import type { BaseSelection, LexicalEditor } from 'lexical';
3
3
  import type React from 'react';
4
4
  import type { EditorConfigContextType } from '../../lexical/config/client/EditorConfigProvider.js';
5
+ import type { FeatureClientSchemaMap } from '../../types.js';
5
6
  export type ToolbarGroup = ToolbarButtonsGroup | ToolbarDropdownGroup;
6
7
  export type ToolbarDropdownGroup = {
7
8
  /**
@@ -78,8 +79,9 @@ export type ToolbarGroupItem = {
78
79
  key: string;
79
80
  /** The label will be displayed in your toolbar item, if it's within a dropdown group. In order to make use of i18n, this can be a function. */
80
81
  label?: ((args: {
82
+ featureClientSchemaMap: FeatureClientSchemaMap;
81
83
  i18n: I18nClient<{}, string>;
82
- richTextComponentMap?: Map<string, React.ReactNode>;
84
+ schemaPath: string;
83
85
  }) => string) | string;
84
86
  /** Each toolbar item needs to have a unique key. */
85
87
  onSelect?: ({ editor, isActive }: {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/features/toolbars/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAC3D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAA;AAElG,MAA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mB,EAAE,uBAAuB,CAAA;QAC5C,SAAS,EAAE,aAAa,CAAA;KACzB,KAAK,OAAO,CAAA;IACb,iJAAiJ;IACjJ,SAAS,CAAC,EAAE,CAAC,EACX,MAAM,EACN,mBAAmB,EACnB,SAAS,GACV,EAAE;QACD,MAAM,EAAE,aAAa,CAAA;QACrB,mBAAmB,EAAE,uBAAuB,CAAA;QAC5C,SAAS,EAAE,aAAa,CAAA;KACzB,KAAK,OAAO,CAAA;IACb,oDAAoD;IACpD,GAAG,EAAE,MAAM,CAAA;IACX,+IAA+I;IAC/I,KAAK,CAAC,EACF,CAAC,CAAC,IAAI,EAAE;QACN,sBAAsB,EAAE,sBAAsB,CAAA;QAC9C,IAAI,EAAE,UAAU,CAAC,EAAE,EAAE,MAAM,CAAC,CAAA;QAC5B,UAAU,EAAE,MAAM,CAAA;KACnB,KAAK,MAAM,CAAC,GACb,MAAM,CAAA;IACV,oDAAoD;IACpD,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE;QAAE,MAAM,EAAE,aAAa,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAA;IACvF,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../src/features/toolbars/types.ts"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\nimport type { BaseSelection, LexicalEditor } from 'lexical'\nimport type React from 'react'\n\nimport type { EditorConfigContextType } from '../../lexical/config/client/EditorConfigProvider.js'\n\nexport type ToolbarGroup = ToolbarButtonsGroup | ToolbarDropdownGroup\n\nexport type ToolbarDropdownGroup = {\n /**\n * The dropdown toolbar ChildComponent allows you to pass in a React Component which will be displayed within the dropdown button.\n */\n ChildComponent?: React.FC\n /**\n * This is optional and controls if the toolbar group is highlighted or not.\n */\n isEnabled?: ({\n editor,\n editorConfigContext,\n selection,\n }: {\n editor: LexicalEditor\n editorConfigContext: EditorConfigContextType\n selection: BaseSelection\n }) => boolean\n /**\n * All toolbar items part of this toolbar group need to be added here.\n */\n items: Array<ToolbarGroupItem>\n /**\n * Each toolbar group needs to have a unique key. Groups with the same keys will have their items merged together.\n */\n key: string\n /**\n * Determines where the toolbar group will be.\n */\n order?: number\n /**\n * Controls the toolbar group type. Set to `dropdown` to create a buttons toolbar group, which displays toolbar items vertically using their icons and labels, if the dropdown is open.\n */\n type: 'dropdown'\n}\n\nexport type ToolbarButtonsGroup = {\n /**\n * All toolbar items part of this toolbar group need to be added here.\n */\n items: Array<ToolbarGroupItem>\n /**\n * Each toolbar group needs to have a unique key. Groups with the same keys will have their items merged together.\n */\n key: string\n /**\n * Determines where the toolbar group will be.\n */\n order?: number\n /**\n * Controls the toolbar group type. Set to `buttons` to create a buttons toolbar group, which displays toolbar items horizontally using only their icons.\n */\n type: 'buttons'\n}\n\nexport type ToolbarGroupItem = {\n /** A React component which is rendered within your toolbar item's default button component. Usually, you want this to be an icon. */\n ChildComponent?: React.FC\n /** A React component which is rendered in place of the toolbar item's default button component, thus completely replacing it. The `ChildComponent` and `onSelect` properties will be ignored. */\n Component?: React.FC<{\n active?: boolean\n anchorElem: HTMLElement\n editor: LexicalEditor\n enabled?: boolean\n item: ToolbarGroupItem\n }>\n /** This is optional and controls if the toolbar item is highlighted or not. */\n isActive?: ({\n editor,\n editorConfigContext,\n selection,\n }: {\n editor: LexicalEditor\n editorConfigContext: EditorConfigContextType\n selection: BaseSelection\n }) => boolean\n /** This is optional and controls if the toolbar item is clickable or not. If `false` is returned here, it will be grayed out and unclickable. */\n isEnabled?: ({\n editor,\n editorConfigContext,\n selection,\n }: {\n editor: LexicalEditor\n editorConfigContext: EditorConfigContextType\n selection: BaseSelection\n }) => boolean\n /** Each toolbar item needs to have a unique key. */\n key: string\n /** The label will be displayed in your toolbar item, if it's within a dropdown group. In order to make use of i18n, this can be a function. */\n label?:\n | ((args: {\n i18n: I18nClient<{}, string>\n richTextComponentMap?: Map<string, React.ReactNode>\n }) => string)\n | string\n /** Each toolbar item needs to have a unique key. */\n onSelect?: ({ editor, isActive }: { editor: LexicalEditor; isActive: boolean }) => void\n order?: number\n}\n"],"mappings":"AA8DA","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../src/features/toolbars/types.ts"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\nimport type { BaseSelection, LexicalEditor } from 'lexical'\nimport type React from 'react'\n\nimport type { EditorConfigContextType } from '../../lexical/config/client/EditorConfigProvider.js'\nimport type { FeatureClientSchemaMap } from '../../types.js'\n\nexport type ToolbarGroup = ToolbarButtonsGroup | ToolbarDropdownGroup\n\nexport type ToolbarDropdownGroup = {\n /**\n * The dropdown toolbar ChildComponent allows you to pass in a React Component which will be displayed within the dropdown button.\n */\n ChildComponent?: React.FC\n /**\n * This is optional and controls if the toolbar group is highlighted or not.\n */\n isEnabled?: ({\n editor,\n editorConfigContext,\n selection,\n }: {\n editor: LexicalEditor\n editorConfigContext: EditorConfigContextType\n selection: BaseSelection\n }) => boolean\n /**\n * All toolbar items part of this toolbar group need to be added here.\n */\n items: Array<ToolbarGroupItem>\n /**\n * Each toolbar group needs to have a unique key. Groups with the same keys will have their items merged together.\n */\n key: string\n /**\n * Determines where the toolbar group will be.\n */\n order?: number\n /**\n * Controls the toolbar group type. Set to `dropdown` to create a buttons toolbar group, which displays toolbar items vertically using their icons and labels, if the dropdown is open.\n */\n type: 'dropdown'\n}\n\nexport type ToolbarButtonsGroup = {\n /**\n * All toolbar items part of this toolbar group need to be added here.\n */\n items: Array<ToolbarGroupItem>\n /**\n * Each toolbar group needs to have a unique key. Groups with the same keys will have their items merged together.\n */\n key: string\n /**\n * Determines where the toolbar group will be.\n */\n order?: number\n /**\n * Controls the toolbar group type. Set to `buttons` to create a buttons toolbar group, which displays toolbar items horizontally using only their icons.\n */\n type: 'buttons'\n}\n\nexport type ToolbarGroupItem = {\n /** A React component which is rendered within your toolbar item's default button component. Usually, you want this to be an icon. */\n ChildComponent?: React.FC\n /** A React component which is rendered in place of the toolbar item's default button component, thus completely replacing it. The `ChildComponent` and `onSelect` properties will be ignored. */\n Component?: React.FC<{\n active?: boolean\n anchorElem: HTMLElement\n editor: LexicalEditor\n enabled?: boolean\n item: ToolbarGroupItem\n }>\n /** This is optional and controls if the toolbar item is highlighted or not. */\n isActive?: ({\n editor,\n editorConfigContext,\n selection,\n }: {\n editor: LexicalEditor\n editorConfigContext: EditorConfigContextType\n selection: BaseSelection\n }) => boolean\n /** This is optional and controls if the toolbar item is clickable or not. If `false` is returned here, it will be grayed out and unclickable. */\n isEnabled?: ({\n editor,\n editorConfigContext,\n selection,\n }: {\n editor: LexicalEditor\n editorConfigContext: EditorConfigContextType\n selection: BaseSelection\n }) => boolean\n /** Each toolbar item needs to have a unique key. */\n key: string\n /** The label will be displayed in your toolbar item, if it's within a dropdown group. In order to make use of i18n, this can be a function. */\n label?:\n | ((args: {\n featureClientSchemaMap: FeatureClientSchemaMap\n i18n: I18nClient<{}, string>\n schemaPath: string\n }) => string)\n | string\n /** Each toolbar item needs to have a unique key. */\n onSelect?: ({ editor, isActive }: { editor: LexicalEditor; isActive: boolean }) => void\n order?: number\n}\n"],"mappings":"AA+DA","ignoreList":[]}
@@ -2,7 +2,7 @@ import type { Transformer } from '@lexical/markdown';
2
2
  import type { GenericLanguages, I18nClient } from '@payloadcms/translations';
3
3
  import type { JSONSchema4 } from 'json-schema';
4
4
  import type { Klass, LexicalNode, LexicalNodeReplacement, SerializedEditorState, SerializedLexicalNode } from 'lexical';
5
- import type { Config, Field, JsonObject, Payload, PayloadComponent, PayloadRequest, PopulateType, ReplaceAny, RequestContext, RichTextField, RichTextHooks, SanitizedConfig, ValidateOptions } from 'payload';
5
+ import type { Config, Field, FieldSchemaMap, JsonObject, PayloadComponent, PayloadRequest, PopulateType, ReplaceAny, RequestContext, RichTextField, RichTextHooks, SanitizedConfig, ValidateOptions, ValidationFieldError } from 'payload';
6
6
  import type { ServerEditorConfig } from '../lexical/config/types.js';
7
7
  import type { AdapterProps } from '../types.js';
8
8
  import type { HTMLConverter } from './converters/html/converter/types.js';
@@ -123,10 +123,7 @@ export type BeforeChangeNodeHookArgs<T extends SerializedLexicalNode> = {
123
123
  /**
124
124
  * Only available in `beforeChange` hooks.
125
125
  */
126
- errors: {
127
- field: string;
128
- message: string;
129
- }[];
126
+ errors: ValidationFieldError[];
130
127
  mergeLocaleActions: (() => Promise<void>)[];
131
128
  /** A string relating to which operation the field type is currently executing within. Useful within beforeValidate, beforeChange, and afterChange hooks to differentiate between create and update operations. */
132
129
  operation: 'create' | 'delete' | 'read' | 'update';
@@ -210,16 +207,6 @@ export type ServerFeature<ServerProps, ClientFeatureProps> = {
210
207
  */
211
208
  clientFeatureProps?: ClientFeatureProps;
212
209
  componentImports?: Config['admin']['importMap']['generators'][0] | PayloadComponent[];
213
- componentMap?: ((args: {
214
- i18n: I18nClient;
215
- payload: Payload;
216
- props: ServerProps;
217
- schemaPath: string;
218
- }) => {
219
- [key: string]: PayloadComponent;
220
- }) | {
221
- [key: string]: PayloadComponent;
222
- };
223
210
  generatedTypes?: {
224
211
  modifyOutputSchema: ({ collectionIDFieldTypes, config, currentSchema, field, interfaceNameDefinitions, isRequired, }: {
225
212
  collectionIDFieldTypes: {
@@ -243,9 +230,9 @@ export type ServerFeature<ServerProps, ClientFeatureProps> = {
243
230
  field: RichTextField;
244
231
  i18n: I18nClient;
245
232
  props: ServerProps;
246
- schemaMap: Map<string, Field[]>;
233
+ schemaMap: FieldSchemaMap;
247
234
  schemaPath: string;
248
- }) => Map<string, Field[]> | null;
235
+ }) => FieldSchemaMap | null;
249
236
  hooks?: RichTextHooks;
250
237
  /**
251
238
  * Here you can provide i18n translations for your feature. These will only be available on the server and client.
@@ -1 +1 @@
1
- {"version":3,"file":"typesServer.d.ts","sourceRoot":"","sources":["../../src/features/typesServer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB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CAAC,MAAM,EAAE,KAAK,CAAC,iBAAiB,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAA;QACxE,YAAY,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,oBAAoB,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAA;QAC9E,cAAc,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,sBAAsB,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAA;KACnF,CAAA,CAAC,yDAAyD;IAC3D,kDAAkD;IAClD,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,CAAA;CAChD,GAAG,QAAQ,CAAC,IAAI,CAAC,qBAAqB,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,sBAAsB,GAAG,OAAO,CAAC,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"typesServer.js","names":[],"sources":["../../src/features/typesServer.ts"],"sourcesContent":["import type { Transformer } from '@lexical/markdown'\nimport type { GenericLanguages, I18nClient } from '@payloadcms/translations'\nimport type { JSONSchema4 } from 'json-schema'\nimport type {\n Klass,\n LexicalNode,\n LexicalNodeReplacement,\n SerializedEditorState,\n SerializedLexicalNode,\n} from 'lexical'\nimport type {\n Config,\n Field,\n JsonObject,\n Payload,\n PayloadComponent,\n PayloadRequest,\n PopulateType,\n ReplaceAny,\n RequestContext,\n RichTextField,\n RichTextHooks,\n SanitizedConfig,\n ValidateOptions,\n} from 'payload'\n\nimport type { ServerEditorConfig } from '../lexical/config/types.js'\nimport type { AdapterProps } from '../types.js'\nimport type { HTMLConverter } from './converters/html/converter/types.js'\nimport type { BaseClientFeatureProps } from './typesClient.js'\n\nexport type PopulationPromise<T extends SerializedLexicalNode = SerializedLexicalNode> = ({\n context,\n currentDepth,\n depth,\n draft,\n editorPopulationPromises,\n field,\n fieldPromises,\n findMany,\n flattenLocales,\n node,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc,\n}: {\n context: RequestContext\n currentDepth: number\n depth: number\n draft: boolean\n /**\n * This maps all population promises to the node type\n */\n editorPopulationPromises: Map<string, Array<PopulationPromise>>\n field: RichTextField<SerializedEditorState, AdapterProps>\n /**\n * fieldPromises are used for things like field hooks. They will be awaited before awaiting populationPromises\n */\n fieldPromises: Promise<void>[]\n findMany: boolean\n flattenLocales: boolean\n node: T\n overrideAccess: boolean\n populationPromises: Promise<void>[]\n req: PayloadRequest\n showHiddenFields: boolean\n siblingDoc: JsonObject\n}) => void\n\nexport type NodeValidation<T extends SerializedLexicalNode = SerializedLexicalNode> = ({\n node,\n nodeValidations,\n validation,\n}: {\n node: T\n nodeValidations: Map<string, Array<NodeValidation>>\n validation: {\n options: ValidateOptions<unknown, unknown, RichTextField, SerializedEditorState>\n value: SerializedEditorState\n }\n}) => Promise<string | true> | string | true\n\nexport type FeatureProviderProviderServer<\n UnSanitizedServerFeatureProps = undefined,\n ServerFeatureProps = UnSanitizedServerFeatureProps,\n ClientFeatureProps = undefined,\n> = (\n props?: UnSanitizedServerFeatureProps,\n) => FeatureProviderServer<UnSanitizedServerFeatureProps, ServerFeatureProps, ClientFeatureProps>\n\nexport type FeatureProviderServer<\n UnSanitizedServerFeatureProps = undefined,\n ServerFeatureProps = UnSanitizedServerFeatureProps,\n ClientFeatureProps = undefined,\n> = {\n /** Keys of dependencies needed for this feature. These dependencies do not have to be loaded first, but they have to exist, otherwise an error will be thrown. */\n dependencies?: string[]\n /** Keys of priority dependencies needed for this feature. These dependencies have to be loaded first AND have to exist, otherwise an error will be thrown. They will be available in the `feature` property. */\n dependenciesPriority?: string[]\n /** Keys of soft-dependencies needed for this feature. These are optional. Payload will attempt to load them before this feature, but doesn't throw an error if that's not possible. */\n dependenciesSoft?: string[]\n\n /**\n * This is being called during the payload sanitization process\n */\n feature:\n | ((props: {\n config: SanitizedConfig\n /** unSanitizedEditorConfig.features, but mapped */\n featureProviderMap: ServerFeatureProviderMap\n isRoot?: boolean\n parentIsLocalized: boolean\n // other resolved features, which have been loaded before this one. All features declared in 'dependencies' should be available here\n resolvedFeatures: ResolvedServerFeatureMap\n // unSanitized EditorConfig,\n unSanitizedEditorConfig: ServerEditorConfig\n }) =>\n | Promise<ServerFeature<ServerFeatureProps, ClientFeatureProps>>\n | ServerFeature<ServerFeatureProps, ClientFeatureProps>)\n | ServerFeature<ServerFeatureProps, ClientFeatureProps>\n key: string\n /** Props which were passed into your feature will have to be passed here. This will allow them to be used / read in other places of the code, e.g. wherever you can use useEditorConfigContext */\n serverFeatureProps: UnSanitizedServerFeatureProps\n}\n\nexport type AfterReadNodeHookArgs<T extends SerializedLexicalNode> = {\n /**\n * Only available in `afterRead` hooks.\n */\n currentDepth: number\n /**\n * Only available in `afterRead` hooks.\n */\n depth: number\n draft: boolean\n fallbackLocale: string\n /**\n * Only available in `afterRead` field hooks.\n */\n fieldPromises: Promise<void>[]\n /** Boolean to denote if this hook is running against finding one, or finding many within the afterRead hook. */\n findMany: boolean\n flattenLocales: boolean\n /**\n * The requested locale.\n */\n locale: string\n overrideAccess: boolean\n /**\n * Only available in `afterRead` hooks.\n */\n populateArg?: PopulateType\n /**\n * Only available in `afterRead` field hooks.\n */\n populationPromises: Promise<void>[]\n /**\n * Only available in `afterRead` hooks.\n */\n showHiddenFields: boolean\n /**\n * Only available in `afterRead` hooks.\n */\n triggerAccessControl: boolean\n /**\n * Only available in `afterRead` hooks.\n */\n triggerHooks: boolean\n}\n\nexport type AfterChangeNodeHookArgs<T extends SerializedLexicalNode> = {\n /** A string relating to which operation the field type is currently executing within. Useful within beforeValidate, beforeChange, and afterChange hooks to differentiate between create and update operations. */\n operation: 'create' | 'delete' | 'read' | 'update'\n /** The value of the node before any changes. Not available in afterRead hooks */\n originalNode: T\n}\nexport type BeforeValidateNodeHookArgs<T extends SerializedLexicalNode> = {\n /** A string relating to which operation the field type is currently executing within. Useful within beforeValidate, beforeChange, and afterChange hooks to differentiate between create and update operations. */\n operation: 'create' | 'delete' | 'read' | 'update'\n /** The value of the node before any changes. Not available in afterRead hooks */\n originalNode: T\n overrideAccess: boolean\n}\n\nexport type BeforeChangeNodeHookArgs<T extends SerializedLexicalNode> = {\n /**\n * Only available in `beforeChange` hooks.\n */\n errors: { field: string; message: string }[]\n mergeLocaleActions: (() => Promise<void>)[]\n /** A string relating to which operation the field type is currently executing within. Useful within beforeValidate, beforeChange, and afterChange hooks to differentiate between create and update operations. */\n operation: 'create' | 'delete' | 'read' | 'update'\n /** The value of the node before any changes. Not available in afterRead hooks */\n originalNode: T\n /**\n * The original node with locales (not modified by any hooks).\n */\n originalNodeWithLocales?: T\n skipValidation: boolean\n}\n\nexport type BaseNodeHookArgs<T extends SerializedLexicalNode> = {\n context: RequestContext\n /** The value of the node. */\n node: T\n parentRichTextFieldPath: (number | string)[]\n parentRichTextFieldSchemaPath: string[]\n /** The payload request object. It is mocked for Local API operations. */\n req: PayloadRequest\n}\n\nexport type AfterReadNodeHook<T extends SerializedLexicalNode> = (\n args: AfterReadNodeHookArgs<T> & BaseNodeHookArgs<T>,\n) => Promise<T> | T\n\nexport type AfterChangeNodeHook<T extends SerializedLexicalNode> = (\n args: AfterChangeNodeHookArgs<T> & BaseNodeHookArgs<T>,\n) => Promise<T> | T\n\nexport type BeforeChangeNodeHook<T extends SerializedLexicalNode> = (\n args: BaseNodeHookArgs<T> & BeforeChangeNodeHookArgs<T>,\n) => Promise<T> | T\n\nexport type BeforeValidateNodeHook<T extends SerializedLexicalNode> = (\n args: BaseNodeHookArgs<T> & BeforeValidateNodeHookArgs<T>,\n) => Promise<T> | T\n\n// Define the node with hooks that use the node's exportJSON return type\nexport type NodeWithHooks<T extends LexicalNode = any> = {\n /**\n * Allows you to define how a node can be serialized into different formats. Currently, only supports html.\n * Markdown converters are defined in `markdownTransformers` and not here.\n */\n converters?: {\n html?: HTMLConverter<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>\n }\n /**\n * If a node includes sub-fields (e.g. block and link nodes), passing those subFields here will make payload\n * automatically populate, run hooks, and generate component import maps for them\n */\n getSubFields?: (args: {\n /**\n * Optional. If not provided, all possible sub-fields should be returned.\n */\n node?: ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>\n req?: PayloadRequest\n }) => Field[] | null\n /**\n * If a node includes sub-fields, the sub-fields data needs to be returned here, alongside `getSubFields` which returns their schema.\n */\n getSubFieldsData?: (args: {\n node: ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>\n req: PayloadRequest\n }) => JsonObject\n /**\n * Allows you to run population logic when a node's data was requested from graphQL.\n * While `getSubFields` and `getSubFieldsData` automatically handle populating sub-fields (since they run hooks on them), those are only populated in the Rest API.\n * This is because the Rest API hooks do not have access to the 'depth' property provided by graphQL.\n * In order for them to be populated correctly in graphQL, the population logic needs to be provided here.\n */\n graphQLPopulationPromises?: Array<\n PopulationPromise<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>\n >\n /**\n * Just like payload fields, you can provide hooks which are run for this specific node. These are called Node Hooks.\n */\n hooks?: {\n afterChange?: Array<AfterChangeNodeHook<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>>\n afterRead?: Array<AfterReadNodeHook<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>>\n beforeChange?: Array<BeforeChangeNodeHook<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>>\n beforeValidate?: Array<\n BeforeValidateNodeHook<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>\n >\n }\n /**\n * The actual lexical node needs to be provided here. This also supports [lexical node replacements](https://lexical.dev/docs/concepts/node-replacement).\n */\n node: Klass<T> | LexicalNodeReplacement\n /**\n * This allows you to provide node validations, which are run when your document is being validated, alongside other payload fields.\n * You can use it to throw a validation error for a specific node in case its data is incorrect.\n */\n validations?: Array<NodeValidation<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>>\n}\n\nexport type ServerFeature<ServerProps, ClientFeatureProps> = {\n ClientFeature?: PayloadComponent<never, BaseClientFeatureProps<ClientFeatureProps>>\n /**\n * This determines what props will be available on the Client.\n */\n clientFeatureProps?: ClientFeatureProps\n // @ts-expect-error - TODO: fix this\n componentImports?: Config['admin']['importMap']['generators'][0] | PayloadComponent[]\n componentMap?:\n | ((args: { i18n: I18nClient; payload: Payload; props: ServerProps; schemaPath: string }) => {\n [key: string]: PayloadComponent\n })\n | {\n [key: string]: PayloadComponent\n }\n generatedTypes?: {\n modifyOutputSchema: ({\n collectionIDFieldTypes,\n config,\n currentSchema,\n field,\n interfaceNameDefinitions,\n isRequired,\n }: {\n collectionIDFieldTypes: { [key: string]: 'number' | 'string' }\n config?: SanitizedConfig\n /**\n * Current schema which will be modified by this function.\n */\n currentSchema: JSONSchema4\n field: RichTextField<SerializedEditorState, AdapterProps>\n /**\n * Allows you to define new top-level interfaces that can be re-used in the output schema.\n */\n interfaceNameDefinitions: Map<string, JSONSchema4>\n isRequired: boolean\n }) => JSONSchema4\n }\n generateSchemaMap?: (args: {\n config: SanitizedConfig\n field: RichTextField\n i18n: I18nClient\n props: ServerProps\n schemaMap: Map<string, Field[]>\n schemaPath: string\n }) => Map<string, Field[]> | null\n hooks?: RichTextHooks\n /**\n * Here you can provide i18n translations for your feature. These will only be available on the server and client.\n *\n * Translations here are automatically scoped to `lexical.featureKey.yourKey`\n *\n * @Example\n * ```ts\n * i18n: {\n * en: {\n * label: 'Horizontal Rule',\n * },\n * de: {\n * label: 'Trennlinie',\n * },\n * }\n * ```\n * In order to access these translations, you would use `i18n.t('lexical:horizontalRule:label')`.\n */\n i18n?: Partial<GenericLanguages>\n markdownTransformers?: Transformer[]\n nodes?: Array<NodeWithHooks>\n\n /** Props which were passed into your feature will have to be passed here. This will allow them to be used / read in other places of the code, e.g. wherever you can use useEditorConfigContext */\n sanitizedServerFeatureProps?: ServerProps\n}\n\nexport type ResolvedServerFeature<ServerProps, ClientFeatureProps> = {\n order: number\n} & Required<\n Pick<\n FeatureProviderServer<ServerProps, ClientFeatureProps>,\n 'dependencies' | 'dependenciesPriority' | 'dependenciesSoft' | 'key'\n >\n> &\n ServerFeature<ServerProps, ClientFeatureProps>\n\nexport type ResolvedServerFeatureMap = Map<string, ResolvedServerFeature<any, any>>\n\nexport type ServerFeatureProviderMap = Map<string, FeatureProviderServer<any, any, any>>\n\nexport type SanitizedServerFeatures = {\n /** The node types mapped to their converters */\n converters: {\n html: HTMLConverter[]\n }\n /** The keys of all enabled features */\n enabledFeatures: string[]\n generatedTypes: {\n modifyOutputSchemas: Array<\n ({\n collectionIDFieldTypes,\n config,\n currentSchema,\n field,\n interfaceNameDefinitions,\n isRequired,\n }: {\n collectionIDFieldTypes: { [key: string]: 'number' | 'string' }\n config?: SanitizedConfig\n /**\n * Current schema which will be modified by this function.\n */\n currentSchema: JSONSchema4\n field: RichTextField<SerializedEditorState, AdapterProps>\n /**\n * Allows you to define new top-level interfaces that can be re-used in the output schema.\n */\n interfaceNameDefinitions: Map<string, JSONSchema4>\n isRequired: boolean\n }) => JSONSchema4\n >\n }\n /** The node types mapped to their hooks */\n\n getSubFields?: Map<\n string,\n (args: { node: SerializedLexicalNode; req: PayloadRequest }) => Field[] | null\n >\n getSubFieldsData?: Map<\n string,\n (args: { node: SerializedLexicalNode; req: PayloadRequest }) => JsonObject\n >\n graphQLPopulationPromises: Map<string, Array<PopulationPromise>>\n hooks: RichTextHooks\n nodeHooks?: {\n afterChange?: Map<string, Array<AfterChangeNodeHook<SerializedLexicalNode>>>\n afterRead?: Map<string, Array<AfterReadNodeHook<SerializedLexicalNode>>>\n beforeChange?: Map<string, Array<BeforeChangeNodeHook<SerializedLexicalNode>>>\n beforeValidate?: Map<string, Array<BeforeValidateNodeHook<SerializedLexicalNode>>>\n } /** The node types mapped to their populationPromises */\n /** The node types mapped to their validations */\n validations: Map<string, Array<NodeValidation>>\n} & Required<Pick<ResolvedServerFeature<any, any>, 'i18n' | 'markdownTransformers' | 'nodes'>>\n"],"mappings":"AAsXA","ignoreList":[]}
1
+ {"version":3,"file":"typesServer.js","names":[],"sources":["../../src/features/typesServer.ts"],"sourcesContent":["import type { Transformer } from '@lexical/markdown'\nimport type { GenericLanguages, I18nClient } from '@payloadcms/translations'\nimport type { JSONSchema4 } from 'json-schema'\nimport type {\n Klass,\n LexicalNode,\n LexicalNodeReplacement,\n SerializedEditorState,\n SerializedLexicalNode,\n} from 'lexical'\nimport type {\n Config,\n Field,\n FieldSchemaMap,\n JsonObject,\n Payload,\n PayloadComponent,\n PayloadRequest,\n PopulateType,\n ReplaceAny,\n RequestContext,\n RichTextField,\n RichTextHooks,\n SanitizedConfig,\n ValidateOptions,\n ValidationFieldError,\n} from 'payload'\n\nimport type { ServerEditorConfig } from '../lexical/config/types.js'\nimport type { AdapterProps } from '../types.js'\nimport type { HTMLConverter } from './converters/html/converter/types.js'\nimport type { BaseClientFeatureProps } from './typesClient.js'\n\nexport type PopulationPromise<T extends SerializedLexicalNode = SerializedLexicalNode> = ({\n context,\n currentDepth,\n depth,\n draft,\n editorPopulationPromises,\n field,\n fieldPromises,\n findMany,\n flattenLocales,\n node,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc,\n}: {\n context: RequestContext\n currentDepth: number\n depth: number\n draft: boolean\n /**\n * This maps all population promises to the node type\n */\n editorPopulationPromises: Map<string, Array<PopulationPromise>>\n field: RichTextField<SerializedEditorState, AdapterProps>\n /**\n * fieldPromises are used for things like field hooks. They will be awaited before awaiting populationPromises\n */\n fieldPromises: Promise<void>[]\n findMany: boolean\n flattenLocales: boolean\n node: T\n overrideAccess: boolean\n populationPromises: Promise<void>[]\n req: PayloadRequest\n showHiddenFields: boolean\n siblingDoc: JsonObject\n}) => void\n\nexport type NodeValidation<T extends SerializedLexicalNode = SerializedLexicalNode> = ({\n node,\n nodeValidations,\n validation,\n}: {\n node: T\n nodeValidations: Map<string, Array<NodeValidation>>\n validation: {\n options: ValidateOptions<unknown, unknown, RichTextField, SerializedEditorState>\n value: SerializedEditorState\n }\n}) => Promise<string | true> | string | true\n\nexport type FeatureProviderProviderServer<\n UnSanitizedServerFeatureProps = undefined,\n ServerFeatureProps = UnSanitizedServerFeatureProps,\n ClientFeatureProps = undefined,\n> = (\n props?: UnSanitizedServerFeatureProps,\n) => FeatureProviderServer<UnSanitizedServerFeatureProps, ServerFeatureProps, ClientFeatureProps>\n\nexport type FeatureProviderServer<\n UnSanitizedServerFeatureProps = undefined,\n ServerFeatureProps = UnSanitizedServerFeatureProps,\n ClientFeatureProps = undefined,\n> = {\n /** Keys of dependencies needed for this feature. These dependencies do not have to be loaded first, but they have to exist, otherwise an error will be thrown. */\n dependencies?: string[]\n /** Keys of priority dependencies needed for this feature. These dependencies have to be loaded first AND have to exist, otherwise an error will be thrown. They will be available in the `feature` property. */\n dependenciesPriority?: string[]\n /** Keys of soft-dependencies needed for this feature. These are optional. Payload will attempt to load them before this feature, but doesn't throw an error if that's not possible. */\n dependenciesSoft?: string[]\n\n /**\n * This is being called during the payload sanitization process\n */\n feature:\n | ((props: {\n config: SanitizedConfig\n /** unSanitizedEditorConfig.features, but mapped */\n featureProviderMap: ServerFeatureProviderMap\n isRoot?: boolean\n parentIsLocalized: boolean\n // other resolved features, which have been loaded before this one. All features declared in 'dependencies' should be available here\n resolvedFeatures: ResolvedServerFeatureMap\n // unSanitized EditorConfig,\n unSanitizedEditorConfig: ServerEditorConfig\n }) =>\n | Promise<ServerFeature<ServerFeatureProps, ClientFeatureProps>>\n | ServerFeature<ServerFeatureProps, ClientFeatureProps>)\n | ServerFeature<ServerFeatureProps, ClientFeatureProps>\n key: string\n /** Props which were passed into your feature will have to be passed here. This will allow them to be used / read in other places of the code, e.g. wherever you can use useEditorConfigContext */\n serverFeatureProps: UnSanitizedServerFeatureProps\n}\n\nexport type AfterReadNodeHookArgs<T extends SerializedLexicalNode> = {\n /**\n * Only available in `afterRead` hooks.\n */\n currentDepth: number\n /**\n * Only available in `afterRead` hooks.\n */\n depth: number\n draft: boolean\n fallbackLocale: string\n /**\n * Only available in `afterRead` field hooks.\n */\n fieldPromises: Promise<void>[]\n /** Boolean to denote if this hook is running against finding one, or finding many within the afterRead hook. */\n findMany: boolean\n flattenLocales: boolean\n /**\n * The requested locale.\n */\n locale: string\n overrideAccess: boolean\n /**\n * Only available in `afterRead` hooks.\n */\n populateArg?: PopulateType\n /**\n * Only available in `afterRead` field hooks.\n */\n populationPromises: Promise<void>[]\n /**\n * Only available in `afterRead` hooks.\n */\n showHiddenFields: boolean\n /**\n * Only available in `afterRead` hooks.\n */\n triggerAccessControl: boolean\n /**\n * Only available in `afterRead` hooks.\n */\n triggerHooks: boolean\n}\n\nexport type AfterChangeNodeHookArgs<T extends SerializedLexicalNode> = {\n /** A string relating to which operation the field type is currently executing within. Useful within beforeValidate, beforeChange, and afterChange hooks to differentiate between create and update operations. */\n operation: 'create' | 'delete' | 'read' | 'update'\n /** The value of the node before any changes. Not available in afterRead hooks */\n originalNode: T\n}\nexport type BeforeValidateNodeHookArgs<T extends SerializedLexicalNode> = {\n /** A string relating to which operation the field type is currently executing within. Useful within beforeValidate, beforeChange, and afterChange hooks to differentiate between create and update operations. */\n operation: 'create' | 'delete' | 'read' | 'update'\n /** The value of the node before any changes. Not available in afterRead hooks */\n originalNode: T\n overrideAccess: boolean\n}\n\nexport type BeforeChangeNodeHookArgs<T extends SerializedLexicalNode> = {\n /**\n * Only available in `beforeChange` hooks.\n */\n errors: ValidationFieldError[]\n mergeLocaleActions: (() => Promise<void>)[]\n /** A string relating to which operation the field type is currently executing within. Useful within beforeValidate, beforeChange, and afterChange hooks to differentiate between create and update operations. */\n operation: 'create' | 'delete' | 'read' | 'update'\n /** The value of the node before any changes. Not available in afterRead hooks */\n originalNode: T\n /**\n * The original node with locales (not modified by any hooks).\n */\n originalNodeWithLocales?: T\n skipValidation: boolean\n}\n\nexport type BaseNodeHookArgs<T extends SerializedLexicalNode> = {\n context: RequestContext\n /** The value of the node. */\n node: T\n parentRichTextFieldPath: (number | string)[]\n parentRichTextFieldSchemaPath: string[]\n /** The payload request object. It is mocked for Local API operations. */\n req: PayloadRequest\n}\n\nexport type AfterReadNodeHook<T extends SerializedLexicalNode> = (\n args: AfterReadNodeHookArgs<T> & BaseNodeHookArgs<T>,\n) => Promise<T> | T\n\nexport type AfterChangeNodeHook<T extends SerializedLexicalNode> = (\n args: AfterChangeNodeHookArgs<T> & BaseNodeHookArgs<T>,\n) => Promise<T> | T\n\nexport type BeforeChangeNodeHook<T extends SerializedLexicalNode> = (\n args: BaseNodeHookArgs<T> & BeforeChangeNodeHookArgs<T>,\n) => Promise<T> | T\n\nexport type BeforeValidateNodeHook<T extends SerializedLexicalNode> = (\n args: BaseNodeHookArgs<T> & BeforeValidateNodeHookArgs<T>,\n) => Promise<T> | T\n\n// Define the node with hooks that use the node's exportJSON return type\nexport type NodeWithHooks<T extends LexicalNode = any> = {\n /**\n * Allows you to define how a node can be serialized into different formats. Currently, only supports html.\n * Markdown converters are defined in `markdownTransformers` and not here.\n */\n converters?: {\n html?: HTMLConverter<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>\n }\n /**\n * If a node includes sub-fields (e.g. block and link nodes), passing those subFields here will make payload\n * automatically populate, run hooks, and generate component import maps for them\n */\n getSubFields?: (args: {\n /**\n * Optional. If not provided, all possible sub-fields should be returned.\n */\n node?: ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>\n req?: PayloadRequest\n }) => Field[] | null\n /**\n * If a node includes sub-fields, the sub-fields data needs to be returned here, alongside `getSubFields` which returns their schema.\n */\n getSubFieldsData?: (args: {\n node: ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>\n req: PayloadRequest\n }) => JsonObject\n /**\n * Allows you to run population logic when a node's data was requested from graphQL.\n * While `getSubFields` and `getSubFieldsData` automatically handle populating sub-fields (since they run hooks on them), those are only populated in the Rest API.\n * This is because the Rest API hooks do not have access to the 'depth' property provided by graphQL.\n * In order for them to be populated correctly in graphQL, the population logic needs to be provided here.\n */\n graphQLPopulationPromises?: Array<\n PopulationPromise<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>\n >\n /**\n * Just like payload fields, you can provide hooks which are run for this specific node. These are called Node Hooks.\n */\n hooks?: {\n afterChange?: Array<AfterChangeNodeHook<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>>\n afterRead?: Array<AfterReadNodeHook<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>>\n beforeChange?: Array<BeforeChangeNodeHook<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>>\n beforeValidate?: Array<\n BeforeValidateNodeHook<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>\n >\n }\n /**\n * The actual lexical node needs to be provided here. This also supports [lexical node replacements](https://lexical.dev/docs/concepts/node-replacement).\n */\n node: Klass<T> | LexicalNodeReplacement\n /**\n * This allows you to provide node validations, which are run when your document is being validated, alongside other payload fields.\n * You can use it to throw a validation error for a specific node in case its data is incorrect.\n */\n validations?: Array<NodeValidation<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>>\n}\n\nexport type ServerFeature<ServerProps, ClientFeatureProps> = {\n ClientFeature?: PayloadComponent<never, BaseClientFeatureProps<ClientFeatureProps>>\n /**\n * This determines what props will be available on the Client.\n */\n clientFeatureProps?: ClientFeatureProps\n // @ts-expect-error - TODO: fix this\n componentImports?: Config['admin']['importMap']['generators'][0] | PayloadComponent[]\n generatedTypes?: {\n modifyOutputSchema: ({\n collectionIDFieldTypes,\n config,\n currentSchema,\n field,\n interfaceNameDefinitions,\n isRequired,\n }: {\n collectionIDFieldTypes: { [key: string]: 'number' | 'string' }\n config?: SanitizedConfig\n /**\n * Current schema which will be modified by this function.\n */\n currentSchema: JSONSchema4\n field: RichTextField<SerializedEditorState, AdapterProps>\n /**\n * Allows you to define new top-level interfaces that can be re-used in the output schema.\n */\n interfaceNameDefinitions: Map<string, JSONSchema4>\n isRequired: boolean\n }) => JSONSchema4\n }\n generateSchemaMap?: (args: {\n config: SanitizedConfig\n field: RichTextField\n i18n: I18nClient\n props: ServerProps\n schemaMap: FieldSchemaMap\n schemaPath: string\n }) => FieldSchemaMap | null\n hooks?: RichTextHooks\n /**\n * Here you can provide i18n translations for your feature. These will only be available on the server and client.\n *\n * Translations here are automatically scoped to `lexical.featureKey.yourKey`\n *\n * @Example\n * ```ts\n * i18n: {\n * en: {\n * label: 'Horizontal Rule',\n * },\n * de: {\n * label: 'Trennlinie',\n * },\n * }\n * ```\n * In order to access these translations, you would use `i18n.t('lexical:horizontalRule:label')`.\n */\n i18n?: Partial<GenericLanguages>\n markdownTransformers?: Transformer[]\n nodes?: Array<NodeWithHooks>\n\n /** Props which were passed into your feature will have to be passed here. This will allow them to be used / read in other places of the code, e.g. wherever you can use useEditorConfigContext */\n sanitizedServerFeatureProps?: ServerProps\n}\n\nexport type ResolvedServerFeature<ServerProps, ClientFeatureProps> = {\n order: number\n} & Required<\n Pick<\n FeatureProviderServer<ServerProps, ClientFeatureProps>,\n 'dependencies' | 'dependenciesPriority' | 'dependenciesSoft' | 'key'\n >\n> &\n ServerFeature<ServerProps, ClientFeatureProps>\n\nexport type ResolvedServerFeatureMap = Map<string, ResolvedServerFeature<any, any>>\n\nexport type ServerFeatureProviderMap = Map<string, FeatureProviderServer<any, any, any>>\n\nexport type SanitizedServerFeatures = {\n /** The node types mapped to their converters */\n converters: {\n html: HTMLConverter[]\n }\n /** The keys of all enabled features */\n enabledFeatures: string[]\n generatedTypes: {\n modifyOutputSchemas: Array<\n ({\n collectionIDFieldTypes,\n config,\n currentSchema,\n field,\n interfaceNameDefinitions,\n isRequired,\n }: {\n collectionIDFieldTypes: { [key: string]: 'number' | 'string' }\n config?: SanitizedConfig\n /**\n * Current schema which will be modified by this function.\n */\n currentSchema: JSONSchema4\n field: RichTextField<SerializedEditorState, AdapterProps>\n /**\n * Allows you to define new top-level interfaces that can be re-used in the output schema.\n */\n interfaceNameDefinitions: Map<string, JSONSchema4>\n isRequired: boolean\n }) => JSONSchema4\n >\n }\n /** The node types mapped to their hooks */\n\n getSubFields?: Map<\n string,\n (args: { node: SerializedLexicalNode; req: PayloadRequest }) => Field[] | null\n >\n getSubFieldsData?: Map<\n string,\n (args: { node: SerializedLexicalNode; req: PayloadRequest }) => JsonObject\n >\n graphQLPopulationPromises: Map<string, Array<PopulationPromise>>\n hooks: RichTextHooks\n nodeHooks?: {\n afterChange?: Map<string, Array<AfterChangeNodeHook<SerializedLexicalNode>>>\n afterRead?: Map<string, Array<AfterReadNodeHook<SerializedLexicalNode>>>\n beforeChange?: Map<string, Array<BeforeChangeNodeHook<SerializedLexicalNode>>>\n beforeValidate?: Map<string, Array<BeforeValidateNodeHook<SerializedLexicalNode>>>\n } /** The node types mapped to their populationPromises */\n /** The node types mapped to their validations */\n validations: Map<string, Array<NodeValidation>>\n} & Required<Pick<ResolvedServerFeature<any, any>, 'i18n' | 'markdownTransformers' | 'nodes'>>\n"],"mappings":"AAiXA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/upload/client/component/index.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAsE,MAAM,OAAO,CAAA;AAG1F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAA;AAWlE,OAAO,cAAc,CAAA;AAQrB,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,UAAU,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAmPD,eAAO,MAAM,eAAe,UAAW,YAAY,KAAG,KAAK,CAAC,SAM3D,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/upload/client/component/index.tsx"],"names":[],"mappings":"AAyBA,OAAO,KAAsE,MAAM,OAAO,CAAA;AAG1F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAA;AAWlE,OAAO,cAAc,CAAA;AAQrB,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,UAAU,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAuPD,eAAO,MAAM,eAAe,UAAW,YAAY,KAAG,KAAK,CAAC,SAM3D,CAAA"}
@@ -49,7 +49,10 @@ const Component = props => {
49
49
  const [isSelected, setSelected, clearSelection] = useLexicalNodeSelection(nodeKey);
50
50
  const {
51
51
  editorConfig,
52
- field
52
+ fieldProps: {
53
+ readOnly,
54
+ schemaPath
55
+ }
53
56
  } = useEditorConfigContext();
54
57
  const {
55
58
  i18n,
@@ -167,7 +170,7 @@ const Component = props => {
167
170
  children: [hasExtraFields ? /*#__PURE__*/_jsx(Button, {
168
171
  buttonStyle: "icon-label",
169
172
  className: `${baseClass}__upload-drawer-toggler`,
170
- disabled: field?.admin?.readOnly,
173
+ disabled: readOnly,
171
174
  el: "button",
172
175
  icon: "edit",
173
176
  onClick: () => {
@@ -178,7 +181,7 @@ const Component = props => {
178
181
  }) : null, /*#__PURE__*/_jsx(Button, {
179
182
  buttonStyle: "icon-label",
180
183
  className: `${baseClass}__swap-drawer-toggler`,
181
- disabled: field?.admin?.readOnly,
184
+ disabled: readOnly,
182
185
  el: "button",
183
186
  icon: "swap",
184
187
  onClick: () => {
@@ -193,7 +196,7 @@ const Component = props => {
193
196
  }), /*#__PURE__*/_jsx(Button, {
194
197
  buttonStyle: "icon-label",
195
198
  className: `${baseClass}__removeButton`,
196
- disabled: field?.admin?.readOnly,
199
+ disabled: readOnly,
197
200
  icon: "x",
198
201
  onClick: e => {
199
202
  e.preventDefault();
@@ -223,6 +226,7 @@ const Component = props => {
223
226
  }),
224
227
  featureKey: "upload",
225
228
  handleDrawerSubmit: onExtraFieldsDrawerSubmit,
229
+ schemaPath: schemaPath,
226
230
  schemaPathSuffix: relatedCollection.slug
227
231
  }) : null]
228
232
  });