@payloadcms/richtext-lexical 3.61.0-canary.5 → 3.61.0-internal.dd40839

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 (167) hide show
  1. package/dist/cell/rscEntry.d.ts +2 -10
  2. package/dist/cell/rscEntry.d.ts.map +1 -1
  3. package/dist/cell/rscEntry.js +1 -2
  4. package/dist/cell/rscEntry.js.map +1 -1
  5. package/dist/exports/client/Field-5VLZM7KJ.js +2 -0
  6. package/dist/exports/client/Field-5VLZM7KJ.js.map +7 -0
  7. package/dist/exports/client/RelationshipComponent-UCIWIEVD.js +2 -0
  8. package/dist/exports/client/RelationshipComponent-UCIWIEVD.js.map +7 -0
  9. package/dist/exports/client/bundled.css +1 -1
  10. package/dist/exports/client/chunk-52JG5GGJ.js +2 -0
  11. package/dist/exports/client/chunk-52JG5GGJ.js.map +7 -0
  12. package/dist/exports/client/chunk-U4AOQOHA.js +12 -0
  13. package/dist/exports/client/chunk-U4AOQOHA.js.map +7 -0
  14. package/dist/exports/client/component-5YLBQB5B.js +2 -0
  15. package/dist/exports/client/component-5YLBQB5B.js.map +7 -0
  16. package/dist/exports/client/componentInline-QEXUNJU4.js +2 -0
  17. package/dist/exports/client/index.js +22 -22
  18. package/dist/exports/client/index.js.map +3 -3
  19. package/dist/exports/react/index.d.ts +1 -1
  20. package/dist/exports/react/index.d.ts.map +1 -1
  21. package/dist/exports/react/index.js.map +1 -1
  22. package/dist/features/blocks/client/component/BlockContent.js +1 -1
  23. package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
  24. package/dist/features/blocks/client/component/index.d.ts +1 -0
  25. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  26. package/dist/features/blocks/client/component/index.js +23 -20
  27. package/dist/features/blocks/client/component/index.js.map +1 -1
  28. package/dist/features/blocks/client/componentInline/index.d.ts +2 -1
  29. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  30. package/dist/features/blocks/client/componentInline/index.js +6 -6
  31. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  32. package/dist/features/blocks/client/nodes/BlocksNode.d.ts +1 -1
  33. package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
  34. package/dist/features/blocks/client/nodes/BlocksNode.js +2 -1
  35. package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
  36. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts +1 -1
  37. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts.map +1 -1
  38. package/dist/features/blocks/client/nodes/InlineBlocksNode.js +2 -1
  39. package/dist/features/blocks/client/nodes/InlineBlocksNode.js.map +1 -1
  40. package/dist/features/blocks/server/nodes/BlocksNode.d.ts +1 -0
  41. package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
  42. package/dist/features/blocks/server/nodes/BlocksNode.js +6 -0
  43. package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
  44. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts +1 -1
  45. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts.map +1 -1
  46. package/dist/features/blocks/server/nodes/InlineBlocksNode.js +3 -2
  47. package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
  48. package/dist/features/converters/lexicalToJSX/Component/index.d.ts +2 -14
  49. package/dist/features/converters/lexicalToJSX/Component/index.d.ts.map +1 -1
  50. package/dist/features/converters/lexicalToJSX/Component/index.js +4 -2
  51. package/dist/features/converters/lexicalToJSX/Component/index.js.map +1 -1
  52. package/dist/features/converters/lexicalToJSX/converter/index.d.ts +16 -1
  53. package/dist/features/converters/lexicalToJSX/converter/index.d.ts.map +1 -1
  54. package/dist/features/converters/lexicalToJSX/converter/index.js +76 -4
  55. package/dist/features/converters/lexicalToJSX/converter/index.js.map +1 -1
  56. package/dist/features/converters/lexicalToJSX/converter/types.d.ts +14 -10
  57. package/dist/features/converters/lexicalToJSX/converter/types.d.ts.map +1 -1
  58. package/dist/features/converters/lexicalToJSX/converter/types.js.map +1 -1
  59. package/dist/features/debug/jsxConverter/client/plugin/index.js +1 -1
  60. package/dist/features/debug/jsxConverter/client/plugin/index.js.map +1 -1
  61. package/dist/features/relationship/client/components/RelationshipComponent.d.ts +1 -1
  62. package/dist/features/relationship/client/components/RelationshipComponent.d.ts.map +1 -1
  63. package/dist/features/relationship/client/components/RelationshipComponent.js +2 -2
  64. package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
  65. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts +1 -0
  66. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
  67. package/dist/features/relationship/server/nodes/RelationshipNode.js +6 -0
  68. package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
  69. package/dist/features/typesServer.d.ts +2 -2
  70. package/dist/features/typesServer.d.ts.map +1 -1
  71. package/dist/features/typesServer.js.map +1 -1
  72. package/dist/features/upload/client/component/index.d.ts +1 -0
  73. package/dist/features/upload/client/component/index.d.ts.map +1 -1
  74. package/dist/features/upload/client/component/index.js +2 -2
  75. package/dist/features/upload/client/component/index.js.map +1 -1
  76. package/dist/features/upload/client/nodes/UploadNode.d.ts +2 -2
  77. package/dist/features/upload/client/nodes/UploadNode.d.ts.map +1 -1
  78. package/dist/features/upload/client/nodes/UploadNode.js +2 -1
  79. package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
  80. package/dist/features/upload/server/nodes/UploadNode.d.ts +2 -1
  81. package/dist/features/upload/server/nodes/UploadNode.d.ts.map +1 -1
  82. package/dist/features/upload/server/nodes/UploadNode.js +6 -0
  83. package/dist/features/upload/server/nodes/UploadNode.js.map +1 -1
  84. package/dist/field/Field.d.ts.map +1 -1
  85. package/dist/field/Field.js +50 -38
  86. package/dist/field/Field.js.map +1 -1
  87. package/dist/field/RichTextViewProvider.d.ts +84 -0
  88. package/dist/field/RichTextViewProvider.d.ts.map +1 -0
  89. package/dist/field/RichTextViewProvider.js +92 -0
  90. package/dist/field/RichTextViewProvider.js.map +1 -0
  91. package/dist/field/ViewSelector.d.ts +4 -0
  92. package/dist/field/ViewSelector.d.ts.map +1 -0
  93. package/dist/field/ViewSelector.js +89 -0
  94. package/dist/field/ViewSelector.js.map +1 -0
  95. package/dist/field/bundled.css +1 -1
  96. package/dist/field/index.d.ts.map +1 -1
  97. package/dist/field/index.js +63 -41
  98. package/dist/field/index.js.map +1 -1
  99. package/dist/field/rscEntry.d.ts +2 -3
  100. package/dist/field/rscEntry.d.ts.map +1 -1
  101. package/dist/field/rscEntry.js +15 -1
  102. package/dist/field/rscEntry.js.map +1 -1
  103. package/dist/index.d.ts +1 -1
  104. package/dist/index.d.ts.map +1 -1
  105. package/dist/index.js +9 -24
  106. package/dist/index.js.map +1 -1
  107. package/dist/lexical/LexicalEditor.d.ts.map +1 -1
  108. package/dist/lexical/LexicalEditor.js +2 -1
  109. package/dist/lexical/LexicalEditor.js.map +1 -1
  110. package/dist/lexical/LexicalProvider.d.ts.map +1 -1
  111. package/dist/lexical/LexicalProvider.js +12 -3
  112. package/dist/lexical/LexicalProvider.js.map +1 -1
  113. package/dist/lexical/config/client/loader.d.ts.map +1 -1
  114. package/dist/lexical/config/client/loader.js +2 -4
  115. package/dist/lexical/config/client/loader.js.map +1 -1
  116. package/dist/lexical/nodes/index.d.ts +12 -2
  117. package/dist/lexical/nodes/index.d.ts.map +1 -1
  118. package/dist/lexical/nodes/index.js +195 -2
  119. package/dist/lexical/nodes/index.js.map +1 -1
  120. package/dist/lexical/plugins/NodeViewOverridePlugin/index.d.ts +2 -0
  121. package/dist/lexical/plugins/NodeViewOverridePlugin/index.d.ts.map +1 -0
  122. package/dist/lexical/plugins/NodeViewOverridePlugin/index.js +48 -0
  123. package/dist/lexical/plugins/NodeViewOverridePlugin/index.js.map +1 -0
  124. package/dist/lexical/plugins/handles/utils/setHandlePosition.d.ts.map +1 -1
  125. package/dist/lexical/plugins/handles/utils/setHandlePosition.js +1 -1
  126. package/dist/lexical/plugins/handles/utils/setHandlePosition.js.map +1 -1
  127. package/dist/lexical/theme/EditorTheme.d.ts.map +1 -1
  128. package/dist/lexical/theme/EditorTheme.js +3 -39
  129. package/dist/lexical/theme/EditorTheme.js.map +1 -1
  130. package/dist/lexical/ui/ContentEditable.d.ts.map +1 -1
  131. package/dist/lexical/ui/ContentEditable.js +16 -9
  132. package/dist/lexical/ui/ContentEditable.js.map +1 -1
  133. package/dist/types.d.ts +138 -4
  134. package/dist/types.d.ts.map +1 -1
  135. package/dist/types.js.map +1 -1
  136. package/dist/utilities/editorConfigFactory.js +1 -1
  137. package/dist/utilities/editorConfigFactory.js.map +1 -1
  138. package/dist/utilities/generateImportMap.d.ts +2 -0
  139. package/dist/utilities/generateImportMap.d.ts.map +1 -1
  140. package/dist/utilities/generateImportMap.js +6 -13
  141. package/dist/utilities/generateImportMap.js.map +1 -1
  142. package/dist/{getDefaultSanitizedEditorConfig.d.ts → utilities/getDefaultSanitizedEditorConfig.d.ts} +1 -1
  143. package/dist/utilities/getDefaultSanitizedEditorConfig.d.ts.map +1 -0
  144. package/dist/{getDefaultSanitizedEditorConfig.js → utilities/getDefaultSanitizedEditorConfig.js} +2 -2
  145. package/dist/utilities/getDefaultSanitizedEditorConfig.js.map +1 -0
  146. package/dist/utilities/initLexicalFeatures.d.ts.map +1 -1
  147. package/dist/utilities/initLexicalFeatures.js +12 -13
  148. package/dist/utilities/initLexicalFeatures.js.map +1 -1
  149. package/dist/validate/hasText.d.ts +6 -1
  150. package/dist/validate/hasText.d.ts.map +1 -1
  151. package/dist/validate/hasText.js +10 -4
  152. package/dist/validate/hasText.js.map +1 -1
  153. package/package.json +6 -6
  154. package/dist/exports/client/Field-YYMTSGSP.js +0 -2
  155. package/dist/exports/client/Field-YYMTSGSP.js.map +0 -7
  156. package/dist/exports/client/RelationshipComponent-JXQOFHXF.js +0 -2
  157. package/dist/exports/client/RelationshipComponent-JXQOFHXF.js.map +0 -7
  158. package/dist/exports/client/chunk-AFXLIYGL.js +0 -12
  159. package/dist/exports/client/chunk-AFXLIYGL.js.map +0 -7
  160. package/dist/exports/client/chunk-RPFDD27K.js +0 -2
  161. package/dist/exports/client/chunk-RPFDD27K.js.map +0 -7
  162. package/dist/exports/client/component-WT25HAJA.js +0 -2
  163. package/dist/exports/client/component-WT25HAJA.js.map +0 -7
  164. package/dist/exports/client/componentInline-BVC77WQC.js +0 -2
  165. package/dist/getDefaultSanitizedEditorConfig.d.ts.map +0 -1
  166. package/dist/getDefaultSanitizedEditorConfig.js.map +0 -1
  167. /package/dist/exports/client/{componentInline-BVC77WQC.js.map → componentInline-QEXUNJU4.js.map} +0 -0
@@ -1,12 +1,4 @@
1
- import type { Payload } from 'payload';
2
- import { type I18nClient } from '@payloadcms/translations';
3
1
  import React from 'react';
4
- import type { SanitizedServerEditorConfig } from '../lexical/config/types.js';
5
- import type { LexicalFieldAdminProps, LexicalRichTextCellProps } from '../types.js';
6
- export declare const RscEntryLexicalCell: React.FC<{
7
- admin: LexicalFieldAdminProps;
8
- i18n: I18nClient;
9
- payload: Payload;
10
- sanitizedEditorConfig: SanitizedServerEditorConfig;
11
- } & LexicalRichTextCellProps>;
2
+ import type { LexicalRichTextCellProps } from '../types.js';
3
+ export declare const RscEntryLexicalCell: React.FC<LexicalRichTextCellProps>;
12
4
  //# sourceMappingURL=rscEntry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rscEntry.d.ts","sourceRoot":"","sources":["../../src/cell/rscEntry.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEtC,OAAO,EAAkB,KAAK,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAG1E,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAA;AAC7E,OAAO,KAAK,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AAuBnF,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CACxC;IACE,KAAK,EAAE,sBAAsB,CAAA;IAC7B,IAAI,EAAE,UAAU,CAAA;IAChB,OAAO,EAAE,OAAO,CAAA;IAChB,qBAAqB,EAAE,2BAA2B,CAAA;CACnD,GAAG,wBAAwB,CA4E7B,CAAA"}
1
+ {"version":3,"file":"rscEntry.d.ts","sourceRoot":"","sources":["../../src/cell/rscEntry.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AAuB3D,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CA0ElE,CAAA"}
@@ -34,8 +34,7 @@ export const RscEntryLexicalCell = props => {
34
34
  link,
35
35
  onClick: onClickFromProps,
36
36
  payload,
37
- rowData,
38
- sanitizedEditorConfig
37
+ rowData
39
38
  } = props;
40
39
  const classNameFromConfigContext = admin && 'className' in admin ? admin.className : undefined;
41
40
  const className = classNameFromProps || (field.admin && 'className' in field.admin ? field.admin.className : null) || classNameFromConfigContext;
@@ -1 +1 @@
1
- {"version":3,"file":"rscEntry.js","names":["getTranslation","Link","formatAdminURL","React","recurseEditorState","editorState","textContent","i","node","text","push","_jsxs","type","children","RscEntryLexicalCell","props","cellData","className","classNameFromProps","collectionConfig","field","admin","i18n","link","onClick","onClickFromProps","payload","rowData","sanitizedEditorConfig","classNameFromConfigContext","undefined","adminRoute","config","routes","WrapElement","wrapElementProps","prefetch","href","slug","path","id","collectionSlug","root","length","t","label","_jsx"],"sources":["../../src/cell/rscEntry.tsx"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\nimport type { Payload } from 'payload'\n\nimport { getTranslation, type I18nClient } from '@payloadcms/translations'\nimport { Link } from '@payloadcms/ui'\nimport { formatAdminURL } from 'payload/shared'\nimport React from 'react'\n\nimport type { SanitizedServerEditorConfig } from '../lexical/config/types.js'\nimport type { LexicalFieldAdminProps, LexicalRichTextCellProps } from '../types.js'\n\nfunction recurseEditorState(\n editorState: SerializedLexicalNode[],\n textContent: React.ReactNode[],\n i: number = 0,\n): React.ReactNode[] {\n for (const node of editorState) {\n i++\n if ('text' in node && node.text) {\n textContent.push(node.text as string)\n } else {\n if (!('children' in node)) {\n textContent.push(<code key={i}>&#32;[{node.type}]</code>)\n }\n }\n if ('children' in node && node.children) {\n textContent = recurseEditorState(node.children as SerializedLexicalNode[], textContent, i)\n }\n }\n return textContent\n}\n\nexport const RscEntryLexicalCell: React.FC<\n {\n admin: LexicalFieldAdminProps\n i18n: I18nClient\n payload: Payload\n sanitizedEditorConfig: SanitizedServerEditorConfig\n } & LexicalRichTextCellProps\n> = (props) => {\n const {\n cellData,\n className: classNameFromProps,\n collectionConfig,\n field: { admin },\n field,\n i18n,\n link,\n onClick: onClickFromProps,\n payload,\n rowData,\n sanitizedEditorConfig,\n } = props\n\n const classNameFromConfigContext = admin && 'className' in admin ? admin.className : undefined\n\n const className =\n classNameFromProps ||\n (field.admin && 'className' in field.admin ? field.admin.className : null) ||\n classNameFromConfigContext\n const adminRoute = payload.config.routes.admin\n\n const onClick = onClickFromProps\n\n let WrapElement: React.ComponentType<any> | string = 'span'\n\n const wrapElementProps: {\n className?: string\n href?: string\n onClick?: () => void\n prefetch?: false\n type?: 'button'\n } = {\n className,\n }\n\n if (link) {\n wrapElementProps.prefetch = false\n WrapElement = Link\n wrapElementProps.href = collectionConfig?.slug\n ? formatAdminURL({\n adminRoute,\n path: `/collections/${collectionConfig?.slug}/${rowData.id}`,\n })\n : ''\n }\n\n if (typeof onClick === 'function') {\n WrapElement = 'button'\n wrapElementProps.type = 'button'\n wrapElementProps.onClick = () => {\n onClick({\n cellData,\n collectionSlug: collectionConfig?.slug,\n rowData,\n })\n }\n }\n\n let textContent: React.ReactNode[] = []\n\n if (cellData?.root?.children) {\n textContent = recurseEditorState(cellData?.root?.children, textContent)\n }\n\n if (!textContent?.length) {\n textContent = [\n i18n.t('general:noLabel', {\n label: getTranslation(('label' in field ? field.label : null) || 'data', i18n),\n }),\n ]\n }\n\n return <WrapElement {...wrapElementProps}>{textContent}</WrapElement>\n}\n"],"mappings":";AAGA,SAASA,cAAc,QAAyB;AAChD,SAASC,IAAI,QAAQ;AACrB,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,MAAW;AAKlB,SAASC,mBACPC,WAAoC,EACpCC,WAA8B,EAC9BC,CAAA,GAAY,CAAC;EAEb,KAAK,MAAMC,IAAA,IAAQH,WAAA,EAAa;IAC9BE,CAAA;IACA,IAAI,UAAUC,IAAA,IAAQA,IAAA,CAAKC,IAAI,EAAE;MAC/BH,WAAA,CAAYI,IAAI,CAACF,IAAA,CAAKC,IAAI;IAC5B,OAAO;MACL,IAAI,EAAE,cAAcD,IAAG,GAAI;QACzBF,WAAA,CAAYI,IAAI,cAACC,KAAA,CAAC;qBAAa,MAAOH,IAAA,CAAKI,IAAI,EAAC;WAApBL,CAAA;MAC9B;IACF;IACA,IAAI,cAAcC,IAAA,IAAQA,IAAA,CAAKK,QAAQ,EAAE;MACvCP,WAAA,GAAcF,kBAAA,CAAmBI,IAAA,CAAKK,QAAQ,EAA6BP,WAAA,EAAaC,CAAA;IAC1F;EACF;EACA,OAAOD,WAAA;AACT;AAEA,OAAO,MAAMQ,mBAAA,GAORC,KAAA;EACH,MAAM;IACJC,QAAQ;IACRC,SAAA,EAAWC,kBAAkB;IAC7BC,gBAAgB;IAChBC,KAAA,EAAO;MAAEC;IAAK,CAAE;IAChBD,KAAK;IACLE,IAAI;IACJC,IAAI;IACJC,OAAA,EAASC,gBAAgB;IACzBC,OAAO;IACPC,OAAO;IACPC;EAAqB,CACtB,GAAGb,KAAA;EAEJ,MAAMc,0BAAA,GAA6BR,KAAA,IAAS,eAAeA,KAAA,GAAQA,KAAA,CAAMJ,SAAS,GAAGa,SAAA;EAErF,MAAMb,SAAA,GACJC,kBAAA,KACCE,KAAA,CAAMC,KAAK,IAAI,eAAeD,KAA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AgB;cAAG7B;;AAC7C","ignoreList":[]}
1
+ {"version":3,"file":"rscEntry.js","names":["getTranslation","Link","formatAdminURL","React","recurseEditorState","editorState","textContent","i","node","text","push","_jsxs","type","children","RscEntryLexicalCell","props","cellData","className","classNameFromProps","collectionConfig","field","admin","i18n","link","onClick","onClickFromProps","payload","rowData","classNameFromConfigContext","undefined","adminRoute","config","routes","WrapElement","wrapElementProps","prefetch","href","slug","path","id","collectionSlug","root","length","t","label","_jsx"],"sources":["../../src/cell/rscEntry.tsx"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { Link } from '@payloadcms/ui'\nimport { formatAdminURL } from 'payload/shared'\nimport React from 'react'\n\nimport type { LexicalRichTextCellProps } from '../types.js'\n\nfunction recurseEditorState(\n editorState: SerializedLexicalNode[],\n textContent: React.ReactNode[],\n i: number = 0,\n): React.ReactNode[] {\n for (const node of editorState) {\n i++\n if ('text' in node && node.text) {\n textContent.push(node.text as string)\n } else {\n if (!('children' in node)) {\n textContent.push(<code key={i}>&#32;[{node.type}]</code>)\n }\n }\n if ('children' in node && node.children) {\n textContent = recurseEditorState(node.children as SerializedLexicalNode[], textContent, i)\n }\n }\n return textContent\n}\n\nexport const RscEntryLexicalCell: React.FC<LexicalRichTextCellProps> = (props) => {\n const {\n cellData,\n className: classNameFromProps,\n collectionConfig,\n field: { admin },\n field,\n i18n,\n link,\n onClick: onClickFromProps,\n payload,\n rowData,\n } = props\n\n const classNameFromConfigContext = admin && 'className' in admin ? admin.className : undefined\n\n const className =\n classNameFromProps ||\n (field.admin && 'className' in field.admin ? field.admin.className : null) ||\n classNameFromConfigContext\n const adminRoute = payload.config.routes.admin\n\n const onClick = onClickFromProps\n\n let WrapElement: React.ComponentType<any> | string = 'span'\n\n const wrapElementProps: {\n className?: string\n href?: string\n onClick?: () => void\n prefetch?: false\n type?: 'button'\n } = {\n className,\n }\n\n if (link) {\n wrapElementProps.prefetch = false\n WrapElement = Link\n wrapElementProps.href = collectionConfig?.slug\n ? formatAdminURL({\n adminRoute,\n path: `/collections/${collectionConfig?.slug}/${rowData.id}`,\n })\n : ''\n }\n\n if (typeof onClick === 'function') {\n WrapElement = 'button'\n wrapElementProps.type = 'button'\n wrapElementProps.onClick = () => {\n onClick({\n cellData,\n collectionSlug: collectionConfig?.slug,\n rowData,\n })\n }\n }\n\n let textContent: React.ReactNode[] = []\n\n if (cellData?.root?.children) {\n textContent = recurseEditorState(cellData?.root?.children, textContent)\n }\n\n if (!textContent?.length) {\n textContent = [\n i18n.t('general:noLabel', {\n label: getTranslation(('label' in field ? field.label : null) || 'data', i18n),\n }),\n ]\n }\n\n return <WrapElement {...wrapElementProps}>{textContent}</WrapElement>\n}\n"],"mappings":";AAEA,SAASA,cAAc,QAAQ;AAC/B,SAASC,IAAI,QAAQ;AACrB,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,MAAW;AAIlB,SAASC,mBACPC,WAAoC,EACpCC,WAA8B,EAC9BC,CAAA,GAAY,CAAC;EAEb,KAAK,MAAMC,IAAA,IAAQH,WAAA,EAAa;IAC9BE,CAAA;IACA,IAAI,UAAUC,IAAA,IAAQA,IAAA,CAAKC,IAAI,EAAE;MAC/BH,WAAA,CAAYI,IAAI,CAACF,IAAA,CAAKC,IAAI;IAC5B,OAAO;MACL,IAAI,EAAE,cAAcD,IAAG,GAAI;QACzBF,WAAA,CAAYI,IAAI,cAACC,KAAA,CAAC;qBAAa,MAAOH,IAAA,CAAKI,IAAI,EAAC;WAApBL,CAAA;MAC9B;IACF;IACA,IAAI,cAAcC,IAAA,IAAQA,IAAA,CAAKK,QAAQ,EAAE;MACvCP,WAAA,GAAcF,kBAAA,CAAmBI,IAAA,CAAKK,QAAQ,EAA6BP,WAAA,EAAaC,CAAA;IAC1F;EACF;EACA,OAAOD,WAAA;AACT;AAEA,OAAO,MAAMQ,mBAAA,GAA2DC,KAAA;EACtE,MAAM;IACJC,QAAQ;IACRC,SAAA,EAAWC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AA,EAAUyB,IAAA,EAAM5B,QAAA,EAAUP,WAAA;EAC7D;EAEA,IAAI,CAACA,WAAA,EAAaoC,MAAA,EAAQ;IACxBpC,WAAA,GAAc,CACZgB,IAAA,CAAKqB,CAAC,CAAC,mBAAmB;MACxBC,KAAA,EAAO5C,cAAA,CAAe,CAAC,WAAWoB,KAAA,GAAQA,KAAA,CAAMwB,KAAK,GAAG,IAAG,KAAM,QAAQtB,IAAA;IAC3E,GACD;EACH;EAEA,oBAAOuB,IAAA,CAACZ,WAAA;IAAa,GAAGC,gBAAgB;cAAG5B;;AAC7C","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ "use client";import{a as De,e as Le,f as O,h as Me,i as Ae,j as Be,k as Ie,l as be,m as Ce,n as Oe}from"./chunk-U4AOQOHA.js";import{a as _e,b as S}from"./chunk-BZZVLW4U.js";import{jsx as D,jsxs as ie}from"react/jsx-runtime";import{FieldDescription as Zn,FieldError as er,FieldLabel as tr,RenderCustomComponent as Lt,useEditDepth as or,useEffectEvent as nr,useField as rr}from"@payloadcms/ui";import{mergeFieldStyles as ir}from"@payloadcms/ui/shared";import{dequal as sr}from"dequal/lite";import Mt,{useCallback as At,useEffect as Bt,useMemo as lr,useState as Te}from"react";import{ErrorBoundary as ar}from"react-error-boundary";import"./bundled.css";import{jsx as F}from"react/jsx-runtime";import{LexicalComposer as zn}from"@lexical/react/LexicalComposer.js";import{useEditDepth as Wn}from"@payloadcms/ui";import*as Tt from"react";import{useMemo as Yn}from"react";import{jsx as Vt}from"react/jsx-runtime";import{createContext as jt,use as Kt,useMemo as Fe}from"react";var $e=jt({currentView:"default",currentViewMap:void 0,setCurrentView:void 0,views:void 0}),Ve=({children:e,currentView:t="default",setCurrentView:o,views:n})=>{let r=Fe(()=>{if(n)return n[t]||n.default},[n,t]),a=Fe(()=>({currentView:t,currentViewMap:r,setCurrentView:o,views:n}),[t,o,r,n]);return Vt($e,{value:a,children:e})};function z(){let e=Kt($e);if(!e)throw new Error("useRichTextView must be used within a RichTextViewProvider");return e}import{c as kn}from"react/compiler-runtime";import{jsx as E,jsxs as ne}from"react/jsx-runtime";import{useLexicalComposerContext as vn}from"@lexical/react/LexicalComposerContext.js";import{LexicalErrorBoundary as _n}from"@lexical/react/LexicalErrorBoundary.js";import{HistoryPlugin as Dn}from"@lexical/react/LexicalHistoryPlugin.js";import{OnChangePlugin as Ln}from"@lexical/react/LexicalOnChangePlugin.js";import{RichTextPlugin as Mn}from"@lexical/react/LexicalRichTextPlugin.js";import{useLexicalEditable as An}from"@lexical/react/useLexicalEditable";import{BLUR_COMMAND as Bn,COMMAND_PRIORITY_LOW as St,FOCUS_COMMAND as In}from"lexical";import*as J from"react";import{useEffect as On,useState as Fn}from"react";import{jsx as je}from"react/jsx-runtime";import"react";var $=({anchorElem:e,clientProps:t,plugin:o})=>o.position==="floatingAnchorElem"&&e?o.Component&&je(o.Component,{anchorElem:e,clientProps:t}):o.Component&&je(o.Component,{clientProps:t});import{c as Ht}from"react/compiler-runtime";import{copyToClipboard as zt}from"@lexical/clipboard";import{useLexicalComposerContext as Wt}from"@lexical/react/LexicalComposerContext.js";import{objectKlassEquals as Yt}from"@lexical/utils";import Ke from"bson-objectid";import{COMMAND_PRIORITY_LOW as Gt,COPY_COMMAND as Ut}from"lexical";import{useEffect as qt}from"react";function He(){let e=Ht(3),[t]=Wt(),o,n;return e[0]!==t?(o=()=>t.registerCommand(Ut,r=>(zt(t,Yt(r,ClipboardEvent)?r:null).then(()=>{if(!(r instanceof ClipboardEvent)||!r.clipboardData)throw new Error("No clipboard event");let a=r.clipboardData.getData("application/x-lexical-editor");if(!a)return!0;let i=JSON.parse(a),l=d=>{if("fields"in d&&typeof d.fields=="object"&&d.fields!==null&&"id"in d.fields?d.fields.id=new Ke.default().toHexString():"id"in d&&(d.id=new Ke.default().toHexString()),d.children)for(let x of d.children)l(x)};for(let d of i.nodes)l(d);let u=JSON.stringify(i);r.clipboardData.setData("application/x-lexical-editor",u)}).catch(a=>{throw r instanceof ClipboardEvent&&r.clipboardData?.setData("application/x-lexical-editor",""),a}),!0),Gt),n=[t],e[0]=t,e[1]=o,e[2]=n):(o=e[1],n=e[2]),qt(o,n),null}import{c as Jt}from"react/compiler-runtime";import{useLexicalComposerContext as Qt}from"@lexical/react/LexicalComposerContext";import{$findMatchingParent as le,mergeRegister as Xt}from"@lexical/utils";import{$createNodeSelection as Zt,$getEditor as ee,$getNearestNodeFromDOMNode as eo,$getSelection as ae,$isDecoratorNode as V,$isElementNode as Ne,$isLineBreakNode as to,$isNodeSelection as ce,$isRangeSelection as ze,$isRootOrShadowRoot as oo,$isTextNode as no,$setSelection as We,CLICK_COMMAND as ro,COMMAND_PRIORITY_LOW as W,KEY_ARROW_DOWN_COMMAND as io,KEY_ARROW_UP_COMMAND as so,KEY_BACKSPACE_COMMAND as lo,KEY_DELETE_COMMAND as ao,SELECTION_CHANGE_COMMAND as co}from"lexical";import{useEffect as uo}from"react";function Ye(){let e=Jt(3),[t]=Qt(),o=yo,n,r;return e[0]!==t?(n=()=>Xt(t.registerCommand(ro,xo,W),t.registerCommand(ao,o,W),t.registerCommand(lo,o,W),t.registerCommand(co,ho,W),t.registerCommand(so,po,W),t.registerCommand(io,fo,W)),r=[t],e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]),uo(n,r),null}function fo(e){let t=ae();if(ce(t)){e.preventDefault();let i=t.getNodes()[0]?.getNextSibling();if(V(i)){let d=ee().getElementByKey(i.getKey());return d&&te({element:d,node:i}),!0}if(!Ne(i))return!0;let l=i.getFirstDescendant()??i;return l&&(le(l,ue)?.selectEnd(),e.preventDefault()),!0}if(!ze(t))return!1;let n=(t.isBackward()?t.anchor:t.focus).getNode(),r=le(n,mo),a=r?.getNextSibling();if(!r||a!==Ge(r))return!1;if(V(a)){let i=ee().getElementByKey(a.getKey());if(i)return te({element:i,node:a}),e.preventDefault(),!0}return!1}function mo(e){return Ge(e)!==null}function po(e){let t=ae();if(ce(t)){let i=t.getNodes()[0]?.getPreviousSibling();if(V(i)){let d=ee().getElementByKey(i.getKey());return d?(te({element:d,node:i}),e.preventDefault(),!0):!1}if(!Ne(i))return!1;let l=i.getLastDescendant()??i;return l?(le(l,ue)?.selectStart(),e.preventDefault(),!0):!1}if(!ze(t))return!1;let n=(t.isBackward()?t.anchor:t.focus).getNode(),r=le(n,go),a=r?.getPreviousSibling();if(!r||a!==Ue(r))return!1;if(V(a)){let i=ee().getElementByKey(a.getKey());if(i)return te({element:i,node:a}),e.preventDefault(),!0}return!1}function go(e){return Ue(e)!==null}function ho(){let e=Co();return document.querySelector(".decorator-selected")?.classList.remove("decorator-selected"),e?(e.element?.classList.add("decorator-selected"),!0):!1}function xo(e){document.querySelector(".decorator-selected")?.classList.remove("decorator-selected");let t=bo(e);if(!t)return!0;let{target:o}=e;return!(o instanceof HTMLElement)||o.isContentEditable||o.closest('button, textarea, input, .react-select, .code-editor, .no-select-decorator, [role="button"]')?We(null):te(t),!0}function yo(e){let t=ae();return ce(t)?(e.preventDefault(),t.getNodes().forEach(Eo),!0):!1}function Eo(e){e.remove()}function bo(e){if(!(e.target instanceof HTMLElement))return;let t=e.target.closest('[data-lexical-decorator="true"]');if(!(t instanceof HTMLElement))return;let o=eo(t);return V(o)?{element:t,node:o}:void 0}function Co(){let e=ae();if(!ce(e))return;let t=e.getNodes();if(t.length!==1)return;let o=t[0];return V(o)?{decorator:o,element:ee().getElementByKey(o.getKey())}:void 0}function te({element:e,node:t}){document.querySelector(".decorator-selected")?.classList.remove("decorator-selected");let o=Zt();o.add(t.getKey()),We(o),e.scrollIntoView({behavior:"smooth",block:"nearest"}),e.classList.add("decorator-selected")}function ue(e){if(V(e)&&!e.isInline())return!0;if(!Ne(e)||oo(e))return!1;let t=e.getFirstChild(),o=t===null||to(t)||no(t)||t.isInline();return!e.isInline()&&e.canBeEmpty()!==!1&&o}function Ge(e){let t=e.getNextSibling();for(;t!==null;){if(ue(t))return t;t=t.getNextSibling()}return null}function Ue(e){let t=e.getPreviousSibling();for(;t!==null;){if(ue(t))return t;t=t.getPreviousSibling()}return null}import{jsx as we}from"react/jsx-runtime";import{useLexicalComposerContext as To}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as ko,isHTMLElement as vo}from"lexical";import*as Xe from"react";import{useCallback as _o,useEffect as Qe,useRef as Do,useState as Lo}from"react";import{createPortal as Mo}from"react-dom";var Y=(e,t,o,n,r=50,a=25)=>{let i=0;if(e&&!e.contains(n)){let{bottom:l,left:u,right:d,top:x}=e.getBoundingClientRect(),c=x+window.scrollY,s=l+window.scrollY;if(o<c-a||o>s+a||t<u-r||t>d+r)return-1;(t<u||t>d)&&(i=t<u?t-u:t-d)}return i};import{$getNodeByKey as fe}from"lexical";function G(e){let t=e.getBoundingClientRect(),o=getComputedStyle(e).getPropertyValue("transform");if(!o||o==="none")return t;let n=o.split(",").pop();return t.y=t.y-Number(n?.replace(")","")),t}function de(e){let t=(u,d)=>u?parseFloat(window.getComputedStyle(u)[d]):0,{marginBottom:o,marginTop:n}=window.getComputedStyle(e),r=t(e.previousElementSibling,"marginBottom"),a=t(e.nextElementSibling,"marginTop"),i=Math.max(parseFloat(n),r);return{marginBottom:Math.max(parseFloat(o),a),marginTop:i}}import{$getRoot as No}from"lexical";function j(e){return e.getEditorState().read(()=>No().getChildrenKeys())}var wo=1,Po=-1,qe=0,A={props:null,result:null};function So(e,t,o=20){let n=e.x-t.x,r=e.y-t.y;return n*n+r*r<=o*o}function U(e){let{anchorElem:t,cache_threshold:o=20,editor:n,fuzzy:r=!1,horizontalOffset:a=0,point:{x:i,y:l},startIndex:u=0,useEdgeAsDefault:d=!1}=e;if(o>0&&A.props&&A.result&&A.props.fuzzy===e.fuzzy&&A.props.horizontalOffset===e.horizontalOffset&&A.props.useEdgeAsDefault===e.useEdgeAsDefault&&So(A.props.point,e.point,o))return A.result;let x=t.getBoundingClientRect(),c=j(n),s={blockElem:null,blockNode:null,distance:1/0,foundAtIndex:-1,isFoundNodeEmptyParagraph:!1};return n.getEditorState().read(()=>{if(d){let g=n.getElementByKey(c[0]),m=n.getElementByKey(c[c.length-1]);if(g&&m){let[h,p]=[G(g),G(m)];if(l<h.top?(s.blockElem=g,s.distance=h.top-l,s.blockNode=fe(c[0]),s.foundAtIndex=0):l>p.bottom&&(s.distance=l-p.bottom,s.blockNode=fe(c[c.length-1]),s.blockElem=m,s.foundAtIndex=c.length-1),s?.blockElem)return{blockElem:null,isFoundNodeEmptyParagraph:!1}}}let f=u,y=qe;for(;f>=0&&f<c.length;){let g=c[f],m=n.getElementByKey(g);if(m===null)break;let h=new O(i+a,l),p=Ie.fromDOMRect(G(m)),{marginBottom:b,marginTop:T}=de(m),P=p.generateNewRect({bottom:p.bottom+b,left:x.left,right:x.right,top:p.top-T}),{distance:C,isOnBottomSide:R,isOnTopSide:N}=P.distanceFromPoint(h);if(C===0){s.blockElem=m,s.blockNode=fe(g),s.foundAtIndex=f,s.distance=C,s.blockNode&&s.blockNode.getType()==="paragraph"&&s.blockNode.getTextContent()===""&&(!r&&!e.returnEmptyParagraphs&&(s.blockElem=null,s.blockNode=null),s.isFoundNodeEmptyParagraph=!0);break}else r&&C<s.distance&&(s.blockElem=m,s.blockNode=fe(g),s.distance=C,s.foundAtIndex=f);y===qe&&(N?y=Po:R?y=wo:y=1/0),f+=y}}),A.props=e,A.result={blockElem:s.blockElem,blockNode:s.blockNode,foundAtIndex:s.foundAtIndex,isFoundNodeEmptyParagraph:s.isFoundNodeEmptyParagraph},{blockElem:s.blockElem,blockNode:s.blockNode,foundAtIndex:s.foundAtIndex,isFoundNodeEmptyParagraph:s.isFoundNodeEmptyParagraph}}function me(e,t){return!!e.closest(`.${t}`)}var Ro=["IMG","INPUT","TEXTAREA","SELECT","BUTTON","VIDEO","OBJECT","EMBED","IFRAME","HR"];function Je(e){if(!e||Ro.includes(e.tagName)||e.offsetHeight===0||e.offsetWidth===0)return!1;let t=window.getComputedStyle(e);return!(t.display==="table-cell"||t.position==="absolute"||t.visibility==="hidden"||t.opacity==="0")}function pe(e,t,o,n=0){if(!e){t.style.opacity="0",t.style.transform="translate(-10000px, -10000px)";return}let r=e.getBoundingClientRect(),a=window.getComputedStyle(e),i=t.getBoundingClientRect(),l=o.getBoundingClientRect(),u;if(["LexicalEditorTheme__block","LexicalEditorTheme__upload","LexicalEditorTheme__relationship"].some(c=>e.classList.contains(c)||e.firstElementChild?.classList.contains(c)))u=r.top+8-l.top;else{let c=Je(e)?parseInt(a.lineHeight,10):0;u=r.top+(c-i.height)/2-l.top}let x=n;t.style.opacity="1",t.style.transform=`translate(${x}px, ${u}px)`}var Ao="add-block-menu",ge=1/0;function Bo(e){return e===0?1/0:ge>=0&&ge<e?ge:Math.floor(e/2)}function Io(e,t,o){let n=t.parentElement,{editorConfig:r}=S(),a=r?.admin?.hideGutter?-24:12,i=Do(null),[l,u]=Lo(null);Qe(()=>{function x(c){let s=c.target;if(!vo(s))return;let f=Y(n,c.pageX,c.pageY,s);if(f===-1){u(null);return}if(me(s,Ao))return;let y=j(e),{blockElem:g,blockNode:m,foundAtIndex:h}=U({anchorElem:t,cache_threshold:0,editor:e,horizontalOffset:-f,point:new O(c.x,c.y),returnEmptyParagraphs:!0,startIndex:Bo(y.length),useEdgeAsDefault:!1});ge=h,g&&m&&(l?.node!==m||l?.elem!==g)&&u({elem:g,node:m})}return document?.addEventListener("mousemove",x),()=>{document?.removeEventListener("mousemove",x)}},[n,t,e,l]),Qe(()=>{i.current&&l?.node&&pe(l?.elem,i.current,t,a)},[t,l,a]);let d=_o(x=>{let c=l;c?.node&&(e.update(()=>{let s=!0;if((c?.node.getType()!=="paragraph"||c.node.getTextContent()!=="")&&(s=!1),!s){let f=ko();c?.node.insertAfter(f),setTimeout(()=>{c={elem:e.getElementByKey(f.getKey()),node:f},u(c)},0)}}),setTimeout(()=>{e.update(()=>{e.focus(),c?.node&&"select"in c.node&&typeof c.node.select=="function"&&c.node.select()})},1),setTimeout(()=>{e.dispatchCommand(Ae,{node:c?.node})},2),x.stopPropagation(),x.preventDefault())},[e,l]);return Mo(we(Xe.Fragment,{children:we("button",{"aria-label":"Add block",className:"icon add-block-menu",onClick:x=>{d(x)},ref:i,type:"button",children:we("div",{className:o?"icon":""})})}),t)}function Ze(e){let{anchorElem:t}=e,o=t===void 0?document.body:t,[n]=To();return Io(n,o,n._editable)}import{jsx as he,jsxs as Fo}from"react/jsx-runtime";import{useLexicalComposerContext as $o}from"@lexical/react/LexicalComposerContext.js";import{eventFiles as ot}from"@lexical/rich-text";import{$getNearestNodeFromDOMNode as nt,$getNodeByKey as Vo,isHTMLElement as Pe}from"lexical";import*as at from"react";import{useEffect as Se,useRef as xe,useState as rt}from"react";import{createPortal as jo}from"react-dom";var et=0,Oo=-24;var K=0;function tt(e,t,o,n,r,a,i,l,u,d=!1){let{height:x,top:c}=n.getBoundingClientRect(),{top:s,width:f}=i.getBoundingClientRect(),{marginBottom:y,marginTop:g}=de(n),m=c,h=a>=c+x/2+window.scrollY,p=!1;if(r?.elem)if(n!==r?.elem)(h&&r?.elem&&r?.elem===n.nextElementSibling||!h&&r?.elem&&r?.elem===n.previousElementSibling)&&(K++,K<200&&(p=!0));else{K++;let C=r?.boundingBox?.y,R=n.getBoundingClientRect().y;(h===r?.isBelow&&C===R||K<200)&&(p=!1)}if(p)return{isBelow:h,willStayInSamePosition:p};d?m+=x/2:h?m+=x+y/2:m-=g/2;let b=0;d||(h?b=-et:b=et);let T=m-s+b,P=Oo-t;return o.style.width=`calc(${f}px - ${e})`,o.style.opacity=".8",o.style.transform=`translate(${P}px, calc(${T}px - 2px))`,r?.elem&&(r.elem.style.opacity="",r?.elem===n?h?r.elem.style.marginTop="":r.elem.style.marginBottom="":(r.elem.style.marginBottom="",r.elem.style.marginTop="")),K=0,{isBelow:h,willStayInSamePosition:p}}var Ko="draggable-block-menu",it="application/x-lexical-drag-block",oe=1/0;function st(e){return e===0?1/0:oe>=0&&oe<e?oe:Math.floor(e/2)}function Ho(e,t){let{transform:o}=t.style;e.setDragImage(t,0,0),setTimeout(()=>{t.style.transform=o})}function lt(e,t){e&&(e.style.opacity="0"),t&&(t.style.opacity="",t.style.marginBottom="",t.style.marginTop="")}function zo(e,t,o){let n=t.parentElement,r=xe(null),a=xe(null),i=xe(null),l=xe(!1),[u,d]=rt(null),[x,c]=rt(null),{editorConfig:s}=S(),f=s?.admin?.hideGutter?-44:-8;Se(()=>{function m(h){let p=h.target;if(!Pe(p))return;let b=Y(n,h.pageX,h.pageY,p);if(b===-1){d(null);return}if(me(p,Ko))return;let T=j(e),{blockElem:P,foundAtIndex:C,isFoundNodeEmptyParagraph:R}=U({anchorElem:t,cache_threshold:0,editor:e,horizontalOffset:-b,point:new O(h.x,h.y),startIndex:st(T.length),useEdgeAsDefault:!1,verbose:!1});oe=C,!(!P&&!R)&&u!==P&&d(P)}return document?.addEventListener("mousemove",m),()=>{document?.removeEventListener("mousemove",m)}},[n,t,e,u]),Se(()=>{r.current&&pe(u,r.current,t,f)},[t,u,f]),Se(()=>{function m(p){if(!l.current)return!1;let[b]=ot(p);if(b)return!1;let{pageY:T,target:P}=p;if(!Pe(P))return!1;let C=Y(n,p.pageX,p.pageY,P,100,50),R=j(e),{blockElem:N,foundAtIndex:L,isFoundNodeEmptyParagraph:I}=U({anchorElem:t,editor:e,fuzzy:!0,horizontalOffset:-C,point:new O(p.x,p.y),startIndex:st(R.length),useEdgeAsDefault:!0,verbose:!0});oe=L;let k=a.current;if(N===null||k===null)return!1;if(u!==N){let{isBelow:v,willStayInSamePosition:X}=tt(s?.admin?.hideGutter?"0px":"3rem",f+(s?.admin?.hideGutter?r?.current?.getBoundingClientRect()?.width??0:-(r?.current?.getBoundingClientRect()?.width??0)),k,N,x,T,t,p,i,I);p.preventDefault(),X||c({boundingBox:N.getBoundingClientRect(),elem:N,isBelow:v})}else x?.elem&&(lt(k,x.elem),c({boundingBox:N.getBoundingClientRect(),elem:N,isBelow:!1}));return!0}function h(p){if(!l.current)return!1;let[b]=ot(p);if(b)return!1;let{dataTransfer:T,pageY:P,target:C}=p,R=T?.getData(it)||"";return e.update(()=>{let N=Vo(R);if(!N||!Pe(C))return!1;let L=Y(n,p.pageX,p.pageY,C,100,50),{blockElem:I,isFoundNodeEmptyParagraph:k}=U({anchorElem:t,editor:e,fuzzy:!0,horizontalOffset:-L,point:new O(p.x,p.y),useEdgeAsDefault:!0});if(!I)return!1;let v=nt(I);if(!v)return!1;if(v===N)return!0;let{height:X,top:ye}=G(I),H=P>=ye+X/2+window.scrollY;k?(v.insertBefore(N),v.remove()):H?v.insertAfter(N):v.insertBefore(N),u!==null&&d(null),document.querySelectorAll(".lexical-block-highlighter").forEach(_=>{_.remove()});let se=e.getElementByKey(N.getKey());setTimeout(()=>{let _=se?.getBoundingClientRect();if(!_)return;let w=document.createElement("div");w.className="lexical-block-highlighter",w.style.backgroundColor="var(--theme-elevation-1000",w.style.transition="opacity 0.5s ease-in-out",w.style.zIndex="1",w.style.pointerEvents="none",w.style.boxSizing="border-box",w.style.borderRadius="4px",w.style.position="absolute",document.body.appendChild(w),w.style.opacity="0.1",w.style.height=`${_.height+8}px`,w.style.width=`${_.width+8}px`,w.style.top=`${_.top+window.scrollY-4}px`,w.style.left=`${_.left-4}px`,setTimeout(()=>{w.style.opacity="0",setTimeout(()=>{w.remove()},500)},1e3)},120)}),!0}return document.addEventListener("dragover",m),document.addEventListener("drop",h),()=>{document.removeEventListener("dragover",m),document.removeEventListener("drop",h)}},[n,f,t,e,x,u,s?.admin?.hideGutter]);function y(m){let h=m.dataTransfer;if(!h||!u)return;Ho(h,u);let p="";e.update(()=>{let b=nt(u);b&&(p=b.getKey())}),l.current=!0,h.setData(it,p)}function g(){l.current=!1,x?.elem&&lt(a.current,x?.elem)}return jo(Fo(at.Fragment,{children:[he("button",{"aria-label":"Drag to move",className:"icon draggable-block-menu",draggable:!0,onDragEnd:g,onDragStart:y,ref:r,type:"button",children:he("div",{className:o?"icon":""})}),he("div",{className:"draggable-block-target-line",ref:a}),he("div",{className:"debug-highlight",ref:i})]}),t)}function ct(e){let{anchorElem:t}=e,o=t===void 0?document.body:t,[n]=$o();return zo(n,o,n._editable)}import{c as Wo}from"react/compiler-runtime";import{jsx as Re}from"react/jsx-runtime";import{useLexicalComposerContext as Yo}from"@lexical/react/LexicalComposerContext";import{$createParagraphNode as Go,$getRoot as Uo}from"lexical";import"react";var ut="insert-paragraph-at-end",dt=()=>{let e=Wo(2),[t]=Yo(),{editorConfig:o}=S();if(o?.admin?.hideInsertParagraphAtEnd)return null;let n;return e[0]!==t?(n=Re("div",{"aria-label":"Insert Paragraph",className:ut,onClick:()=>{t.update(qo)},role:"button",tabIndex:0,children:Re("div",{className:`${ut}-inside`,children:Re("span",{children:"+"})})}),e[0]=t,e[1]=n):n=e[1],n};function qo(){let e=Go();Uo().append(e),e.select()}import{c as Jo}from"react/compiler-runtime";import{useLexicalComposerContext as Qo}from"@lexical/react/LexicalComposerContext";import*as ft from"react";var mt=()=>{let e=Jo(4),{editorConfig:t}=S(),[o]=Qo(),n,r;return e[0]!==o||e[1]!==t.features.markdownTransformers?(n=()=>De(o,t.features.markdownTransformers??[]),r=[o,t.features.markdownTransformers],e[0]=o,e[1]=t.features.markdownTransformers,e[2]=n,e[3]=r):(n=e[2],r=e[3]),ft.useEffect(n,r),null};import{c as Xo}from"react/compiler-runtime";import{useLexicalComposerContext as Zo}from"@lexical/react/LexicalComposerContext.js";import{useEffect as en}from"react";function pt(){let e=Xo(5),[t]=Zo(),{currentView:o,views:n}=z(),r,a;return e[0]!==o||e[1]!==t||e[2]!==n?(r=()=>{n&&(o==="default"?n.default?be(t,n.default):Ce(t):n[o]&&(Ce(t),be(t,n[o])))},a=[t,n,o],e[0]=o,e[1]=t,e[2]=n,e[3]=r,e[4]=a):(r=e[3],a=e[4]),en(r,a),null}import{useLexicalComposerContext as tn}from"@lexical/react/LexicalComposerContext";import{$getSelection as on,$isRangeSelection as nn,RootNode as rn}from"lexical";import{useEffect as sn}from"react";function gt(){let[e]=tn();return sn(()=>e.registerNodeTransform(rn,t=>{let o=on();if(nn(o)){let n=o.anchor.getNode(),r=o.focus.getNode();(!n.isAttached()||!r.isAttached())&&(t.selectEnd(),console.warn("updateEditor: selection has been moved to the end of the editor because the previously selected nodes have been removed and selection wasn't moved to another node. Ensure selection changes after removing/replacing a selected node."))}return!1}),[e]),null}import{useLexicalComposerContext as ln}from"@lexical/react/LexicalComposerContext";import{$getSelection as an,COMMAND_PRIORITY_LOW as cn,SELECT_ALL_COMMAND as un}from"lexical";import{useEffect as dn}from"react";function ht(){let[e]=ln();return dn(()=>e.registerCommand(un,()=>{if(an())return!1;let o=document.activeElement;return o instanceof HTMLInputElement&&o.select(),!0},cn),[e]),null}import{jsx as q,jsxs as yt}from"react/jsx-runtime";import{useLexicalComposerContext as mn}from"@lexical/react/LexicalComposerContext.js";import{useTranslation as Et}from"@payloadcms/ui";import{useCallback as pn,useMemo as gn,useState as hn}from"react";import"react";import*as bt from"react-dom";import{c as fn}from"react/compiler-runtime";import"react";function xt(e,t){let o=fn(4),{maxLength:n,minLength:r}=t,a=n===void 0?75:n,i=r===void 0?1:r,l;return o[0]!==a||o[1]!==i||o[2]!==e?(l=u=>{let{query:d}=u,x="[^"+e+Me+"\\s]",s=new RegExp("(^|\\s|\\()(["+e+"]((?:"+x+"){0,"+a+"}))$").exec(d);if(s!==null){let f=s[1],y=s[3];if(y.length>=i)return{leadOffset:s.index+f.length,matchingString:y,replaceableString:s[2]}}return null},o[0]=a,o[1]=i,o[2]=e,o[3]=l):l=o[3],l}var B="slash-menu-popup";function xn({isSelected:e,item:t,onClick:o,onMouseEnter:n,ref:r}){let{fieldProps:{featureClientSchemaMap:a,schemaPath:i}}=S(),{i18n:l}=Et(),u=`${B}__item ${B}__item-${t.key}`;e&&(u+=` ${B}__item--selected`);let d=t.key;return t.label&&(d=typeof t.label=="function"?t.label({featureClientSchemaMap:a,i18n:l,schemaPath:i}):t.label),d.length>25&&(d=d.substring(0,25)+"..."),yt("button",{"aria-selected":e,className:u,id:B+"__item-"+t.key,onClick:o,onMouseEnter:n,ref:r,role:"option",tabIndex:-1,type:"button",children:[t?.Icon&&q(t.Icon,{}),q("span",{className:`${B}__item-text`,children:d})]},t.key)}function Ct({anchorElem:e=document.body}){let[t]=mn(),[o,n]=hn(null),{editorConfig:r}=S(),{i18n:a}=Et(),{fieldProps:{featureClientSchemaMap:i,schemaPath:l}}=S(),u=xt("/",{minLength:0}),d=pn(()=>{let c=[];for(let s of r.features.slashMenu.dynamicGroups)if(o){let f=s({editor:t,queryString:o});c=c.concat(f)}return c},[t,o,r?.features]),x=gn(()=>{let c=[];for(let s of r?.features.slashMenu.groups??[])c.push(s);if(o){c=c.map(f=>{let y=f.items.filter(g=>{let m=g.key;return g.label&&(m=typeof g.label=="function"?g.label({featureClientSchemaMap:i,i18n:a,schemaPath:l}):g.label),new RegExp(o,"gi").exec(m)?!0:g.keywords!=null?g.keywords.some(h=>new RegExp(o,"gi").exec(h)):!1});return y.length?{...f,items:y}:null}),c=c.filter(f=>f!=null);let s=d();for(let f of s){let y=c.find(g=>g.key===f.key);y?c=c.filter(g=>g.key!==f.key):y={...f,items:[]},y?.items?.length&&(y.items=y.items.concat(y.items)),c.push(y)}}return c},[o,r?.features.slashMenu.groups,d,i,a,l]);return q(Be,{anchorElem:e,groups:x,menuRenderFn:(c,{selectedItemKey:s,selectItemAndCleanUp:f,setSelectedItemKey:y})=>c.current&&x.length?bt.createPortal(q("div",{className:B,children:x.map(g=>{let m=g.key;return g.label&&i&&(m=typeof g.label=="function"?g.label({featureClientSchemaMap:i,i18n:a,schemaPath:l}):g.label),yt("div",{className:`${B}__group ${B}__group-${g.key}`,children:[q("div",{className:`${B}__group-title`,children:m}),g.items.map((h,p)=>q(xn,{index:p,isSelected:s===h.key,item:h,onClick:()=>{y(h.key),f(h)},onMouseEnter:()=>{y(h.key)},ref:b=>{h.ref={current:b}}},h.key))]},g.key)})}),c.current):null,onQueryChange:n,triggerFn:u})}import{c as yn}from"react/compiler-runtime";import{useLexicalComposerContext as En}from"@lexical/react/LexicalComposerContext";import{TEXT_TYPE_TO_FORMAT as bn,TextNode as Cn}from"lexical";import{useEffect as Nn}from"react";function Nt(e){let t=yn(6),{features:o}=e,[n]=En(),r;t[0]!==n||t[1]!==o.enabledFormats?(r=()=>{let i=wn(o.enabledFormats);if(i.length!==0)return n.registerNodeTransform(Cn,l=>{i.forEach(u=>{l.hasFormat(u)&&l.toggleFormat(u)})})},t[0]=n,t[1]=o.enabledFormats,t[2]=r):r=t[2];let a;return t[3]!==n||t[4]!==o?(a=[n,o],t[3]=n,t[4]=o,t[5]=a):a=t[5],Nn(r,a),null}function wn(e){let t=Object.keys(bn),o=new Set(e);return t.filter(n=>!o.has(n))}import{c as Pn}from"react/compiler-runtime";import{jsx as wt}from"react/jsx-runtime";import{useLexicalComposerContext as Sn}from"@lexical/react/LexicalComposerContext";import{ContentEditable as Rn}from"@lexical/react/LexicalContentEditable.js";import{useTranslation as Tn}from"@payloadcms/ui";import"react";function Pt(e){let t=Pn(5),{className:o,editorConfig:n}=e,{t:r}=Tn(),[,a]=Sn(),{getTheme:i}=a,l;if(t[0]!==o||t[1]!==n?.admin?.placeholder||t[2]!==i||t[3]!==r){let u=i();l=wt(Rn,{"aria-placeholder":r("lexical:general:placeholder"),className:o??"ContentEditable__root",placeholder:wt("p",{className:u?.placeholder,children:n?.admin?.placeholder??r("lexical:general:placeholder")})}),t[0]=o,t[1]=n?.admin?.placeholder,t[2]=i,t[3]=r,t[4]=l}else l=t[4];return l}var Rt=e=>{let t=kn(12),{editorConfig:o,editorContainerRef:n,isSmallWidthViewport:r,onChange:a}=e,i=S(),[l]=vn(),u=An(),[d,x]=Fn(null),c;t[0]===Symbol.for("react.memo_cache_sentinel")?(c=m=>{m!==null&&x(m)},t[0]=c):c=t[0];let s=c,f,y;t[1]!==l||t[2]!==i?(f=()=>{if(!i?.uuid){console.error("Lexical Editor must be used within an EditorConfigProvider");return}i?.parentEditor?.uuid&&i.parentEditor?.registerChild(i.uuid,i);let m=()=>{i.focusEditor(i)},h=()=>{i.blurEditor(i)},p=l.registerCommand(In,()=>(m(),!0),St),b=l.registerCommand(Bn,()=>(h(),!0),St);return()=>{p(),b(),i.parentEditor?.unregisterChild?.(i.uuid)}},y=[l,i],t[1]=l,t[2]=i,t[3]=f,t[4]=y):(f=t[3],y=t[4]),On(f,y);let g;return t[5]!==o||t[6]!==n||t[7]!==d||t[8]!==u||t[9]!==r||t[10]!==a?(g=ne(J.Fragment,{children:[o.features.plugins?.map($n),ne("div",{className:"editor-container",ref:n,children:[o.features.plugins?.map(Vn),E(Mn,{contentEditable:E("div",{className:"editor-scroller",children:E("div",{className:"editor",ref:s,children:E(Pt,{editorConfig:o})})}),ErrorBoundary:_n}),E(gt,{}),u&&E(dt,{}),E(Ye,{}),E(He,{}),E(Nt,{features:o.features}),E(ht,{}),E(pt,{}),u&&E(Ln,{ignoreSelectionChange:!0,onChange:(m,h,p)=>{(!p.has("focus")||p.size>1)&&a?.(m,h,p)}}),d&&ne(J.Fragment,{children:[!r&&u&&ne(J.Fragment,{children:[o.admin?.hideDraggableBlockElement?null:E(ct,{anchorElem:d}),o.admin?.hideAddBlockButton?null:E(Ze,{anchorElem:d})]}),o.features.plugins?.map(m=>{if(m.position==="floatingAnchorElem"&&!(m.desktopOnly===!0&&r))return E($,{anchorElem:d,clientProps:m.clientProps,plugin:m},m.key)}),u&&E(J.Fragment,{children:E(Ct,{anchorElem:d})})]}),u&&ne(J.Fragment,{children:[E(Dn,{}),o?.features?.markdownTransformers?.length>0&&E(mt,{})]}),o.features.plugins?.map(jn),o.features.plugins?.map(Kn)]}),o.features.plugins?.map(Hn)]}),t[5]=o,t[6]=n,t[7]=d,t[8]=u,t[9]=r,t[10]=a,t[11]=g):g=t[11],g};function $n(e){if(e.position==="aboveContainer")return E($,{clientProps:e.clientProps,plugin:e},e.key)}function Vn(e){if(e.position==="top")return E($,{clientProps:e.clientProps,plugin:e},e.key)}function jn(e){if(e.position==="normal")return E($,{clientProps:e.clientProps,plugin:e},e.key)}function Kn(e){if(e.position==="bottom")return E($,{clientProps:e.clientProps,plugin:e},e.key)}function Hn(e){if(e.position==="belowContainer")return E($,{clientProps:e.clientProps,plugin:e},e.key)}var kt=({children:e,providers:t})=>{if(!t?.length)return e;let o=t[0];return t.length>1?F(o,{children:F(kt,{providers:t.slice(1),children:e})}):F(o,{children:e})},vt=e=>{let{composerKey:t,editorConfig:o,fieldProps:n,isSmallWidthViewport:r,onChange:a,readOnly:i,value:l}=e,{currentView:u,views:d}=z(),x=S(),c=Wn(),s=Tt.useRef(null),f=Yn(()=>{if(l&&typeof l!="object")throw new Error("The value passed to the Lexical editor is not an object. This is not supported. Please remove the data from the field and start again. This is the value that was passed in: "+JSON.stringify(l));if(l&&Array.isArray(l)&&!("root"in l))throw new Error("You have tried to pass in data from the old Slate editor to the new Lexical editor. The data structure is different, thus you will have to migrate your data. We offer a one-line migration script which migrates all your rich text fields: https://payloadcms.com/docs/lexical/migration#migration-via-migration-script-recommended");if(l&&"jsonContent"in l)throw new Error("You have tried to pass in data from payload-plugin-lexical. The data structure is different, thus you will have to migrate your data. Migration guide: https://payloadcms.com/docs/lexical/migration#migrating-from-payload-plugin-lexical");let y=d?.default;return{editable:i!==!0,editorState:l!=null?JSON.stringify(l):void 0,namespace:o.lexical.namespace,nodes:Oe({editorConfig:o,nodeViews:y}),onError:g=>{throw g},theme:o.lexical.theme}},[o,d]);return f?F(zn,{initialConfig:f,children:F(_e,{editorConfig:o,editorContainerRef:s,fieldProps:n,parentContext:x?.editDepth===c?x:void 0,children:F(kt,{providers:o.features.providers,children:F(Rt,{editorConfig:o,editorContainerRef:s,isSmallWidthViewport:r,onChange:a})})})},t+f.editable+u):F("p",{children:"Loading..."})};import{c as Gn}from"react/compiler-runtime";import{jsx as Q,jsxs as Un}from"react/jsx-runtime";import{ChevronIcon as qn,Popup as Jn,PopupList as _t}from"@payloadcms/ui";import"react";function Dt(){let e=Gn(5),{currentView:t,setCurrentView:o,views:n}=z();if(!n||Object.keys(n).length===0)return null;let r,a;if(e[0]!==t||e[1]!==o||e[2]!==n){a=Symbol.for("react.early_return_sentinel");e:{let i=Object.keys(n);if(!i.some(Xn)){a=null;break e}let u=["default",...i.filter(Qn)],d=t.charAt(0).toUpperCase()+t.slice(1);r=Q("div",{className:"lexical-view-selector",children:Q(Jn,{button:Un("button",{className:"lexical-view-selector__button",type:"button",children:[Q("span",{className:"lexical-view-selector__label",children:d}),Q(qn,{className:"lexical-view-selector__icon"})]}),buttonType:"custom",horizontalAlign:"left",render:x=>{let{close:c}=x;return Q(_t.ButtonGroup,{children:u.map(s=>{let f=s.charAt(0).toUpperCase()+s.slice(1);return Q(_t.Button,{active:s===t,disabled:s===t,onClick:()=>{o?.(s),c()},children:f},s)})})},size:"large"})})}e[0]=t,e[1]=o,e[2]=n,e[3]=r,e[4]=a}else r=e[3],a=e[4];return a!==Symbol.for("react.early_return_sentinel")?a:r}function Qn(e){return e!=="default"}function Xn(e){return e!=="default"}var re="rich-text-lexical",cr=e=>{let{editorConfig:t,field:o,field:{admin:{className:n,description:r,readOnly:a}={},label:i,localized:l,required:u},path:d,readOnly:x,validate:c}=e,s=x||a,f=or(),y=At((M,Z)=>typeof c=="function"?c(M,{...Z,required:u}):!0,[c,u]),{customComponents:{AfterInput:g,BeforeInput:m,Description:h,Error:p,Label:b}={},disabled:T,initialValue:P,path:C,setValue:R,showError:N,value:L}=rr({potentiallyStalePath:d,validate:y}),I=s||T,[k,v]=Te(!1),[X,ye]=Te(),Ee=Mt.useRef(P),H=Mt.useRef(L);Bt(()=>{let M=()=>{let Z=window.matchMedia("(max-width: 768px)").matches;Z!==k&&v(Z)};return M(),window.addEventListener("resize",M),()=>{window.removeEventListener("resize",M)}},[k]);let ke=[re,"field-type",n,N&&"error",I&&`${re}--read-only`,t?.admin?.hideGutter!==!0&&!k?`${re}--show-gutter`:null].filter(Boolean).join(" "),se=`${C}.${f}`,_=Le(),[w,It]=Te("default"),Ot=At(M=>{_(()=>{let ve=M.toJSON();H.current=ve,R(ve)})},[R,_]),Ft=lr(()=>ir(o),[o]),$t=nr(M=>{H.current!==L&&!sr(JSON.parse(JSON.stringify(H.current)),L)&&(Ee.current=M,H.current=L,ye(new Date))});return Bt(()=>{Object.is(P,Ee.current)||$t(P)},[P]),D(Ve,{currentView:w,setCurrentView:It,views:e.views,children:ie("div",{className:ke,style:Ft,children:[D(Lt,{CustomComponent:p,Fallback:D(er,{path:C,showError:N})}),ie("div",{className:`${re}__label-row`,children:[b||D(tr,{label:i,localized:l,path:C,required:u}),D(Dt,{})]}),ie("div",{className:`${re}__wrap`,children:[ie(ar,{fallbackRender:ur,onReset:()=>{},children:[m,D(vt,{composerKey:se,editorConfig:t,fieldProps:e,isSmallWidthViewport:k,onChange:Ot,readOnly:I,value:L},JSON.stringify({currentView:w,path:C,rerenderProviderKey:X})),g]}),D(Lt,{CustomComponent:h,Fallback:D(Zn,{description:r,path:C})})]})]},se)})};function ur({error:e}){return ie("div",{className:"errorBoundary",role:"alert",children:[D("p",{children:"Something went wrong:"}),D("pre",{style:{color:"red"},children:e.message})]})}var Pl=cr;export{Pl as RichText};
2
+ //# sourceMappingURL=Field-5VLZM7KJ.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/field/Field.tsx", "../../../src/lexical/LexicalProvider.tsx", "../../../src/field/RichTextViewProvider.tsx", "../../../src/lexical/LexicalEditor.tsx", "../../../src/lexical/EditorPlugin.tsx", "../../../src/lexical/plugins/ClipboardPlugin/index.tsx", "../../../src/lexical/plugins/DecoratorPlugin/index.tsx", "../../../src/lexical/plugins/handles/AddBlockHandlePlugin/index.tsx", "../../../src/lexical/plugins/handles/utils/calculateDistanceFromScrollerElem.ts", "../../../src/lexical/plugins/handles/utils/getNodeCloseToPoint.ts", "../../../src/lexical/plugins/handles/DraggableBlockPlugin/getBoundingRectWithoutTransform.ts", "../../../src/lexical/plugins/handles/utils/getCollapsedMargins.ts", "../../../src/lexical/plugins/handles/utils/getTopLevelNodeKeys.ts", "../../../src/lexical/plugins/handles/utils/isOnHandleElement.ts", "../../../src/lexical/plugins/handles/utils/doesLineHeightAffectElement.ts", "../../../src/lexical/plugins/handles/utils/setHandlePosition.ts", "../../../src/lexical/plugins/handles/DraggableBlockPlugin/index.tsx", "../../../src/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.ts", "../../../src/lexical/plugins/InsertParagraphAtEnd/index.tsx", "../../../src/lexical/plugins/MarkdownShortcut/index.tsx", "../../../src/lexical/plugins/NodeViewOverridePlugin/index.tsx", "../../../src/lexical/plugins/NormalizeSelection/index.tsx", "../../../src/lexical/plugins/SelectAllPlugin/index.tsx", "../../../src/lexical/plugins/SlashMenu/index.tsx", "../../../src/lexical/plugins/SlashMenu/useMenuTriggerMatch.ts", "../../../src/lexical/plugins/TextPlugin/index.tsx", "../../../src/lexical/ui/ContentEditable.tsx", "../../../src/field/ViewSelector.tsx"],
4
+ "sourcesContent": ["'use client'\nimport type { EditorState, SerializedEditorState } from 'lexical'\n\nimport {\n FieldDescription,\n FieldError,\n FieldLabel,\n RenderCustomComponent,\n useEditDepth,\n useEffectEvent,\n useField,\n} from '@payloadcms/ui'\nimport { mergeFieldStyles } from '@payloadcms/ui/shared'\nimport { dequal } from 'dequal/lite'\nimport { type Validate } from 'payload'\nimport React, { useCallback, useEffect, useMemo, useState } from 'react'\nimport { ErrorBoundary } from 'react-error-boundary'\n\nimport type { SanitizedClientEditorConfig } from '../lexical/config/types.js'\n\nimport '../lexical/theme/EditorTheme.scss'\nimport './bundled.css'\nimport './index.scss'\n\nimport type { LexicalRichTextFieldProps } from '../types.js'\n\nimport { LexicalProvider } from '../lexical/LexicalProvider.js'\nimport { useRunDeprioritized } from '../utilities/useRunDeprioritized.js'\nimport { RichTextViewProvider } from './RichTextViewProvider.js'\nimport { ViewSelector } from './ViewSelector.js'\n\nconst baseClass = 'rich-text-lexical'\n\nconst RichTextComponent: React.FC<\n {\n readonly editorConfig: SanitizedClientEditorConfig // With rendered features n stuff\n } & LexicalRichTextFieldProps\n> = (props) => {\n const {\n editorConfig,\n field,\n field: {\n admin: { className, description, readOnly: readOnlyFromAdmin } = {},\n label,\n localized,\n required,\n },\n path: pathFromProps,\n readOnly: readOnlyFromTopLevelProps,\n validate, // Users can pass in client side validation if they WANT to, but it's not required anymore\n } = props\n\n const readOnlyFromProps = readOnlyFromTopLevelProps || readOnlyFromAdmin\n\n const editDepth = useEditDepth()\n\n const memoizedValidate = useCallback<Validate>(\n (value, validationOptions) => {\n if (typeof validate === 'function') {\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return validate(value, { ...validationOptions, required })\n }\n return true\n },\n // Important: do not add props to the dependencies array.\n // This would cause an infinite loop and endless re-rendering.\n // Removing props from the dependencies array fixed this issue: https://github.com/payloadcms/payload/issues/3709\n [validate, required],\n )\n\n const {\n customComponents: { AfterInput, BeforeInput, Description, Error, Label } = {},\n disabled: disabledFromField,\n initialValue,\n path,\n setValue,\n showError,\n value,\n } = useField<SerializedEditorState>({\n potentiallyStalePath: pathFromProps,\n validate: memoizedValidate,\n })\n\n const disabled = readOnlyFromProps || disabledFromField\n\n const [isSmallWidthViewport, setIsSmallWidthViewport] = useState<boolean>(false)\n const [rerenderProviderKey, setRerenderProviderKey] = useState<Date>()\n\n const prevInitialValueRef = React.useRef<SerializedEditorState | undefined>(initialValue)\n const prevValueRef = React.useRef<SerializedEditorState | undefined>(value)\n\n useEffect(() => {\n const updateViewPortWidth = () => {\n const isNextSmallWidthViewport = window.matchMedia('(max-width: 768px)').matches\n\n if (isNextSmallWidthViewport !== isSmallWidthViewport) {\n setIsSmallWidthViewport(isNextSmallWidthViewport)\n }\n }\n updateViewPortWidth()\n window.addEventListener('resize', updateViewPortWidth)\n\n return () => {\n window.removeEventListener('resize', updateViewPortWidth)\n }\n }, [isSmallWidthViewport])\n\n const classes = [\n baseClass,\n 'field-type',\n className,\n showError && 'error',\n disabled && `${baseClass}--read-only`,\n editorConfig?.admin?.hideGutter !== true && !isSmallWidthViewport\n ? `${baseClass}--show-gutter`\n : null,\n ]\n .filter(Boolean)\n .join(' ')\n\n const pathWithEditDepth = `${path}.${editDepth}`\n\n const runDeprioritized = useRunDeprioritized() // defaults to 500 ms timeout\n\n const [currentView, setCurrentView] = useState<string>('default')\n\n const handleChange = useCallback(\n (editorState: EditorState) => {\n // Capture `editorState` in the closure so we can safely run later.\n const updateFieldValue = () => {\n const newState = editorState.toJSON()\n prevValueRef.current = newState\n setValue(newState)\n }\n\n // Queue the update for the browser’s idle time (or Safari shim)\n // and let the hook handle debouncing/cancellation.\n void runDeprioritized(updateFieldValue)\n },\n [setValue, runDeprioritized], // `runDeprioritized` is stable (useCallback inside hook)\n )\n\n const styles = useMemo(() => mergeFieldStyles(field), [field])\n\n const handleInitialValueChange = useEffectEvent(\n (initialValue: SerializedEditorState | undefined) => {\n // Object deep equality check here, as re-mounting the editor if\n // the new value is the same as the old one is not necessary.\n // In postgres, the order of keys in JSON objects is not guaranteed to be preserved,\n // so we need to do a deep equality check here that does not care about key order => we use dequal.\n // If we used JSON.stringify, the editor would re-mount every time you save the document, as the order of keys changes => change detected => re-mount.\n if (\n prevValueRef.current !== value &&\n !dequal(JSON.parse(JSON.stringify(prevValueRef.current)), value)\n ) {\n prevInitialValueRef.current = initialValue\n prevValueRef.current = value\n setRerenderProviderKey(new Date())\n }\n },\n )\n\n useEffect(() => {\n // Needs to trigger for object reference changes - otherwise,\n // reacting to the same initial value change twice will cause\n // the second change to be ignored, even though the value has changed.\n // That's because initialValue is not kept up-to-date\n if (!Object.is(initialValue, prevInitialValueRef.current)) {\n handleInitialValueChange(initialValue)\n }\n }, [initialValue])\n\n return (\n <RichTextViewProvider\n currentView={currentView}\n setCurrentView={setCurrentView}\n views={props.views}\n >\n <div className={classes} key={pathWithEditDepth} style={styles}>\n <RenderCustomComponent\n CustomComponent={Error}\n Fallback={<FieldError path={path} showError={showError} />}\n />\n <div className={`${baseClass}__label-row`}>\n {Label || (\n <FieldLabel label={label} localized={localized} path={path} required={required} />\n )}\n <ViewSelector />\n </div>\n <div className={`${baseClass}__wrap`}>\n <ErrorBoundary fallbackRender={fallbackRender} onReset={() => {}}>\n {BeforeInput}\n <LexicalProvider\n composerKey={pathWithEditDepth}\n editorConfig={editorConfig}\n fieldProps={props}\n isSmallWidthViewport={isSmallWidthViewport}\n key={JSON.stringify({ currentView, path, rerenderProviderKey })} // makes sure lexical is completely re-rendered when initialValue changes or view changes, bypassing the lexical-internal value memoization. That way, external changes to the form will update the editor. More infos in PR description (https://github.com/payloadcms/payload/pull/5010)\n onChange={handleChange}\n readOnly={disabled}\n value={value}\n />\n {AfterInput}\n </ErrorBoundary>\n <RenderCustomComponent\n CustomComponent={Description}\n Fallback={<FieldDescription description={description} path={path} />}\n />\n </div>\n </div>\n </RichTextViewProvider>\n )\n}\n\nfunction fallbackRender({ error }: { error: Error }) {\n // Call resetErrorBoundary() to reset the error boundary and retry the render.\n\n return (\n <div className=\"errorBoundary\" role=\"alert\">\n <p>Something went wrong:</p>\n <pre style={{ color: 'red' }}>{error.message}</pre>\n </div>\n )\n}\n\nexport const RichText: typeof RichTextComponent = RichTextComponent\n", "'use client'\nimport type { InitialConfigType } from '@lexical/react/LexicalComposer.js'\nimport type { EditorState, LexicalEditor, SerializedEditorState } from 'lexical'\n\nimport { LexicalComposer } from '@lexical/react/LexicalComposer.js'\nimport { useEditDepth } from '@payloadcms/ui'\nimport * as React from 'react'\nimport { useMemo } from 'react'\n\nimport type { LexicalRichTextFieldProps } from '../types.js'\nimport type { SanitizedClientEditorConfig } from './config/types.js'\n\nimport { useRichTextView } from '../field/RichTextViewProvider.js'\nimport {\n EditorConfigProvider,\n useEditorConfigContext,\n} from './config/client/EditorConfigProvider.js'\nimport { LexicalEditor as LexicalEditorComponent } from './LexicalEditor.js'\nimport { getEnabledNodes } from './nodes/index.js'\n\nexport type LexicalProviderProps = {\n composerKey: string\n editorConfig: SanitizedClientEditorConfig\n fieldProps: LexicalRichTextFieldProps\n isSmallWidthViewport: boolean\n onChange: (editorState: EditorState, editor: LexicalEditor, tags: Set<string>) => void\n readOnly: boolean\n value: SerializedEditorState\n}\n\nconst NestProviders = ({\n children,\n providers,\n}: {\n children: React.ReactNode\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n providers: any[]\n}) => {\n if (!providers?.length) {\n return children\n }\n const Component = providers[0]\n if (providers.length > 1) {\n return (\n <Component>\n <NestProviders providers={providers.slice(1)}>{children}</NestProviders>\n </Component>\n )\n }\n return <Component>{children}</Component>\n}\n\nexport const LexicalProvider: React.FC<LexicalProviderProps> = (props) => {\n const { composerKey, editorConfig, fieldProps, isSmallWidthViewport, onChange, readOnly, value } =\n props\n\n const { currentView, views } = useRichTextView()\n\n const parentContext = useEditorConfigContext()\n\n const editDepth = useEditDepth()\n\n const editorContainerRef = React.useRef<HTMLDivElement>(null)\n\n // useMemo for the initialConfig that depends on readOnly and value\n const initialConfig = useMemo<InitialConfigType>(() => {\n if (value && typeof value !== 'object') {\n throw new Error(\n 'The value passed to the Lexical editor is not an object. This is not supported. Please remove the data from the field and start again. This is the value that was passed in: ' +\n JSON.stringify(value),\n )\n }\n\n if (value && Array.isArray(value) && !('root' in value)) {\n throw new Error(\n 'You have tried to pass in data from the old Slate editor to the new Lexical editor. The data structure is different, thus you will have to migrate your data. We offer a one-line migration script which migrates all your rich text fields: https://payloadcms.com/docs/lexical/migration#migration-via-migration-script-recommended',\n )\n }\n\n if (value && 'jsonContent' in value) {\n throw new Error(\n 'You have tried to pass in data from payload-plugin-lexical. The data structure is different, thus you will have to migrate your data. Migration guide: https://payloadcms.com/docs/lexical/migration#migrating-from-payload-plugin-lexical',\n )\n }\n\n // Use the 'default' view if available, otherwise undefined\n const nodeViews = views?.default\n\n return {\n editable: readOnly !== true,\n editorState: value != null ? JSON.stringify(value) : undefined,\n namespace: editorConfig.lexical.namespace,\n nodes: getEnabledNodes({\n editorConfig,\n nodeViews,\n }),\n onError: (error: Error) => {\n throw error\n },\n theme: editorConfig.lexical.theme,\n }\n // Important: do not add readOnly and value to the dependencies array. This will cause the entire lexical editor to re-render if the document is saved, which will\n // cause the editor to lose focus.\n }, [editorConfig, views])\n\n if (!initialConfig) {\n return <p>Loading...</p>\n }\n\n // We need to add initialConfig.editable to the key to force a re-render when the readOnly prop changes.\n // Without it, there were cases where lexical editors inside drawers turn readOnly initially - a few miliseconds later they turn editable, but the editor does not re-render and stays readOnly.\n // We also add currentView to force re-render when the view changes.\n return (\n <LexicalComposer\n initialConfig={initialConfig}\n key={composerKey + initialConfig.editable + currentView}\n >\n <EditorConfigProvider\n editorConfig={editorConfig}\n editorContainerRef={editorContainerRef}\n fieldProps={fieldProps}\n /**\n * Parent editor is not truly the parent editor, if the current editor is part of a drawer and the parent editor is the main editor.\n */\n parentContext={parentContext?.editDepth === editDepth ? parentContext : undefined}\n >\n <NestProviders providers={editorConfig.features.providers}>\n <LexicalEditorComponent\n editorConfig={editorConfig}\n editorContainerRef={editorContainerRef}\n isSmallWidthViewport={isSmallWidthViewport}\n onChange={onChange}\n />\n </NestProviders>\n </EditorConfigProvider>\n </LexicalComposer>\n )\n}\n", "'use client'\nimport React, { createContext, use, useMemo } from 'react'\n\nimport type { LexicalEditorNodeMap, LexicalEditorViewMap } from '../types.js'\n\n/**\n * Context type for rich text view management.\n */\ntype RichTextViewContextType = {\n /**\n * The name of the currently active view (e.g., 'default', 'frontend', 'debug')\n */\n currentView: string\n /**\n * The node map for the currently active view, containing rendering overrides for each node type.\n * This is the resolved view from the views map based on currentView.\n */\n currentViewMap?: LexicalEditorNodeMap\n /**\n * Optional function to change the current view. Only available in contexts where view switching is enabled (e.g., admin panel).\n */\n setCurrentView?: (view: string) => void\n /**\n * The complete map of all available views for this field.\n */\n views?: LexicalEditorViewMap\n}\n\nconst RichTextViewContext = createContext<RichTextViewContextType>({\n currentView: 'default',\n currentViewMap: undefined,\n setCurrentView: undefined,\n views: undefined,\n})\n\n/**\n * Provider component for rich text view context.\n *\n * This provider manages the current view state and makes it accessible to child components\n * via the useRichTextView hook. It automatically resolves the current view's node map\n * based on the active view name.\n *\n * @example\n * ```tsx\n * <RichTextViewProvider\n * currentView=\"frontend\"\n * setCurrentView={setView}\n * views={myViews}\n * >\n * <MyEditor />\n * </RichTextViewProvider>\n * ```\n */\nexport const RichTextViewProvider: React.FC<{\n children: React.ReactNode\n currentView?: string\n setCurrentView?: (view: string) => void\n views?: LexicalEditorViewMap\n}> = ({ children, currentView = 'default', setCurrentView, views }) => {\n const currentViewMap = useMemo(() => {\n if (!views) {\n return undefined\n }\n return views[currentView] || views.default\n }, [views, currentView])\n\n const value = useMemo(\n () => ({\n currentView,\n currentViewMap,\n setCurrentView,\n views,\n }),\n [currentView, setCurrentView, currentViewMap, views],\n )\n\n return <RichTextViewContext value={value}>{children}</RichTextViewContext>\n}\n\n/**\n * Hook to access the current rich text view context.\n *\n * Use this hook to access the currently active view and its node map,\n * or to programmatically switch between views.\n *\n * @returns An object containing:\n * - `currentView`: The name of the active view\n * - `currentViewMap`: The node overrides for the current view\n * - `setCurrentView`: Function to change views (if available)\n * - `views`: All available views\n *\n * @throws Error if used outside of a RichTextViewProvider\n *\n * @example\n * ```tsx\n * function MyComponent() {\n * const { currentView, currentViewMap, setCurrentView } = useRichTextView()\n *\n * return (\n * <div>\n * <p>Current view: {currentView}</p>\n * {currentViewMap?.heading && <p>Heading overrides are active</p>}\n * {setCurrentView && (\n * <button onClick={() => setCurrentView('frontend')}>\n * Switch to frontend view\n * </button>\n * )}\n * </div>\n * )\n * }\n * ```\n */\nexport function useRichTextView(): RichTextViewContextType {\n const context = use(RichTextViewContext)\n\n if (!context) {\n throw new Error('useRichTextView must be used within a RichTextViewProvider')\n }\n\n return context\n}\n", "'use client'\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary.js'\nimport { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin.js'\nimport { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin.js'\nimport { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin.js'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { BLUR_COMMAND, COMMAND_PRIORITY_LOW, FOCUS_COMMAND } from 'lexical'\nimport * as React from 'react'\nimport { useEffect, useState } from 'react'\n\nimport type { LexicalProviderProps } from './LexicalProvider.js'\n\nimport { useEditorConfigContext } from './config/client/EditorConfigProvider.js'\nimport './LexicalEditor.scss'\nimport { EditorPlugin } from './EditorPlugin.js'\nimport { ClipboardPlugin } from './plugins/ClipboardPlugin/index.js'\nimport { DecoratorPlugin } from './plugins/DecoratorPlugin/index.js'\nimport { AddBlockHandlePlugin } from './plugins/handles/AddBlockHandlePlugin/index.js'\nimport { DraggableBlockPlugin } from './plugins/handles/DraggableBlockPlugin/index.js'\nimport { InsertParagraphAtEndPlugin } from './plugins/InsertParagraphAtEnd/index.js'\nimport { MarkdownShortcutPlugin } from './plugins/MarkdownShortcut/index.js'\nimport { NodeViewOverridePlugin } from './plugins/NodeViewOverridePlugin/index.js'\nimport { NormalizeSelectionPlugin } from './plugins/NormalizeSelection/index.js'\nimport { SelectAllPlugin } from './plugins/SelectAllPlugin/index.js'\nimport { SlashMenuPlugin } from './plugins/SlashMenu/index.js'\nimport { TextPlugin } from './plugins/TextPlugin/index.js'\nimport { LexicalContentEditable } from './ui/ContentEditable.js'\n\nexport const LexicalEditor: React.FC<\n {\n editorContainerRef: React.RefObject<HTMLDivElement | null>\n isSmallWidthViewport: boolean\n } & Pick<LexicalProviderProps, 'editorConfig' | 'onChange'>\n> = (props) => {\n const { editorConfig, editorContainerRef, isSmallWidthViewport, onChange } = props\n const editorConfigContext = useEditorConfigContext()\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n\n const [floatingAnchorElem, setFloatingAnchorElem] = useState<HTMLDivElement | null>(null)\n const onRef = (_floatingAnchorElem: HTMLDivElement) => {\n if (_floatingAnchorElem !== null) {\n setFloatingAnchorElem(_floatingAnchorElem)\n }\n }\n\n useEffect(() => {\n if (!editorConfigContext?.uuid) {\n console.error('Lexical Editor must be used within an EditorConfigProvider')\n return\n }\n if (editorConfigContext?.parentEditor?.uuid) {\n editorConfigContext.parentEditor?.registerChild(editorConfigContext.uuid, editorConfigContext)\n }\n\n const handleFocus = () => {\n editorConfigContext.focusEditor(editorConfigContext)\n }\n\n const handleBlur = () => {\n editorConfigContext.blurEditor(editorConfigContext)\n }\n\n const unregisterFocus = editor.registerCommand<MouseEvent>(\n FOCUS_COMMAND,\n () => {\n handleFocus()\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n\n const unregisterBlur = editor.registerCommand<MouseEvent>(\n BLUR_COMMAND,\n () => {\n handleBlur()\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n\n return () => {\n unregisterFocus()\n unregisterBlur()\n editorConfigContext.parentEditor?.unregisterChild?.(editorConfigContext.uuid)\n }\n }, [editor, editorConfigContext])\n\n return (\n <React.Fragment>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'aboveContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n <div className=\"editor-container\" ref={editorContainerRef}>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'top') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n <RichTextPlugin\n contentEditable={\n <div className=\"editor-scroller\">\n <div className=\"editor\" ref={onRef}>\n <LexicalContentEditable editorConfig={editorConfig} />\n </div>\n </div>\n }\n ErrorBoundary={LexicalErrorBoundary}\n />\n <NormalizeSelectionPlugin />\n {isEditable && <InsertParagraphAtEndPlugin />}\n <DecoratorPlugin />\n <ClipboardPlugin />\n <TextPlugin features={editorConfig.features} />\n <SelectAllPlugin />\n <NodeViewOverridePlugin />\n {isEditable && (\n <OnChangePlugin\n // Selection changes can be ignored here, reducing the\n // frequency that the FieldComponent and Payload receive updates.\n // Selection changes are only needed if you are saving selection state\n ignoreSelectionChange\n onChange={(editorState, editor, tags) => {\n // Ignore any onChange event triggered by focus only\n if (!tags.has('focus') || tags.size > 1) {\n if (onChange != null) {\n onChange(editorState, editor, tags)\n }\n }\n }}\n />\n )}\n {floatingAnchorElem && (\n <React.Fragment>\n {!isSmallWidthViewport && isEditable && (\n <React.Fragment>\n {editorConfig.admin?.hideDraggableBlockElement ? null : (\n <DraggableBlockPlugin anchorElem={floatingAnchorElem} />\n )}\n {editorConfig.admin?.hideAddBlockButton ? null : (\n <AddBlockHandlePlugin anchorElem={floatingAnchorElem} />\n )}\n </React.Fragment>\n )}\n {editorConfig.features.plugins?.map((plugin) => {\n if (\n plugin.position === 'floatingAnchorElem' &&\n !(plugin.desktopOnly === true && isSmallWidthViewport)\n ) {\n return (\n <EditorPlugin\n anchorElem={floatingAnchorElem}\n clientProps={plugin.clientProps}\n key={plugin.key}\n plugin={plugin}\n />\n )\n }\n })}\n {isEditable && (\n <React.Fragment>\n <SlashMenuPlugin anchorElem={floatingAnchorElem} />\n </React.Fragment>\n )}\n </React.Fragment>\n )}\n {isEditable && (\n <React.Fragment>\n <HistoryPlugin />\n {editorConfig?.features?.markdownTransformers?.length > 0 && <MarkdownShortcutPlugin />}\n </React.Fragment>\n )}\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'normal') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'bottom') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n </div>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'belowContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n </React.Fragment>\n )\n}\n", "'use client'\nimport React from 'react'\n\nimport type { SanitizedPlugin } from '../features/typesClient.js'\n\nexport const EditorPlugin: React.FC<{\n anchorElem?: HTMLDivElement\n clientProps: unknown\n plugin: SanitizedPlugin\n}> = ({ anchorElem, clientProps, plugin }) => {\n if (plugin.position === 'floatingAnchorElem' && anchorElem) {\n return (\n plugin.Component && <plugin.Component anchorElem={anchorElem} clientProps={clientProps} />\n )\n }\n\n // @ts-expect-error - ts is not able to infer that plugin.Component is of type PluginComponent\n return plugin.Component && <plugin.Component clientProps={clientProps} />\n}\n", "'use client'\n\nimport { copyToClipboard } from '@lexical/clipboard'\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { objectKlassEquals } from '@lexical/utils'\nimport ObjectID from 'bson-objectid'\nimport { COMMAND_PRIORITY_LOW, COPY_COMMAND } from 'lexical'\nimport { useEffect } from 'react'\n\ntype SerializedUnknownLexicalNode = {\n children?: SerializedUnknownLexicalNode[]\n type: string\n}\n\nexport function ClipboardPlugin() {\n const [editor] = useLexicalComposerContext()\n\n useEffect(() => {\n // Remove duplicated ids from clipboard. We do it here because:\n // 1. Browsers do not allow setting the clipboardData in paste event for security reasons.\n // 2. If you cut instead of paste, the id will be kept, which is a good thing.\n return editor.registerCommand(\n COPY_COMMAND,\n (event) => {\n copyToClipboard(editor, objectKlassEquals(event, ClipboardEvent) ? event : null)\n .then(() => {\n if (!(event instanceof ClipboardEvent) || !event.clipboardData) {\n throw new Error('No clipboard event')\n }\n const lexicalStringified = event.clipboardData.getData('application/x-lexical-editor')\n if (!lexicalStringified) {\n return true\n }\n\n const lexical = JSON.parse(lexicalStringified) as {\n nodes: SerializedUnknownLexicalNode[]\n }\n const changeIds = (node: SerializedUnknownLexicalNode) => {\n if (\n 'fields' in node &&\n typeof node.fields === 'object' &&\n node.fields !== null &&\n 'id' in node.fields\n ) {\n node.fields.id = new ObjectID.default().toHexString()\n } else if ('id' in node) {\n node.id = new ObjectID.default().toHexString()\n }\n\n if (node.children) {\n for (const child of node.children) {\n changeIds(child)\n }\n }\n }\n for (const node of lexical.nodes) {\n changeIds(node)\n }\n const stringified = JSON.stringify(lexical)\n event.clipboardData.setData('application/x-lexical-editor', stringified)\n })\n .catch((error) => {\n if (event instanceof ClipboardEvent) {\n event.clipboardData?.setData('application/x-lexical-editor', '')\n }\n throw error\n })\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n }, [editor])\n\n return null\n}\n", "'use client'\n\nimport type { DecoratorNode, ElementNode, LexicalNode } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { $findMatchingParent, mergeRegister } from '@lexical/utils'\nimport {\n $createNodeSelection,\n $getEditor,\n $getNearestNodeFromDOMNode,\n $getSelection,\n $isDecoratorNode,\n $isElementNode,\n $isLineBreakNode,\n $isNodeSelection,\n $isRangeSelection,\n $isRootOrShadowRoot,\n $isTextNode,\n $setSelection,\n CLICK_COMMAND,\n COMMAND_PRIORITY_LOW,\n KEY_ARROW_DOWN_COMMAND,\n KEY_ARROW_UP_COMMAND,\n KEY_BACKSPACE_COMMAND,\n KEY_DELETE_COMMAND,\n SELECTION_CHANGE_COMMAND,\n} from 'lexical'\nimport { useEffect } from 'react'\n\nimport './index.scss'\n\n// TODO: This should ideally be fixed in Lexical. See\n// https://github.com/facebook/lexical/pull/7072\nexport function DecoratorPlugin() {\n const [editor] = useLexicalComposerContext()\n\n const $onDelete = (event: KeyboardEvent) => {\n const selection = $getSelection()\n if (!$isNodeSelection(selection)) {\n return false\n }\n event.preventDefault()\n selection.getNodes().forEach((node) => {\n node.remove()\n })\n return true\n }\n\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand(\n CLICK_COMMAND,\n (event) => {\n document.querySelector('.decorator-selected')?.classList.remove('decorator-selected')\n const decorator = $getDecoratorByMouseEvent(event)\n if (!decorator) {\n return true\n }\n const { target } = event\n const isInteractive =\n !(target instanceof HTMLElement) ||\n target.isContentEditable ||\n target.closest(\n 'button, textarea, input, .react-select, .code-editor, .no-select-decorator, [role=\"button\"]',\n )\n if (isInteractive) {\n $setSelection(null)\n } else {\n $selectDecorator(decorator)\n }\n return true\n },\n COMMAND_PRIORITY_LOW,\n ),\n editor.registerCommand(KEY_DELETE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW),\n editor.registerCommand(KEY_BACKSPACE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW),\n editor.registerCommand(\n SELECTION_CHANGE_COMMAND,\n () => {\n const decorator = $getSelectedDecorator()\n document.querySelector('.decorator-selected')?.classList.remove('decorator-selected')\n if (decorator) {\n decorator.element?.classList.add('decorator-selected')\n return true\n }\n return false\n },\n COMMAND_PRIORITY_LOW,\n ),\n editor.registerCommand(\n KEY_ARROW_UP_COMMAND,\n (event) => {\n // CASE 1: Node selection\n const selection = $getSelection()\n if ($isNodeSelection(selection)) {\n const prevSibling = selection.getNodes()[0]?.getPreviousSibling()\n if ($isDecoratorNode(prevSibling)) {\n const element = $getEditor().getElementByKey(prevSibling.getKey())\n if (element) {\n $selectDecorator({ element, node: prevSibling })\n event.preventDefault()\n return true\n }\n return false\n }\n if (!$isElementNode(prevSibling)) {\n return false\n }\n const lastDescendant = prevSibling.getLastDescendant() ?? prevSibling\n if (!lastDescendant) {\n return false\n }\n const block = $findMatchingParent(lastDescendant, INTERNAL_$isBlock)\n block?.selectStart()\n event.preventDefault()\n return true\n }\n if (!$isRangeSelection(selection)) {\n return false\n }\n\n // CASE 2: Range selection\n // Get first selected block\n const firstPoint = selection.isBackward() ? selection.anchor : selection.focus\n const firstNode = firstPoint.getNode()\n const firstSelectedBlock = $findMatchingParent(firstNode, (node) => {\n return findFirstSiblingBlock(node) !== null\n })\n const prevBlock = firstSelectedBlock?.getPreviousSibling()\n if (!firstSelectedBlock || prevBlock !== findFirstSiblingBlock(firstSelectedBlock)) {\n return false\n }\n\n if ($isDecoratorNode(prevBlock)) {\n const prevBlockElement = $getEditor().getElementByKey(prevBlock.getKey())\n if (prevBlockElement) {\n $selectDecorator({ element: prevBlockElement, node: prevBlock })\n event.preventDefault()\n return true\n }\n }\n\n return false\n },\n COMMAND_PRIORITY_LOW,\n ),\n editor.registerCommand(\n KEY_ARROW_DOWN_COMMAND,\n (event) => {\n // CASE 1: Node selection\n const selection = $getSelection()\n if ($isNodeSelection(selection)) {\n event.preventDefault()\n const nextSibling = selection.getNodes()[0]?.getNextSibling()\n if ($isDecoratorNode(nextSibling)) {\n const element = $getEditor().getElementByKey(nextSibling.getKey())\n if (element) {\n $selectDecorator({ element, node: nextSibling })\n }\n return true\n }\n if (!$isElementNode(nextSibling)) {\n return true\n }\n const firstDescendant = nextSibling.getFirstDescendant() ?? nextSibling\n if (!firstDescendant) {\n return true\n }\n const block = $findMatchingParent(firstDescendant, INTERNAL_$isBlock)\n block?.selectEnd()\n event.preventDefault()\n return true\n }\n if (!$isRangeSelection(selection)) {\n return false\n }\n\n // CASE 2: Range selection\n // Get last selected block\n const lastPoint = selection.isBackward() ? selection.anchor : selection.focus\n const lastNode = lastPoint.getNode()\n const lastSelectedBlock = $findMatchingParent(lastNode, (node) => {\n return findLaterSiblingBlock(node) !== null\n })\n const nextBlock = lastSelectedBlock?.getNextSibling()\n if (!lastSelectedBlock || nextBlock !== findLaterSiblingBlock(lastSelectedBlock)) {\n return false\n }\n\n if ($isDecoratorNode(nextBlock)) {\n const nextBlockElement = $getEditor().getElementByKey(nextBlock.getKey())\n if (nextBlockElement) {\n $selectDecorator({ element: nextBlockElement, node: nextBlock })\n event.preventDefault()\n return true\n }\n }\n\n return false\n },\n COMMAND_PRIORITY_LOW,\n ),\n )\n }, [editor])\n\n return null\n}\n\nfunction $getDecoratorByMouseEvent(\n event: MouseEvent,\n): { element: HTMLElement; node: DecoratorNode<unknown> } | undefined {\n if (!(event.target instanceof HTMLElement)) {\n return undefined\n }\n const element = event.target.closest('[data-lexical-decorator=\"true\"]')\n if (!(element instanceof HTMLElement)) {\n return undefined\n }\n const node = $getNearestNodeFromDOMNode(element)\n return $isDecoratorNode(node) ? { element, node } : undefined\n}\n\nfunction $getSelectedDecorator() {\n const selection = $getSelection()\n if (!$isNodeSelection(selection)) {\n return undefined\n }\n const nodes = selection.getNodes()\n if (nodes.length !== 1) {\n return undefined\n }\n const node = nodes[0]\n return $isDecoratorNode(node)\n ? {\n decorator: node,\n element: $getEditor().getElementByKey(node.getKey()),\n }\n : undefined\n}\n\nfunction $selectDecorator({\n element,\n node,\n}: {\n element: HTMLElement\n node: DecoratorNode<unknown>\n}) {\n document.querySelector('.decorator-selected')?.classList.remove('decorator-selected')\n const selection = $createNodeSelection()\n selection.add(node.getKey())\n $setSelection(selection)\n element.scrollIntoView({ behavior: 'smooth', block: 'nearest' })\n element.classList.add('decorator-selected')\n}\n\n/**\n * Copied from https://github.com/facebook/lexical/blob/main/packages/lexical/src/LexicalUtils.ts\n *\n * This function returns true for a DecoratorNode that is not inline OR\n * an ElementNode that is:\n * - not a root or shadow root\n * - not inline\n * - can't be empty\n * - has no children or an inline first child\n */\nexport function INTERNAL_$isBlock(node: LexicalNode): node is DecoratorNode<unknown> | ElementNode {\n if ($isDecoratorNode(node) && !node.isInline()) {\n return true\n }\n if (!$isElementNode(node) || $isRootOrShadowRoot(node)) {\n return false\n }\n\n const firstChild = node.getFirstChild()\n const isLeafElement =\n firstChild === null ||\n $isLineBreakNode(firstChild) ||\n $isTextNode(firstChild) ||\n firstChild.isInline()\n\n return !node.isInline() && node.canBeEmpty() !== false && isLeafElement\n}\n\nfunction findLaterSiblingBlock(node: LexicalNode): LexicalNode | null {\n let current = node.getNextSibling()\n while (current !== null) {\n if (INTERNAL_$isBlock(current)) {\n return current\n }\n current = current.getNextSibling()\n }\n return null\n}\n\nfunction findFirstSiblingBlock(node: LexicalNode): LexicalNode | null {\n let current = node.getPreviousSibling()\n while (current !== null) {\n if (INTERNAL_$isBlock(current)) {\n return current\n }\n current = current.getPreviousSibling()\n }\n return null\n}\n", "'use client'\nimport type { LexicalEditor, LexicalNode, ParagraphNode } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { $createParagraphNode, isHTMLElement } from 'lexical'\nimport * as React from 'react'\nimport { useCallback, useEffect, useRef, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { useEditorConfigContext } from '../../../config/client/EditorConfigProvider.js'\nimport { Point } from '../../../utils/point.js'\nimport { ENABLE_SLASH_MENU_COMMAND } from '../../SlashMenu/LexicalTypeaheadMenuPlugin/index.js'\nimport { calculateDistanceFromScrollerElem } from '../utils/calculateDistanceFromScrollerElem.js'\nimport { getNodeCloseToPoint } from '../utils/getNodeCloseToPoint.js'\nimport { getTopLevelNodeKeys } from '../utils/getTopLevelNodeKeys.js'\nimport { isOnHandleElement } from '../utils/isOnHandleElement.js'\nimport { setHandlePosition } from '../utils/setHandlePosition.js'\nimport './index.scss'\n\nconst ADD_BLOCK_MENU_CLASSNAME = 'add-block-menu'\n\nlet prevIndex = Infinity\n\nfunction getCurrentIndex(keysLength: number): number {\n if (keysLength === 0) {\n return Infinity\n }\n if (prevIndex >= 0 && prevIndex < keysLength) {\n return prevIndex\n }\n\n return Math.floor(keysLength / 2)\n}\n\nfunction useAddBlockHandle(\n editor: LexicalEditor,\n anchorElem: HTMLElement,\n isEditable: boolean,\n): React.ReactElement {\n const scrollerElem = anchorElem.parentElement\n\n const { editorConfig } = useEditorConfigContext()\n const blockHandleHorizontalOffset = editorConfig?.admin?.hideGutter ? -24 : 12\n\n const menuRef = useRef<HTMLButtonElement>(null)\n const [hoveredElement, setHoveredElement] = useState<{\n elem: HTMLElement\n node: LexicalNode\n } | null>(null)\n\n useEffect(() => {\n function onDocumentMouseMove(event: MouseEvent) {\n const target = event.target\n if (!isHTMLElement(target)) {\n return\n }\n\n const distanceFromScrollerElem = calculateDistanceFromScrollerElem(\n scrollerElem,\n event.pageX,\n event.pageY,\n target,\n )\n\n if (distanceFromScrollerElem === -1) {\n setHoveredElement(null)\n return\n }\n\n if (isOnHandleElement(target, ADD_BLOCK_MENU_CLASSNAME)) {\n return\n }\n const topLevelNodeKeys = getTopLevelNodeKeys(editor)\n\n const {\n blockElem: _emptyBlockElem,\n blockNode,\n foundAtIndex,\n } = getNodeCloseToPoint({\n anchorElem,\n cache_threshold: 0,\n editor,\n horizontalOffset: -distanceFromScrollerElem,\n point: new Point(event.x, event.y),\n returnEmptyParagraphs: true,\n startIndex: getCurrentIndex(topLevelNodeKeys.length),\n useEdgeAsDefault: false,\n })\n\n prevIndex = foundAtIndex\n\n if (!_emptyBlockElem) {\n return\n }\n if (\n blockNode &&\n (hoveredElement?.node !== blockNode || hoveredElement?.elem !== _emptyBlockElem)\n ) {\n setHoveredElement({\n elem: _emptyBlockElem,\n node: blockNode,\n })\n }\n }\n\n // Since the draggableBlockElem is outside the actual editor, we need to listen to the document\n // to be able to detect when the mouse is outside the editor and respect a buffer around\n // the scrollerElem to avoid the draggableBlockElem disappearing too early.\n document?.addEventListener('mousemove', onDocumentMouseMove)\n\n return () => {\n document?.removeEventListener('mousemove', onDocumentMouseMove)\n }\n }, [scrollerElem, anchorElem, editor, hoveredElement])\n\n useEffect(() => {\n if (menuRef.current && hoveredElement?.node) {\n setHandlePosition(\n hoveredElement?.elem,\n menuRef.current,\n anchorElem,\n blockHandleHorizontalOffset,\n )\n }\n }, [anchorElem, hoveredElement, blockHandleHorizontalOffset])\n\n const handleAddClick = useCallback(\n (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\n let hoveredElementToUse = hoveredElement\n if (!hoveredElementToUse?.node) {\n return\n }\n\n // 1. Update hoveredElement.node to a new paragraph node if the hoveredElement.node is not a paragraph node\n editor.update(() => {\n // Check if blockNode is an empty text node\n let isEmptyParagraph = true\n if (\n hoveredElementToUse?.node.getType() !== 'paragraph' ||\n hoveredElementToUse.node.getTextContent() !== ''\n ) {\n isEmptyParagraph = false\n }\n\n if (!isEmptyParagraph) {\n const newParagraph = $createParagraphNode()\n hoveredElementToUse?.node.insertAfter(newParagraph)\n\n setTimeout(() => {\n hoveredElementToUse = {\n elem: editor.getElementByKey(newParagraph.getKey())!,\n node: newParagraph,\n }\n setHoveredElement(hoveredElementToUse)\n }, 0)\n }\n })\n\n // 2. Focus on the new paragraph node\n setTimeout(() => {\n editor.update(() => {\n editor.focus()\n\n if (\n hoveredElementToUse?.node &&\n 'select' in hoveredElementToUse.node &&\n typeof hoveredElementToUse.node.select === 'function'\n ) {\n hoveredElementToUse.node.select()\n }\n })\n }, 1)\n\n // Make sure this is called AFTER the focusing has been processed by the browser\n // Otherwise, this won't work\n setTimeout(() => {\n editor.dispatchCommand(ENABLE_SLASH_MENU_COMMAND, {\n node: hoveredElementToUse?.node as ParagraphNode,\n })\n }, 2)\n\n event.stopPropagation()\n event.preventDefault()\n },\n [editor, hoveredElement],\n )\n\n return createPortal(\n <React.Fragment>\n <button\n aria-label=\"Add block\"\n className=\"icon add-block-menu\"\n onClick={(event) => {\n handleAddClick(event)\n }}\n ref={menuRef}\n type=\"button\"\n >\n <div className={isEditable ? 'icon' : ''} />\n </button>\n </React.Fragment>,\n anchorElem,\n )\n}\n\nexport function AddBlockHandlePlugin({\n anchorElem = document.body,\n}: {\n anchorElem?: HTMLElement\n}): React.ReactElement {\n const [editor] = useLexicalComposerContext()\n return useAddBlockHandle(editor, anchorElem, editor._editable)\n}\n", "'use client'\n/**\n * Calculate distance between scrollerElem and target if target is not in scrollerElem\n */\nexport const calculateDistanceFromScrollerElem = (\n scrollerElem: HTMLElement | null,\n pageX: number,\n pageY: number,\n target: HTMLElement,\n horizontalBuffer: number = 50,\n verticalBuffer: number = 25,\n): number => {\n let distanceFromScrollerElem = 0\n if (scrollerElem && !scrollerElem.contains(target)) {\n const { bottom, left, right, top } = scrollerElem.getBoundingClientRect()\n\n const adjustedTop = top + window.scrollY\n const adjustedBottom = bottom + window.scrollY\n\n if (\n pageY < adjustedTop - verticalBuffer ||\n pageY > adjustedBottom + verticalBuffer ||\n pageX < left - horizontalBuffer ||\n pageX > right + horizontalBuffer\n ) {\n return -1\n }\n\n // This is used to allow the _draggableBlockElem to be found when the mouse is in the\n // buffer zone around the scrollerElem.\n if (pageX < left || pageX > right) {\n distanceFromScrollerElem = pageX < left ? pageX - left : pageX - right\n }\n }\n return distanceFromScrollerElem\n}\n", "'use client'\nimport type { LexicalEditor, LexicalNode } from 'lexical'\n\nimport { $getNodeByKey } from 'lexical'\n\nimport { Point } from '../../../utils/point.js'\nimport { Rect } from '../../../utils/rect.js'\nimport { getBoundingClientRectWithoutTransform } from '../DraggableBlockPlugin/getBoundingRectWithoutTransform.js'\nimport { getCollapsedMargins } from '../utils/getCollapsedMargins.js'\nimport { getTopLevelNodeKeys } from '../utils/getTopLevelNodeKeys.js'\n\n// Directions\nconst Downward = 1\nconst Upward = -1\nconst Indeterminate = 0\n\ntype Props = {\n anchorElem: HTMLElement\n cache_threshold?: number\n editor: LexicalEditor\n /** fuzzy makes the search not exact. If no exact match found, find the closes node instead of returning null */\n fuzzy?: boolean\n horizontalOffset?: number\n point: Point\n /**\n * By default, empty paragraphs are not returned. Set this to true to return empty paragraphs. @default false\n */\n returnEmptyParagraphs?: boolean\n /**\n * The index to start searching from. It can be a considerable performance optimization to start searching from the index of the\n * previously found node, as the node is likely to be close to the next node.\n */\n startIndex?: number\n useEdgeAsDefault?: boolean\n verbose?: boolean\n}\n\ntype Output = {\n blockElem: HTMLElement | null\n blockNode: LexicalNode | null\n foundAtIndex: number\n isFoundNodeEmptyParagraph: boolean\n}\n\nconst cache = {\n props: null as null | Props,\n result: null as null | Output,\n}\n\nfunction isPointClose(previous: Point, current: Point, threshold: number = 20): boolean {\n const dx = previous.x - current.x\n const dy = previous.y - current.y\n return dx * dx + dy * dy <= threshold * threshold\n}\n\nexport function getNodeCloseToPoint(props: Props): Output {\n const {\n anchorElem,\n cache_threshold = 20,\n editor,\n fuzzy = false,\n horizontalOffset = 0,\n point: { x, y },\n startIndex = 0,\n useEdgeAsDefault = false,\n } = props\n\n // Use cache\n if (\n cache_threshold > 0 &&\n cache.props &&\n cache.result &&\n cache.props.fuzzy === props.fuzzy &&\n cache.props.horizontalOffset === props.horizontalOffset &&\n cache.props.useEdgeAsDefault === props.useEdgeAsDefault &&\n isPointClose(cache.props.point, props.point, cache_threshold)\n ) {\n return cache.result\n }\n\n const anchorElementRect = anchorElem.getBoundingClientRect()\n const topLevelNodeKeys = getTopLevelNodeKeys(editor)\n\n const closestBlockElem: {\n blockElem: HTMLElement | null\n blockNode: LexicalNode | null\n distance: number\n foundAtIndex: number\n isFoundNodeEmptyParagraph: boolean\n } = {\n blockElem: null,\n blockNode: null,\n distance: Infinity,\n foundAtIndex: -1,\n isFoundNodeEmptyParagraph: false,\n }\n\n // Return null if matching block element is the first or last node\n editor.getEditorState().read(() => {\n if (useEdgeAsDefault) {\n const firstNode = editor.getElementByKey(topLevelNodeKeys[0]!)\n const lastNode = editor.getElementByKey(topLevelNodeKeys[topLevelNodeKeys.length - 1]!)\n\n if (firstNode && lastNode) {\n const [firstNodeRect, lastNodeRect] = [\n getBoundingClientRectWithoutTransform(firstNode),\n getBoundingClientRectWithoutTransform(lastNode),\n ]\n\n if (y < firstNodeRect.top) {\n closestBlockElem.blockElem = firstNode\n closestBlockElem.distance = firstNodeRect.top - y\n closestBlockElem.blockNode = $getNodeByKey(topLevelNodeKeys[0]!)\n closestBlockElem.foundAtIndex = 0\n } else if (y > lastNodeRect.bottom) {\n closestBlockElem.distance = y - lastNodeRect.bottom\n closestBlockElem.blockNode = $getNodeByKey(topLevelNodeKeys[topLevelNodeKeys.length - 1]!)\n closestBlockElem.blockElem = lastNode\n closestBlockElem.foundAtIndex = topLevelNodeKeys.length - 1\n }\n\n if (closestBlockElem?.blockElem) {\n return {\n blockElem: null,\n isFoundNodeEmptyParagraph: false,\n } as Output\n }\n }\n }\n\n // Find matching block element\n let index = startIndex\n let direction = Indeterminate\n\n while (index >= 0 && index < topLevelNodeKeys.length) {\n const key = topLevelNodeKeys[index]!\n const elem = editor.getElementByKey(key)\n if (elem === null) {\n break\n }\n const point = new Point(x + horizontalOffset, y)\n //const domRect = Rect.fromDOM(elem)\n // Do not consider transform of blocks when calculating distance\n const domRect = Rect.fromDOMRect(getBoundingClientRectWithoutTransform(elem))\n\n const { marginBottom, marginTop } = getCollapsedMargins(elem)\n\n const rect = domRect.generateNewRect({\n bottom: domRect.bottom + marginBottom,\n left: anchorElementRect.left,\n right: anchorElementRect.right,\n top: domRect.top - marginTop,\n })\n\n const { distance, isOnBottomSide, isOnTopSide } = rect.distanceFromPoint(point)\n\n if (distance === 0) {\n closestBlockElem.blockElem = elem\n closestBlockElem.blockNode = $getNodeByKey(key)\n closestBlockElem.foundAtIndex = index\n closestBlockElem.distance = distance\n\n // Check if blockNode is an empty text node\n if (\n closestBlockElem.blockNode &&\n closestBlockElem.blockNode.getType() === 'paragraph' &&\n closestBlockElem.blockNode.getTextContent() === ''\n ) {\n if (!fuzzy && !props.returnEmptyParagraphs) {\n closestBlockElem.blockElem = null\n closestBlockElem.blockNode = null\n }\n\n closestBlockElem.isFoundNodeEmptyParagraph = true\n }\n break\n } else if (fuzzy) {\n if (distance < closestBlockElem.distance) {\n closestBlockElem.blockElem = elem\n closestBlockElem.blockNode = $getNodeByKey(key)\n closestBlockElem.distance = distance\n closestBlockElem.foundAtIndex = index\n }\n }\n\n if (direction === Indeterminate) {\n if (isOnTopSide) {\n direction = Upward\n } else if (isOnBottomSide) {\n direction = Downward\n } else {\n // stop search block element\n direction = Infinity\n }\n }\n\n index += direction\n }\n })\n\n // Store in cache before returning\n cache.props = props\n cache.result = {\n blockElem: closestBlockElem.blockElem,\n blockNode: closestBlockElem.blockNode,\n foundAtIndex: closestBlockElem.foundAtIndex,\n isFoundNodeEmptyParagraph: closestBlockElem.isFoundNodeEmptyParagraph,\n }\n\n return {\n blockElem: closestBlockElem.blockElem,\n blockNode: closestBlockElem.blockNode,\n foundAtIndex: closestBlockElem.foundAtIndex,\n isFoundNodeEmptyParagraph: closestBlockElem.isFoundNodeEmptyParagraph,\n }\n}\n", "'use client'\nexport function getBoundingClientRectWithoutTransform(elem: HTMLElement): DOMRect {\n const rect = elem.getBoundingClientRect()\n\n // Extract the translation value from the transform style\n const transformValue = getComputedStyle(elem).getPropertyValue('transform')\n if (!transformValue || transformValue === 'none') {\n return rect\n }\n\n const lastNumberOfTransformValue = transformValue.split(',').pop()\n rect.y = rect.y - Number(lastNumberOfTransformValue?.replace(')', ''))\n\n // Return the original bounding rect if no translation is applied\n return rect\n}\n", "'use client'\nexport function getCollapsedMargins(elem: HTMLElement): {\n marginBottom: number\n marginTop: number\n} {\n const getMargin = (element: Element | null, margin: 'marginBottom' | 'marginTop'): number =>\n element ? parseFloat(window.getComputedStyle(element)[margin]) : 0\n\n const { marginBottom, marginTop } = window.getComputedStyle(elem)\n const prevElemSiblingMarginBottom = getMargin(elem.previousElementSibling, 'marginBottom')\n const nextElemSiblingMarginTop = getMargin(elem.nextElementSibling, 'marginTop')\n const collapsedTopMargin = Math.max(parseFloat(marginTop), prevElemSiblingMarginBottom)\n const collapsedBottomMargin = Math.max(parseFloat(marginBottom), nextElemSiblingMarginTop)\n\n return { marginBottom: collapsedBottomMargin, marginTop: collapsedTopMargin }\n}\n", "'use client'\nimport type { LexicalEditor } from 'lexical'\n\nimport { $getRoot } from 'lexical'\n\nexport function getTopLevelNodeKeys(editor: LexicalEditor): string[] {\n return editor.getEditorState().read(() => $getRoot().getChildrenKeys())\n}\n", "'use client'\nexport function isOnHandleElement(element: HTMLElement, handleElementClassName: string): boolean {\n return !!element.closest(`.${handleElementClassName}`)\n}\n", "'use client'\nconst replacedElements = [\n 'IMG',\n 'INPUT',\n 'TEXTAREA',\n 'SELECT',\n 'BUTTON',\n 'VIDEO',\n 'OBJECT',\n 'EMBED',\n 'IFRAME',\n 'HR',\n]\n\n/**\n * From ChatGPT, only that verified it works for HR elements.\n *\n * HTML Elements can have CSS lineHeight applied to them, but it doesn't always affect the visual layout.\n * This function checks if the line-height property has an effect on the element's layout.\n * @param htmlElem\n */\nexport function doesLineHeightAffectElement(htmlElem: HTMLElement) {\n if (!htmlElem) {\n return false\n }\n\n // Check for replaced elements, elements that typically don't support line-height adjustments,\n // and elements without visible content\n\n if (\n replacedElements.includes(htmlElem.tagName) ||\n htmlElem.offsetHeight === 0 ||\n htmlElem.offsetWidth === 0\n ) {\n return false\n }\n\n // Check for specific CSS properties that negate line-height's visual effects\n const style = window.getComputedStyle(htmlElem)\n if (\n style.display === 'table-cell' ||\n style.position === 'absolute' ||\n style.visibility === 'hidden' ||\n style.opacity === '0'\n ) {\n return false\n }\n\n // This is a basic check, and there can be more complex scenarios where line-height doesn't have an effect.\n return true\n}\n", "'use client'\nimport { doesLineHeightAffectElement } from './doesLineHeightAffectElement.js'\n\nexport function setHandlePosition(\n targetElem: HTMLElement | null,\n handleElem: HTMLElement,\n anchorElem: HTMLElement,\n leftOffset: number = 0, // SPACE\n) {\n if (!targetElem) {\n handleElem.style.opacity = '0'\n handleElem.style.transform = 'translate(-10000px, -10000px)'\n return\n }\n\n const targetRect = targetElem.getBoundingClientRect()\n const targetStyle = window.getComputedStyle(targetElem)\n const floatingElemRect = handleElem.getBoundingClientRect()\n const anchorElementRect = anchorElem.getBoundingClientRect()\n\n let top: number\n\n const isBlockStyle = [\n 'LexicalEditorTheme__block',\n 'LexicalEditorTheme__upload',\n 'LexicalEditorTheme__relationship',\n ].some(\n (classes) =>\n targetElem.classList.contains(classes) ||\n targetElem.firstElementChild?.classList.contains(classes),\n )\n\n if (!isBlockStyle) {\n // No need to let line height affect the re-positioning of the floating element if line height has no\n // visual effect on the element. Otherwise, the floating element will be positioned incorrectly.\n const actualLineHeight = doesLineHeightAffectElement(targetElem)\n ? parseInt(targetStyle.lineHeight, 10)\n : 0\n\n top = targetRect.top + (actualLineHeight - floatingElemRect.height) / 2 - anchorElementRect.top\n } else {\n top = targetRect.top + 8 - anchorElementRect.top\n }\n\n const left = leftOffset\n\n handleElem.style.opacity = '1'\n handleElem.style.transform = `translate(${left}px, ${top}px)`\n}\n", "'use client'\nimport type { LexicalEditor } from 'lexical'\nimport type { DragEvent as ReactDragEvent } from 'react'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { eventFiles } from '@lexical/rich-text'\nimport { $getNearestNodeFromDOMNode, $getNodeByKey, isHTMLElement } from 'lexical'\nimport * as React from 'react'\nimport { useEffect, useRef, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { useEditorConfigContext } from '../../../config/client/EditorConfigProvider.js'\nimport { Point } from '../../../utils/point.js'\nimport { calculateDistanceFromScrollerElem } from '../utils/calculateDistanceFromScrollerElem.js'\nimport { getNodeCloseToPoint } from '../utils/getNodeCloseToPoint.js'\nimport { getTopLevelNodeKeys } from '../utils/getTopLevelNodeKeys.js'\nimport { isOnHandleElement } from '../utils/isOnHandleElement.js'\nimport { setHandlePosition } from '../utils/setHandlePosition.js'\nimport { getBoundingClientRectWithoutTransform } from './getBoundingRectWithoutTransform.js'\nimport './index.scss'\nimport { setTargetLine } from './setTargetLine.js'\n\nconst DRAGGABLE_BLOCK_MENU_CLASSNAME = 'draggable-block-menu'\nconst DRAG_DATA_FORMAT = 'application/x-lexical-drag-block'\n\nlet prevIndex = Infinity\n\nfunction getCurrentIndex(keysLength: number): number {\n if (keysLength === 0) {\n return Infinity\n }\n if (prevIndex >= 0 && prevIndex < keysLength) {\n return prevIndex\n }\n\n return Math.floor(keysLength / 2)\n}\n\nfunction setDragImage(dataTransfer: DataTransfer, draggableBlockElem: HTMLElement) {\n const { transform } = draggableBlockElem.style\n\n // Remove dragImage borders\n dataTransfer.setDragImage(draggableBlockElem, 0, 0)\n\n setTimeout(() => {\n draggableBlockElem.style.transform = transform\n })\n}\n\nfunction hideTargetLine(\n targetLineElem: HTMLElement | null,\n lastTargetBlockElem: HTMLElement | null,\n) {\n if (targetLineElem) {\n targetLineElem.style.opacity = '0'\n }\n if (lastTargetBlockElem) {\n lastTargetBlockElem.style.opacity = ''\n // Delete marginBottom and marginTop values we set\n lastTargetBlockElem.style.marginBottom = ''\n lastTargetBlockElem.style.marginTop = ''\n //lastTargetBlock.style.border = 'none'\n }\n}\n\nfunction useDraggableBlockMenu(\n editor: LexicalEditor,\n anchorElem: HTMLElement,\n isEditable: boolean,\n): React.ReactElement {\n const scrollerElem = anchorElem.parentElement\n\n const menuRef = useRef<HTMLButtonElement>(null)\n const targetLineRef = useRef<HTMLDivElement>(null)\n const debugHighlightRef = useRef<HTMLDivElement>(null)\n const isDraggingBlockRef = useRef<boolean>(false)\n const [draggableBlockElem, setDraggableBlockElem] = useState<HTMLElement | null>(null)\n const [lastTargetBlock, setLastTargetBlock] = useState<{\n boundingBox?: DOMRect\n elem: HTMLElement | null\n isBelow: boolean\n } | null>(null)\n\n const { editorConfig } = useEditorConfigContext()\n\n const blockHandleHorizontalOffset = editorConfig?.admin?.hideGutter ? -44 : -8\n\n useEffect(() => {\n /**\n * Handles positioning of the drag handle\n */\n function onDocumentMouseMove(event: MouseEvent) {\n const target = event.target\n if (!isHTMLElement(target)) {\n return\n }\n\n const distanceFromScrollerElem = calculateDistanceFromScrollerElem(\n scrollerElem,\n event.pageX,\n event.pageY,\n target,\n )\n if (distanceFromScrollerElem === -1) {\n setDraggableBlockElem(null)\n return\n }\n\n if (isOnHandleElement(target, DRAGGABLE_BLOCK_MENU_CLASSNAME)) {\n return\n }\n\n const topLevelNodeKeys = getTopLevelNodeKeys(editor)\n\n const {\n blockElem: _draggableBlockElem,\n foundAtIndex,\n isFoundNodeEmptyParagraph,\n } = getNodeCloseToPoint({\n anchorElem,\n cache_threshold: 0,\n editor,\n horizontalOffset: -distanceFromScrollerElem,\n point: new Point(event.x, event.y),\n startIndex: getCurrentIndex(topLevelNodeKeys.length),\n useEdgeAsDefault: false,\n verbose: false,\n })\n\n prevIndex = foundAtIndex\n\n //if (DEBUG && _draggableBlockElem) {\n //targetBlockElem.style.border = '3px solid red'\n // highlightElemOriginalPosition(debugHighlightRef, _draggableBlockElem, anchorElem)\n //}\n\n if (!_draggableBlockElem && !isFoundNodeEmptyParagraph) {\n return\n }\n\n if (draggableBlockElem !== _draggableBlockElem) {\n setDraggableBlockElem(_draggableBlockElem)\n }\n }\n\n // Since the draggableBlockElem is outside the actual editor, we need to listen to the document\n // to be able to detect when the mouse is outside the editor and respect a buffer around\n // the scrollerElem to avoid the draggableBlockElem disappearing too early.\n document?.addEventListener('mousemove', onDocumentMouseMove)\n\n return () => {\n document?.removeEventListener('mousemove', onDocumentMouseMove)\n }\n }, [scrollerElem, anchorElem, editor, draggableBlockElem])\n\n useEffect(() => {\n if (menuRef.current) {\n setHandlePosition(\n draggableBlockElem,\n menuRef.current,\n anchorElem,\n blockHandleHorizontalOffset,\n )\n }\n }, [anchorElem, draggableBlockElem, blockHandleHorizontalOffset])\n\n useEffect(() => {\n function onDragover(event: DragEvent): boolean {\n if (!isDraggingBlockRef.current) {\n return false\n }\n const [isFileTransfer] = eventFiles(event)\n if (isFileTransfer) {\n return false\n }\n\n const { pageY, target } = event\n if (!isHTMLElement(target)) {\n return false\n }\n\n const distanceFromScrollerElem = calculateDistanceFromScrollerElem(\n scrollerElem,\n event.pageX,\n event.pageY,\n target,\n 100,\n 50,\n )\n\n const topLevelNodeKeys = getTopLevelNodeKeys(editor)\n\n const {\n blockElem: targetBlockElem,\n foundAtIndex,\n isFoundNodeEmptyParagraph,\n } = getNodeCloseToPoint({\n anchorElem,\n editor,\n fuzzy: true,\n horizontalOffset: -distanceFromScrollerElem,\n point: new Point(event.x, event.y),\n startIndex: getCurrentIndex(topLevelNodeKeys.length),\n useEdgeAsDefault: true,\n verbose: true,\n })\n\n prevIndex = foundAtIndex\n\n const targetLineElem = targetLineRef.current\n // targetBlockElem === null shouldn't happen\n if (targetBlockElem === null || targetLineElem === null) {\n return false\n }\n\n if (draggableBlockElem !== targetBlockElem) {\n const { isBelow, willStayInSamePosition } = setTargetLine(\n editorConfig?.admin?.hideGutter ? '0px' : '3rem',\n blockHandleHorizontalOffset +\n (editorConfig?.admin?.hideGutter\n ? (menuRef?.current?.getBoundingClientRect()?.width ?? 0)\n : -(menuRef?.current?.getBoundingClientRect()?.width ?? 0)),\n targetLineElem,\n targetBlockElem,\n lastTargetBlock!,\n pageY,\n anchorElem,\n event,\n debugHighlightRef,\n isFoundNodeEmptyParagraph,\n )\n\n // Prevent default event to be able to trigger onDrop events\n // Calling preventDefault() adds the green plus icon to the cursor,\n // indicating that the drop is allowed.\n event.preventDefault()\n\n if (!willStayInSamePosition) {\n setLastTargetBlock({\n boundingBox: targetBlockElem.getBoundingClientRect(),\n elem: targetBlockElem,\n isBelow,\n })\n }\n } else if (lastTargetBlock?.elem) {\n hideTargetLine(targetLineElem, lastTargetBlock.elem)\n setLastTargetBlock({\n boundingBox: targetBlockElem.getBoundingClientRect(),\n elem: targetBlockElem,\n isBelow: false,\n })\n }\n\n return true\n }\n\n function onDrop(event: DragEvent): boolean {\n if (!isDraggingBlockRef.current) {\n return false\n }\n const [isFileTransfer] = eventFiles(event)\n if (isFileTransfer) {\n return false\n }\n const { dataTransfer, pageY, target } = event\n const dragData = dataTransfer?.getData(DRAG_DATA_FORMAT) || ''\n\n editor.update(() => {\n const draggedNode = $getNodeByKey(dragData)\n if (!draggedNode) {\n return false\n }\n if (!isHTMLElement(target)) {\n return false\n }\n const distanceFromScrollerElem = calculateDistanceFromScrollerElem(\n scrollerElem,\n event.pageX,\n event.pageY,\n target,\n 100,\n 50,\n )\n\n const { blockElem: targetBlockElem, isFoundNodeEmptyParagraph } = getNodeCloseToPoint({\n anchorElem,\n editor,\n fuzzy: true,\n horizontalOffset: -distanceFromScrollerElem,\n point: new Point(event.x, event.y),\n useEdgeAsDefault: true,\n })\n\n if (!targetBlockElem) {\n return false\n }\n const targetNode = $getNearestNodeFromDOMNode(targetBlockElem)\n if (!targetNode) {\n return false\n }\n if (targetNode === draggedNode) {\n return true\n }\n\n const { height: targetBlockElemHeight, top: targetBlockElemTop } =\n getBoundingClientRectWithoutTransform(targetBlockElem)\n\n const mouseY = pageY\n const isBelow = mouseY >= targetBlockElemTop + targetBlockElemHeight / 2 + window.scrollY\n\n if (!isFoundNodeEmptyParagraph) {\n if (isBelow) {\n // below targetBlockElem\n targetNode.insertAfter(draggedNode)\n } else {\n // above targetBlockElem\n targetNode.insertBefore(draggedNode)\n }\n } else {\n //\n targetNode.insertBefore(draggedNode)\n targetNode.remove()\n }\n\n /*\n if (pageY >= targetBlockElemTop + targetBlockElemHeight / 2) {\n targetNode.insertAfter(draggedNode)\n } else {\n targetNode.insertBefore(draggedNode)\n }*/\n if (draggableBlockElem !== null) {\n setDraggableBlockElem(null)\n }\n\n // find all previous elements with lexical-block-highlighter class and remove them\n const allPrevHighlighters = document.querySelectorAll('.lexical-block-highlighter')\n allPrevHighlighters.forEach((highlighter) => {\n highlighter.remove()\n })\n\n const newInsertedElem = editor.getElementByKey(draggedNode.getKey())\n setTimeout(() => {\n // add new temp html element to newInsertedElem with the same height and width and the class block-selected\n // to highlight the new inserted element\n const newInsertedElemRect = newInsertedElem?.getBoundingClientRect()\n if (!newInsertedElemRect) {\n return\n }\n const highlightElem = document.createElement('div')\n highlightElem.className = 'lexical-block-highlighter'\n\n highlightElem.style.backgroundColor = 'var(--theme-elevation-1000'\n highlightElem.style.transition = 'opacity 0.5s ease-in-out'\n highlightElem.style.zIndex = '1'\n highlightElem.style.pointerEvents = 'none'\n highlightElem.style.boxSizing = 'border-box'\n highlightElem.style.borderRadius = '4px'\n highlightElem.style.position = 'absolute'\n document.body.appendChild(highlightElem)\n\n highlightElem.style.opacity = '0.1'\n\n highlightElem.style.height = `${newInsertedElemRect.height + 8}px`\n highlightElem.style.width = `${newInsertedElemRect.width + 8}px`\n highlightElem.style.top = `${newInsertedElemRect.top + window.scrollY - 4}px`\n highlightElem.style.left = `${newInsertedElemRect.left - 4}px`\n\n setTimeout(() => {\n highlightElem.style.opacity = '0'\n setTimeout(() => {\n highlightElem.remove()\n }, 500)\n }, 1000)\n }, 120)\n })\n\n return true\n }\n\n // register onDragover event listeners:\n document.addEventListener('dragover', onDragover)\n // register onDrop event listeners:\n document.addEventListener('drop', onDrop)\n\n return () => {\n document.removeEventListener('dragover', onDragover)\n document.removeEventListener('drop', onDrop)\n }\n }, [\n scrollerElem,\n blockHandleHorizontalOffset,\n anchorElem,\n editor,\n lastTargetBlock,\n draggableBlockElem,\n editorConfig?.admin?.hideGutter,\n ])\n\n function onDragStart(event: ReactDragEvent<HTMLButtonElement>): void {\n const dataTransfer = event.dataTransfer\n if (!dataTransfer || !draggableBlockElem) {\n return\n }\n setDragImage(dataTransfer, draggableBlockElem)\n let nodeKey = ''\n editor.update(() => {\n const node = $getNearestNodeFromDOMNode(draggableBlockElem)\n if (node) {\n nodeKey = node.getKey()\n }\n })\n isDraggingBlockRef.current = true\n dataTransfer.setData(DRAG_DATA_FORMAT, nodeKey)\n }\n\n function onDragEnd(): void {\n isDraggingBlockRef.current = false\n if (lastTargetBlock?.elem) {\n hideTargetLine(targetLineRef.current, lastTargetBlock?.elem)\n }\n }\n\n return createPortal(\n <React.Fragment>\n <button\n aria-label=\"Drag to move\"\n className=\"icon draggable-block-menu\"\n draggable\n onDragEnd={onDragEnd}\n onDragStart={onDragStart}\n ref={menuRef}\n type=\"button\"\n >\n <div className={isEditable ? 'icon' : ''} />\n </button>\n <div className=\"draggable-block-target-line\" ref={targetLineRef} />\n <div className=\"debug-highlight\" ref={debugHighlightRef} />\n </React.Fragment>,\n anchorElem,\n )\n}\n\nexport function DraggableBlockPlugin({\n anchorElem = document.body,\n}: {\n anchorElem?: HTMLElement\n}): React.ReactElement {\n const [editor] = useLexicalComposerContext()\n return useDraggableBlockMenu(editor, anchorElem, editor._editable)\n}\n", "'use client'\nimport { getCollapsedMargins } from '../utils/getCollapsedMargins.js'\nconst TARGET_LINE_HALF_HEIGHT = 0\nconst TEXT_BOX_HORIZONTAL_PADDING = -24\nconst DEBUG = false\n\nlet animationTimer = 0\n\nexport function setTargetLine(\n offsetWidth: string,\n offsetLeft: number,\n targetLineElem: HTMLElement,\n targetBlockElem: HTMLElement,\n lastTargetBlock: {\n boundingBox?: DOMRect\n elem: HTMLElement | null\n isBelow: boolean\n },\n mouseY: number,\n anchorElem: HTMLElement,\n event: DragEvent,\n debugHighlightRef: React.RefObject<HTMLDivElement | null>,\n isFoundNodeEmptyParagraph: boolean = false,\n) {\n const { height: targetBlockElemHeight, top: targetBlockElemTop } =\n targetBlockElem.getBoundingClientRect() // used to be getBoundingClientRectWithoutTransform. Not sure what's better, but the normal getBoundingClientRect seems to work fine\n const { top: anchorTop, width: anchorWidth } = anchorElem.getBoundingClientRect()\n\n const { marginBottom, marginTop } = getCollapsedMargins(targetBlockElem)\n let lineTop = targetBlockElemTop\n\n const isBelow = mouseY >= targetBlockElemTop + targetBlockElemHeight / 2 + window.scrollY\n\n let willStayInSamePosition = false\n\n /**\n * Do not run any transform or changes if the actual new line position would be the same (even if it's now inserted BEFORE rather than AFTER - position would still be the same)\n * This prevents unnecessary flickering.\n *\n * We still need to let it run even if the position (IGNORING the transform) would not change, as the transform animation is not finished yet. This is what animationTimer does. Otherwise, the positioning will be inaccurate\n */\n if (lastTargetBlock?.elem) {\n if (targetBlockElem !== lastTargetBlock?.elem) {\n if (\n isBelow &&\n lastTargetBlock?.elem &&\n lastTargetBlock?.elem === targetBlockElem.nextElementSibling\n ) {\n animationTimer++\n\n if (animationTimer < 200) {\n willStayInSamePosition = true\n }\n } else if (\n !isBelow &&\n lastTargetBlock?.elem &&\n lastTargetBlock?.elem === targetBlockElem.previousElementSibling\n ) {\n animationTimer++\n if (animationTimer < 200) {\n willStayInSamePosition = true\n }\n }\n } else {\n animationTimer++\n\n const lastBoundingBoxPosition = lastTargetBlock?.boundingBox?.y\n const currentBoundingBoxPosition = targetBlockElem.getBoundingClientRect().y\n\n if (\n (isBelow === lastTargetBlock?.isBelow &&\n lastBoundingBoxPosition === currentBoundingBoxPosition) ||\n animationTimer < 200\n ) {\n willStayInSamePosition = false\n }\n }\n }\n if (willStayInSamePosition) {\n return {\n isBelow,\n willStayInSamePosition,\n }\n }\n\n /**\n * Paragraphs need no isBelow/above handling,\n */\n if (!isFoundNodeEmptyParagraph) {\n //if (!isFoundNodeEmptyParagraph) {\n if (isBelow) {\n // below targetBlockElem\n lineTop += targetBlockElemHeight + marginBottom / 2\n } else {\n // above targetBlockElem\n lineTop -= marginTop / 2\n }\n } else {\n lineTop += targetBlockElemHeight / 2\n }\n\n let targetElemTranslate2 = 0\n\n if (!isFoundNodeEmptyParagraph) {\n if (isBelow) {\n targetElemTranslate2 = -TARGET_LINE_HALF_HEIGHT\n } else {\n targetElemTranslate2 = TARGET_LINE_HALF_HEIGHT\n }\n }\n\n const top = lineTop - anchorTop + targetElemTranslate2\n\n const left = TEXT_BOX_HORIZONTAL_PADDING - offsetLeft\n\n targetLineElem.style.width = `calc(${anchorWidth}px - ${offsetWidth})`\n targetLineElem.style.opacity = '.8'\n\n // if (DEBUG) {\n // //targetBlockElem.style.border = '3px solid red'\n // highlightElemOriginalPosition(debugHighlightRef, targetBlockElem, anchorElem)\n // }\n\n targetLineElem.style.transform = `translate(${left}px, calc(${top}px - ${'2px'}))`\n\n /**\n * Properly reset previous targetBlockElem styles\n */\n if (lastTargetBlock?.elem) {\n lastTargetBlock.elem.style.opacity = ''\n\n if (lastTargetBlock?.elem === targetBlockElem) {\n if (isBelow) {\n lastTargetBlock.elem.style.marginTop = ''\n } else {\n lastTargetBlock.elem.style.marginBottom = ''\n }\n } else {\n lastTargetBlock.elem.style.marginBottom = ''\n lastTargetBlock.elem.style.marginTop = ''\n }\n }\n\n animationTimer = 0\n return {\n isBelow,\n willStayInSamePosition,\n }\n}\n", "/* eslint-disable jsx-a11y/click-events-have-key-events */\n'use client'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { $createParagraphNode, $getRoot } from 'lexical'\nimport React from 'react'\n\nimport './index.scss'\nimport { useEditorConfigContext } from '../../config/client/EditorConfigProvider.js'\nconst baseClass = 'insert-paragraph-at-end'\n\nexport const InsertParagraphAtEndPlugin: React.FC = () => {\n const [editor] = useLexicalComposerContext()\n const { editorConfig } = useEditorConfigContext()\n\n if (editorConfig?.admin?.hideInsertParagraphAtEnd) {\n return null\n }\n\n const onClick = () => {\n editor.update(() => {\n const paragraphNode = $createParagraphNode()\n $getRoot().append(paragraphNode)\n paragraphNode.select()\n })\n }\n\n return (\n // TODO: convert to button\n <div\n aria-label=\"Insert Paragraph\"\n className={baseClass}\n onClick={onClick}\n role=\"button\"\n tabIndex={0}\n >\n <div className={`${baseClass}-inside`}>\n <span>+</span>\n </div>\n </div>\n )\n}\n", "'use client'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport * as React from 'react'\n\nimport { registerMarkdownShortcuts } from '../../../packages/@lexical/markdown/MarkdownShortcuts.js'\nimport { useEditorConfigContext } from '../../config/client/EditorConfigProvider.js'\n\nexport const MarkdownShortcutPlugin: React.FC = () => {\n const { editorConfig } = useEditorConfigContext()\n const [editor] = useLexicalComposerContext()\n\n React.useEffect(() => {\n return registerMarkdownShortcuts(editor, editorConfig.features.markdownTransformers ?? [])\n }, [editor, editorConfig.features.markdownTransformers])\n\n return null\n}\n", "'use client'\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { useEffect } from 'react'\n\nimport { useRichTextView } from '../../../field/RichTextViewProvider.js'\nimport { clearEditorNodeViews, registerEditorNodeViews } from '../../nodes/index.js'\n\nexport function NodeViewOverridePlugin(): null {\n const [editor] = useLexicalComposerContext()\n const { currentView, views } = useRichTextView()\n\n useEffect(() => {\n if (!views) {\n return\n }\n\n if (currentView === 'default') {\n if (views.default) {\n registerEditorNodeViews(editor, views.default)\n } else {\n clearEditorNodeViews(editor)\n }\n } else if (views[currentView]) {\n clearEditorNodeViews(editor)\n registerEditorNodeViews(editor, views[currentView])\n }\n }, [editor, views, currentView])\n\n return null\n}\n", "import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { $getSelection, $isRangeSelection, RootNode } from 'lexical'\nimport { useEffect } from 'react'\n\n/**\n * By default, Lexical throws an error if the selection ends in deleted nodes.\n * This is very aggressive considering there are reasons why this can happen\n * outside of Payload's control (custom features or conflicting features, for example).\n * In the case of selections on nonexistent nodes, this plugin moves the selection to\n * the end of the editor and displays a warning instead of an error.\n */\nexport function NormalizeSelectionPlugin() {\n const [editor] = useLexicalComposerContext()\n\n useEffect(() => {\n return editor.registerNodeTransform(RootNode, (root) => {\n const selection = $getSelection()\n if ($isRangeSelection(selection)) {\n const anchorNode = selection.anchor.getNode()\n const focusNode = selection.focus.getNode()\n if (!anchorNode.isAttached() || !focusNode.isAttached()) {\n root.selectEnd()\n // eslint-disable-next-line no-console\n console.warn(\n 'updateEditor: selection has been moved to the end of the editor because the previously selected nodes have been removed and ' +\n \"selection wasn't moved to another node. Ensure selection changes after removing/replacing a selected node.\",\n )\n }\n }\n return false\n })\n }, [editor])\n\n return null\n}\n", "import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { $getSelection, COMMAND_PRIORITY_LOW, SELECT_ALL_COMMAND } from 'lexical'\nimport { useEffect } from 'react'\n\n/**\n * Allows to select inputs with `ctrl+a` or `cmd+a`.\n * Required because Lexical preventDefault the event.\n * see: https://github.com/payloadcms/payload/issues/6871\n */\nexport function SelectAllPlugin() {\n const [editor] = useLexicalComposerContext()\n\n useEffect(() => {\n return editor.registerCommand(\n SELECT_ALL_COMMAND,\n () => {\n const selection = $getSelection()\n if (selection) {\n return false\n }\n const activeElement = document.activeElement\n if (activeElement instanceof HTMLInputElement) {\n activeElement.select()\n }\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n }, [editor])\n\n return null\n}\n", "'use client'\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { useTranslation } from '@payloadcms/ui'\nimport { useCallback, useMemo, useState } from 'react'\nimport * as React from 'react'\nimport * as ReactDOM from 'react-dom'\n\nimport type {\n SlashMenuGroup,\n SlashMenuGroupInternal,\n SlashMenuItemInternal,\n SlashMenuItem as SlashMenuItemType,\n} from './LexicalTypeaheadMenuPlugin/types.js'\n\nimport { useEditorConfigContext } from '../../config/client/EditorConfigProvider.js'\nimport './index.scss'\nimport { LexicalTypeaheadMenuPlugin } from './LexicalTypeaheadMenuPlugin/index.js'\nimport { useMenuTriggerMatch } from './useMenuTriggerMatch.js'\n\nconst baseClass = 'slash-menu-popup'\n\nfunction SlashMenuItem({\n isSelected,\n item,\n onClick,\n onMouseEnter,\n ref,\n}: {\n index: number\n isSelected: boolean\n item: SlashMenuItemInternal\n onClick: () => void\n onMouseEnter: () => void\n ref?: React.Ref<HTMLButtonElement>\n}) {\n const {\n fieldProps: { featureClientSchemaMap, schemaPath },\n } = useEditorConfigContext()\n\n const { i18n } = useTranslation<{}, string>()\n\n let className = `${baseClass}__item ${baseClass}__item-${item.key}`\n if (isSelected) {\n className += ` ${baseClass}__item--selected`\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 <button\n aria-selected={isSelected}\n className={className}\n id={baseClass + '__item-' + item.key}\n key={item.key}\n onClick={onClick}\n onMouseEnter={onMouseEnter}\n ref={ref}\n role=\"option\"\n tabIndex={-1}\n type=\"button\"\n >\n {item?.Icon && <item.Icon />}\n\n <span className={`${baseClass}__item-text`}>{title}</span>\n </button>\n )\n}\n\nexport function SlashMenuPlugin({\n anchorElem = document.body,\n}: {\n anchorElem?: HTMLElement\n}): React.ReactElement {\n const [editor] = useLexicalComposerContext()\n const [queryString, setQueryString] = useState<null | string>(null)\n const { editorConfig } = useEditorConfigContext()\n const { i18n } = useTranslation<{}, string>()\n const {\n fieldProps: { featureClientSchemaMap, schemaPath },\n } = useEditorConfigContext()\n\n const checkForTriggerMatch = useMenuTriggerMatch('/', {\n minLength: 0,\n })\n\n const getDynamicItems = useCallback(() => {\n let groupWithItems: Array<SlashMenuGroup> = []\n\n for (const dynamicItem of editorConfig.features.slashMenu.dynamicGroups) {\n if (queryString) {\n const dynamicGroupWithItems = dynamicItem({\n editor,\n queryString,\n })\n groupWithItems = groupWithItems.concat(dynamicGroupWithItems)\n }\n }\n\n return groupWithItems\n }, [editor, queryString, editorConfig?.features])\n\n const groups: SlashMenuGroup[] = useMemo(() => {\n let groupsWithItems: SlashMenuGroup[] = []\n for (const groupWithItem of editorConfig?.features.slashMenu.groups ?? []) {\n groupsWithItems.push(groupWithItem)\n }\n\n if (queryString) {\n // Filter current groups first\n // @ts-expect-error - TODO: fix this\n groupsWithItems = groupsWithItems.map((group) => {\n const filteredItems = group.items.filter((item) => {\n let itemTitle = item.key\n if (item.label) {\n itemTitle =\n typeof item.label === 'function'\n ? item.label({ featureClientSchemaMap, i18n, schemaPath })\n : item.label\n }\n\n if (new RegExp(queryString, 'gi').exec(itemTitle)) {\n return true\n }\n if (item.keywords != null) {\n return item.keywords.some((keyword) => new RegExp(queryString, 'gi').exec(keyword))\n }\n return false\n })\n if (filteredItems.length) {\n return {\n ...group,\n items: filteredItems,\n }\n }\n return null\n })\n\n groupsWithItems = groupsWithItems.filter((group) => group != null)\n\n // Now add dynamic groups\n const dynamicItemGroups = getDynamicItems()\n\n // merge dynamic items into groups\n for (const dynamicGroup of dynamicItemGroups) {\n // 1. find the group with the same name or create new one\n let group = groupsWithItems.find((group) => group.key === dynamicGroup.key)\n if (!group) {\n group = {\n ...dynamicGroup,\n items: [],\n }\n } else {\n groupsWithItems = groupsWithItems.filter((group) => group.key !== dynamicGroup.key)\n }\n\n // 2. Add items to group items array and add to sanitized.slashMenu.groupsWithItems\n if (group?.items?.length) {\n group.items = group.items.concat(group.items)\n }\n groupsWithItems.push(group)\n }\n }\n\n return groupsWithItems\n }, [\n queryString,\n editorConfig?.features.slashMenu.groups,\n getDynamicItems,\n featureClientSchemaMap,\n i18n,\n schemaPath,\n ])\n\n return (\n <LexicalTypeaheadMenuPlugin\n anchorElem={anchorElem}\n groups={groups as SlashMenuGroupInternal[]}\n menuRenderFn={(\n anchorElementRef,\n { selectedItemKey, selectItemAndCleanUp, setSelectedItemKey },\n ) =>\n anchorElementRef.current && groups.length\n ? ReactDOM.createPortal(\n <div className={baseClass}>\n {groups.map((group) => {\n let groupTitle = group.key\n if (group.label && featureClientSchemaMap) {\n groupTitle =\n typeof group.label === 'function'\n ? group.label({ featureClientSchemaMap, i18n, schemaPath })\n : group.label\n }\n\n return (\n <div\n className={`${baseClass}__group ${baseClass}__group-${group.key}`}\n key={group.key}\n >\n <div className={`${baseClass}__group-title`}>{groupTitle}</div>\n {group.items.map((item, oi: number) => (\n <SlashMenuItem\n index={oi}\n isSelected={selectedItemKey === item.key}\n item={item as SlashMenuItemInternal}\n key={item.key}\n onClick={() => {\n setSelectedItemKey(item.key)\n selectItemAndCleanUp(item)\n }}\n onMouseEnter={() => {\n setSelectedItemKey(item.key)\n }}\n ref={(el) => {\n ;(item as SlashMenuItemInternal).ref = { current: el }\n }}\n />\n ))}\n </div>\n )\n })}\n </div>,\n anchorElementRef.current,\n )\n : null\n }\n onQueryChange={setQueryString}\n triggerFn={checkForTriggerMatch}\n />\n )\n}\n", "'use client'\nimport type { LexicalEditor } from 'lexical'\n\nimport { useCallback } from 'react'\n\nimport { PUNCTUATION } from './LexicalTypeaheadMenuPlugin/index.js'\n\nexport type TriggerFn = ({\n editor,\n query,\n}: {\n editor: LexicalEditor\n /** The query string is the POTENTIAL trigger AND the text after the trigger text. */\n query: string\n}) => MenuTextMatch | null\n\nexport type MenuTextMatch = {\n leadOffset: number\n matchingString: string\n replaceableString: string\n}\n\n/**\n * Returns a function which checks if the trigger (e.g. '/') is present in the query and, if so, returns the matching string (text after the trigger)\n */\nexport function useMenuTriggerMatch(\n /**\n * Text which triggers the menu. Everything after this text will be used as the query.\n */\n trigger: string,\n { maxLength = 75, minLength = 1 }: { maxLength?: number; minLength?: number },\n): TriggerFn {\n return useCallback(\n ({ query }) => {\n const validChars = '[^' + trigger + PUNCTUATION + '\\\\s]'\n const TypeaheadTriggerRegex = new RegExp(\n '(^|\\\\s|\\\\()(' +\n '[' +\n trigger +\n ']' +\n '((?:' +\n validChars +\n '){0,' +\n maxLength +\n '})' +\n ')$',\n )\n const match = TypeaheadTriggerRegex.exec(query)\n if (match !== null) {\n const maybeLeadingWhitespace = match[1]!\n\n /**\n * matchingString is only the text AFTER the trigger text. (So everything after the /)\n */\n const matchingString = match[3]!\n\n if (matchingString.length >= minLength) {\n return {\n leadOffset: match.index + maybeLeadingWhitespace.length,\n matchingString,\n replaceableString: match[2]!, // replaceableString is the trigger text + the matching string\n }\n }\n }\n return null\n },\n [maxLength, minLength, trigger],\n )\n}\n", "'use client'\nimport type { TextFormatType } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { TEXT_TYPE_TO_FORMAT, TextNode } from 'lexical'\nimport { useEffect } from 'react'\n\nimport type { SanitizedClientFeatures } from '../../../features/typesClient.js'\n\nexport function TextPlugin({ features }: { features: SanitizedClientFeatures }) {\n const [editor] = useLexicalComposerContext()\n\n useEffect(() => {\n const disabledFormats = getDisabledFormats(features.enabledFormats)\n if (disabledFormats.length === 0) {\n return\n }\n // Ideally override the TextNode with our own TextNode (changing its setFormat or toggleFormat methods),\n // would be more performant. If we find a noticeable perf regression we can switch to that option.\n // Overriding the FORMAT_TEXT_COMMAND and PASTE_COMMAND commands is not an option I considered because\n // there might be other forms of mutation that we might not be considering. For example:\n // browser extensions or Payload/Lexical plugins that have their own commands.\n return editor.registerNodeTransform(TextNode, (textNode) => {\n disabledFormats.forEach((disabledFormat) => {\n if (textNode.hasFormat(disabledFormat)) {\n textNode.toggleFormat(disabledFormat)\n }\n })\n })\n }, [editor, features])\n\n return null\n}\n\nfunction getDisabledFormats(enabledFormats: TextFormatType[]): TextFormatType[] {\n const allFormats = Object.keys(TEXT_TYPE_TO_FORMAT) as TextFormatType[]\n const enabledSet = new Set(enabledFormats)\n\n return allFormats.filter((format) => !enabledSet.has(format))\n}\n", "'use client'\nimport type { JSX } from 'react'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { ContentEditable } from '@lexical/react/LexicalContentEditable.js'\nimport { useTranslation } from '@payloadcms/ui'\n\nimport './ContentEditable.scss'\n\nimport * as React from 'react'\n\nimport type { SanitizedClientEditorConfig } from '../config/types.js'\n\nexport function LexicalContentEditable({\n className,\n editorConfig,\n}: {\n className?: string\n editorConfig: SanitizedClientEditorConfig\n}): JSX.Element {\n const { t } = useTranslation<{}, string>()\n const [_, { getTheme }] = useLexicalComposerContext()\n const theme = getTheme()\n\n return (\n <ContentEditable\n aria-placeholder={t('lexical:general:placeholder')}\n className={className ?? 'ContentEditable__root'}\n placeholder={\n <p className={theme?.placeholder}>\n {editorConfig?.admin?.placeholder ?? t('lexical:general:placeholder')}\n </p>\n }\n />\n )\n}\n", "'use client'\nimport { ChevronIcon, Popup, PopupList } from '@payloadcms/ui'\nimport React from 'react'\n\nimport { useRichTextView } from './RichTextViewProvider.js'\nimport './ViewSelector.scss'\n\nexport function ViewSelector(): null | React.ReactElement {\n const { currentView, setCurrentView, views } = useRichTextView()\n\n // Don't show if no views or only default exists\n if (!views || Object.keys(views).length === 0) {\n return null\n }\n\n const viewKeys = Object.keys(views)\n const hasNonDefaultViews = viewKeys.some((key) => key !== 'default')\n\n // If only 'default' exists, no need to show selector\n if (!hasNonDefaultViews) {\n return null\n }\n\n // Build list of available views\n const allViews = ['default', ...viewKeys.filter((key) => key !== 'default')]\n\n const currentViewLabel = currentView.charAt(0).toUpperCase() + currentView.slice(1)\n\n return (\n <div className=\"lexical-view-selector\">\n <Popup\n button={\n <button className=\"lexical-view-selector__button\" type=\"button\">\n <span className=\"lexical-view-selector__label\">{currentViewLabel}</span>\n <ChevronIcon className=\"lexical-view-selector__icon\" />\n </button>\n }\n buttonType=\"custom\"\n horizontalAlign=\"left\"\n render={({ close }) => (\n <PopupList.ButtonGroup>\n {allViews.map((viewName) => {\n const viewLabel = viewName.charAt(0).toUpperCase() + viewName.slice(1)\n\n return (\n <PopupList.Button\n active={viewName === currentView}\n disabled={viewName === currentView}\n key={viewName}\n onClick={() => {\n setCurrentView?.(viewName)\n close()\n }}\n >\n {viewLabel}\n </PopupList.Button>\n )\n })}\n </PopupList.ButtonGroup>\n )}\n size=\"large\"\n />\n </div>\n )\n}\n"],
5
+ "mappings": "gOAGA,OACEA,oBAAAA,GACAC,cAAAA,GACAC,cAAAA,GACAC,yBAAAA,GACAC,gBAAAA,GACAC,kBAAAA,GACAC,YAAAA,OACK,iBACP,OAASC,oBAAAA,OAAwB,wBACjC,OAASC,UAAAA,OAAc,cAEvB,OAAOC,IAASC,eAAAA,GAAaC,aAAAA,GAAWC,WAAAA,GAASC,YAAAA,OAAgB,QACjE,OAASC,iBAAAA,OAAqB,uBAK9B,MAAO,wDCjBP,OAASC,mBAAAA,OAAuB,oCAChC,OAASC,gBAAAA,OAAoB,iBAC7B,UAAYC,OAAW,QACvB,OAASC,WAAAA,OAAe,iDCNxB,OAAgBC,iBAAAA,GAAeC,OAAAA,GAAKC,WAAAA,OAAe,QA2BnD,IAAMC,GAAsBH,GAAuC,CACjEI,YAAa,UACbC,eAAgBC,OAChBC,eAAgBD,OAChBE,MAAOF,MACT,CAAA,EAoBaG,GAKRA,CAAC,CAAEC,SAAAA,EAAUN,YAAAA,EAAc,UAAWG,eAAAA,EAAgBC,MAAAA,CAAK,IAAE,CAChE,IAAMH,EAAiBH,GAAQ,IAAA,CAC7B,GAAKM,EAGL,OAAOA,EAAMJ,CAAA,GAAgBI,EAAMG,OACrC,EAAG,CAACH,EAAOJ,CAAA,CAAY,EAEjBQ,EAAQV,GACZ,KAAO,CACLE,YAAAA,EACAC,eAAAA,EACAE,eAAAA,EACAC,MAAAA,CACF,GACA,CAACJ,EAAaG,EAAgBF,EAAgBG,CAAA,CAAM,EAGtD,OAAOK,GAACV,GAAA,CAAoBS,MAAOA,WAAQF,GAC7C,EAmCO,SAASI,GAAA,CACd,IAAMC,EAAUd,GAAIE,EAAA,EAEpB,GAAI,CAACY,EACH,MAAM,IAAIC,MAAM,4DAAA,EAGlB,OAAOD,C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,UAAWA,EAAWE,KAAMA,EAAMD,SAAUA,IAExEsE,EAACU,GAAA,CAAA,CAAA,CAAA,IAEHP,GAAC,MAAA,CAAI/E,UAAW,GAAGN,EAAA,mBACjBqF,GAACQ,GAAA,CAAcC,eAAgBA,GAAgBC,QAASA,IAAA,CAAO,YAC5DrE,EACDwD,EAACc,GAAA,CACCC,YAAatC,GACbxD,aAAcA,EACd+F,WAAYhG,EACZmC,qBAAsBA,EAEtB8D,SAAUnC,GACVxD,SAAUsB,EACVR,MAAOA,GAHFsD,KAAKE,UAAU,CAAEhB,YAAAA,EAAajD,KAAAA,EAAM2B,oBAAAA,CAAoB,CAAA,CAAA,EAK9Df,CAAA,IAEHyD,EAACK,GAAA,CACCC,gBAAiB7D,EACjB8D,SAAUP,EAACkB,GAAA,CAAiB7F,YAAaA,EAAaM,KAAMA,WA5BpC8C,EAAA,GAkCpC,EAEA,SAASmC,GAAe,CAAEO,MAAAA,CAAK,EAAoB,CAGjD,OACEhB,GAAC,MAAA,CAAI/E,UAAU,gBAAgBgG,KAAK,kBAClCpB,EAAC,IAAA,UAAE,0BACHA,EAAC,MAAA,CAAII,MAAO,CAAEiB,MAAO,KAAM,WAAIF,EAAMG,YAG3C,CAEO,IAAMC,GAAqCxG",
6
+ "names": ["FieldDescription", "FieldError", "FieldLabel", "RenderCustomComponent", "useEditDepth", "useEffectEvent", "useField", "mergeFieldStyles", "dequal", "React", "useCallback", "useEffect", "useMemo", "useState", "ErrorBoundary", "LexicalComposer", "useEditDepth", "React", "useMemo", "createContext", "use", "useMemo", "RichTextViewContext", "currentView", "currentViewMap", "undefined", "setCurrentView", "views", "RichTextViewProvider", "children", "default", "value", "_jsx", "useRichTextView", "context", "Error", "c", "_c", "useLexicalComposerContext", "LexicalErrorBoundary", "HistoryPlugin", "OnChangePlugin", "RichTextPlugin", "useLexicalEditable", "BLUR_COMMAND", "COMMAND_PRIORITY_LOW", "FOCUS_COMMAND", "React", "useEffect", "useState", "EditorPlugin", "anchorElem", "clientProps", "plugin", "position", "Component", "_jsx", "c", "_c", "copyToClipboard", "useLexicalComposerContext", "objectKlassEquals", "ObjectID", "COMMAND_PRIORITY_LOW", "COPY_COMMAND", "useEffect", "ClipboardPlugin", "$", "editor", "t0", "t1", "registerCommand", "event", "ClipboardEvent", "then", "clipboardData", "Error", "lexicalStringified", "getData", "lexical", "JSON", "parse", "changeIds", "node", "fields", "id", "default", "toHexString", "children", "child", "node_0", "nodes", "stringified", "stringify", "setData", "catch", "error", "c", "_c", "useLexicalComposerContext", "$findMatchingParent", "mergeRegister", "$createNodeSelection", "$getEditor", "$getNearestNodeFromDOMNode", "$getSelection", "$isDecoratorNode", "$isElementNode", "$isLineBreakNode", "$isNodeSelection", "$isRangeSelection", "$isRootOrShadowRoot", "$isTextNode", "$setSelection", "CLICK_COMMAND", "COMMAND_PRIORITY_LOW", "KEY_ARROW_DOWN_COMMAND", "KEY_ARROW_UP_COMMAND", "KEY_BACKSPACE_COMMAND", "KEY_DELETE_COMMAND", "SELECTION_CHANGE_COMMAND", "useEffect", "DecoratorPlugin", "$", "editor", "$onDelete", "_temp2", "t0", "t1", "registerCommand", "_temp3", "_temp4", "_temp6", "_temp8", "event_2", "selection_1", "selection", "event", "preventDefault", "nextSibling", "getNodes", "getNextSibling", "element_0", "getElementByKey", "getKey", "element", "$selectDecorator", "node", "firstDescendant", "getFirstDescendant", "INTERNAL_$isBlock", "selectEnd", "lastNode", "isBackward", "anchor", "focus", "getNode", "lastSelectedBlock", "_temp7", "nextBlock", "findLaterSiblingBlock", "nextBlockElement", "node_1", "event_1", "selection_0", "prevSibling", "getPreviousSibling", "lastDescendant", "getLastDescendant", "selectStart", "firstNode", "firstSelectedBlock", "_temp5", "prevBlock", "findFirstSiblingBlock", "prevBlockElement", "node_0", "decorator_0", "$getSelectedDecorator", "document", "querySelector", "classList", "remove", "decorator", "add", "event_0", "$getDecoratorByMouseEvent", "target", "HTMLElement", "isContentEditable", "closest", "forEach", "_temp", "undefined", "nodes", "length", "scrollIntoView", "behavior", "block", "isInline", "firstChild", "getFirstChild", "isLeafElement", "canBeEmpty", "current", "useLexicalComposerContext", "$createParagraphNode", "isHTMLElement", "React", "useCallback", "useEffect", "useRef", "useState", "createPortal", "calculateDistanceFromScrollerElem", "scrollerElem", "pageX", "pageY", "target", "horizontalBuffer", "verticalBuffer", "distanceFromScrollerElem", "contains", "bottom", "left", "right", "top", "getBoundingClientRect", "adjustedTop", "window", "scrollY", "adjustedBottom", "$getNodeByKey", "getBoundingClientRectWithoutTransform", "elem", "rect", "getBoundingClientRect", "transformValue", "getComputedStyle", "getPropertyValue", "lastNumberOfTransformValue", "split", "pop", "y", "Number", "replace", "getCollapsedMargins", "elem", "getMargin", "element", "margin", "parseFloat", "window", "getComputedStyle", "marginBottom", "marginTop", "prevElemSiblingMarginBottom", "previousElementSibling", "nextElemSiblingMarginTop", "nextElementSibling", "collapsedTopMargin", "Math", "max", "$getRoot", "getTopLevelNodeKeys", "editor", "getEditorState", "read", "getChildrenKeys", "Downward", "Upward", "Indeterminate", "cache", "props", "result", "isPointClose", "previous", "current", "threshold", "dx", "x", "dy", "y", "getNodeCloseToPoint", "anchorElem", "cache_threshold", "editor", "fuzzy", "horizontalOffset", "point", "startIndex", "useEdgeAsDefault", "anchorElementRect", "getBoundingClientRect", "topLevelNodeKeys", "getTopLevelNodeKeys", "closestBlockElem", "blockElem", "blockNode", "distance", "Infinity", "foundAtIndex", "isFoundNodeEmptyParagraph", "getEditorState", "read", "firstNode", "getElementByKey", "lastNode", "length", "firstNodeRect", "lastNodeRect", "getBoundingClientRectWithoutTransform", "top", "$getNodeByKey", "bottom", "index", "direction", "key", "elem", "Point", "domRect", "Rect", "fromDOMRect", "marginBottom", "marginTop", "getCollapsedMargins", "rect", "generateNewRect", "left", "right", "isOnBottomSide", "isOnTopSide", "distanceFromPoint", "getType", "getTextContent", "returnEmptyParagraphs", "isOnHandleElement", "element", "handleElementClassName", "closest", "replacedElements", "doesLineHeightAffectElement", "htmlElem", "includes", "tagName", "offsetHeight", "offsetWidth", "style", "window", "getComputedStyle", "display", "position", "visibility", "opacity", "setHandlePosition", "targetElem", "handleElem", "anchorElem", "leftOffset", "style", "opacity", "transform", "targetRect", "getBoundingClientRect", "targetStyle", "window", "getComputedStyle", "floatingElemRect", "anchorElementRect", "top", "some", "classes", "classList", "contains", "firstElementChild", "actualLineHeight", "doesLineHeightAffectElement", "parseInt", "lineHeight", "height", "left", "ADD_BLOCK_MENU_CLASSNAME", "prevIndex", "Infinity", "getCurrentIndex", "keysLength", "Math", "floor", "useAddBlockHandle", "editor", "anchorElem", "isEditable", "scrollerElem", "parentElement", "editorConfig", "useEditorConfigContext", "blockHandleHorizontalOffset", "admin", "hideGutter", "menuRef", "useRef", "hoveredElement", "setHoveredElement", "useState", "useEffect", "onDocumentMouseMove", "event", "target", "isHTMLElement", "distanceFromScrollerElem", "calculateDistanceFromScrollerElem", "pageX", "pageY", "isOnHandleElement", "topLevelNodeKeys", "getTopLevelNodeKeys", "blockElem", "_emptyBlockElem", "blockNode", "foundAtIndex", "getNodeCloseToPoint", "cache_threshold", "horizontalOffset", "point", "Point", "x", "y", "returnEmptyParagraphs", "startIndex", "length", "useEdgeAsDefault", "node", "elem", "document", "addEventListener", "removeEventListener", "current", "setHandlePosition", "handleAddClick", "useCallback", "hoveredElementToUse", "update", "isEmptyParagraph", "getType", "getTextContent", "newParagraph", "$createParagraphNode", "insertAfter", "setTimeout", "getElementByKey", "getKey", "focus", "select", "dispatchCommand", "ENABLE_SLASH_MENU_COMMAND", "stopPropagation", "preventDefault", "createPortal", "_jsx", "Fragment", "className", "onClick", "ref", "type", "AddBlockHandlePlugin", "t0", "t1", "undefined", "body", "useLexicalComposerContext", "_editable", "useLexicalComposerContext", "eventFiles", "$getNearestNodeFromDOMNode", "$getNodeByKey", "isHTMLElement", "React", "useEffect", "useRef", "useState", "createPortal", "TARGET_LINE_HALF_HEIGHT", "TEXT_BOX_HORIZONTAL_PADDING", "animationTimer", "setTargetLine", "offsetWidth", "offsetLeft", "targetLineElem", "targetBlockElem", "lastTargetBlock", "mouseY", "anchorElem", "event", "debugHighlightRef", "isFoundNodeEmptyParagraph", "height", "targetBlockElemHeight", "top", "targetBlockElemTop", "getBoundingClientRect", "anchorTop", "width", "anchorWidth", "marginBottom", "marginTop", "getCollapsedMargins", "lineTop", "isBelow", "window", "scrollY", "willStayInSamePosition", "elem", "nextElementSibling", "previousElementSibling", "lastBoundingBoxPosition", "boundingBox", "y", "currentBoundingBoxPosition", "targetElemTranslate2", "TARGET_LINE_HALF_HEIGHT", "left", "TEXT_BOX_HORIZONTAL_PADDING", "style", "opacity", "transform", "DRAGGABLE_BLOCK_MENU_CLASSNAME", "DRAG_DATA_FORMAT", "prevIndex", "Infinity", "getCurrentIndex", "keysLength", "Math", "floor", "setDragImage", "dataTransfer", "draggableBlockElem", "transform", "style", "setTimeout", "hideTargetLine", "targetLineElem", "lastTargetBlockElem", "opacity", "marginBottom", "marginTop", "useDraggableBlockMenu", "editor", "anchorElem", "isEditable", "scrollerElem", "parentElement", "menuRef", "useRef", "targetLineRef", "debugHighlightRef", "isDraggingBlockRef", "setDraggableBlockElem", "useState", "lastTargetBlock", "setLastTargetBlock", "editorConfig", "useEditorConfigContext", "blockHandleHorizontalOffset", "admin", "hideGutter", "useEffect", "onDocumentMouseMove", "event", "target", "isHTMLElement", "distanceFromScrollerElem", "calculateDistanceFromScrollerElem", "pageX", "pageY", "isOnHandleElement", "topLevelNodeKeys", "getTopLevelNodeKeys", "blockElem", "_draggableBlockElem", "foundAtIndex", "isFoundNodeEmptyParagraph", "getNodeCloseToPoint", "cache_threshold", "horizontalOffset", "point", "Point", "x", "y", "startIndex", "length", "useEdgeAsDefault", "verbose", "document", "addEventListener", "removeEventListener", "current", "setHandlePosition", "onDragover", "isFileTransfer", "eventFiles", "targetBlockElem", "fuzzy", "isBelow", "willStayInSamePosition", "setTargetLine", "getBoundingClientRect", "width", "preventDefault", "boundingBox", "elem", "onDrop", "dragData", "getData", "update", "draggedNode", "$getNodeByKey", "targetNode", "$getNearestNodeFromDOMNode", "height", "targetBlockElemHeight", "top", "targetBlockElemTop", "getBoundingClientRectWithoutTransform", "window", "scrollY", "insertBefore", "remove", "insertAfter", "querySelectorAll", "forEach", "highlighter", "newInsertedElem", "getElementByKey", "getKey", "newInsertedElemRect", "highlightElem", "createElement", "className", "backgroundColor", "transition", "zIndex", "pointerEvents", "boxSizing", "borderRadius", "position", "body", "appendChild", "left", "onDragStart", "nodeKey", "node", "setData", "onDragEnd", "createPortal", "_jsxs", "Fragment", "_jsx", "draggable", "ref", "type", "DraggableBlockPlugin", "t0", "t1", "undefined", "useLexicalComposerContext", "_editable", "c", "_c", "useLexicalComposerContext", "$createParagraphNode", "$getRoot", "baseClass", "InsertParagraphAtEndPlugin", "$", "_c", "editor", "useLexicalComposerContext", "editorConfig", "useEditorConfigContext", "admin", "hideInsertParagraphAtEnd", "t0", "_jsx", "className", "onClick", "update", "_temp", "role", "tabIndex", "children", "paragraphNode", "$createParagraphNode", "$getRoot", "append", "select", "c", "_c", "useLexicalComposerContext", "React", "MarkdownShortcutPlugin", "$", "_c", "editorConfig", "useEditorConfigContext", "editor", "useLexicalComposerContext", "t0", "t1", "features", "markdownTransformers", "registerMarkdownShortcuts", "useEffect", "c", "_c", "useLexicalComposerContext", "useEffect", "NodeViewOverridePlugin", "$", "_c", "editor", "useLexicalComposerContext", "currentView", "views", "useRichTextView", "t0", "t1", "default", "registerEditorNodeViews", "clearEditorNodeViews", "useEffect", "useLexicalComposerContext", "$getSelection", "$isRangeSelection", "RootNode", "useEffect", "NormalizeSelectionPlugin", "editor", "registerNodeTransform", "root", "selection", "anchorNode", "anchor", "getNode", "focusNode", "focus", "isAttached", "selectEnd", "console", "warn", "useLexicalComposerContext", "$getSelection", "COMMAND_PRIORITY_LOW", "SELECT_ALL_COMMAND", "useEffect", "SelectAllPlugin", "editor", "registerCommand", "activeElement", "document", "HTMLInputElement", "select", "useLexicalComposerContext", "useTranslation", "useCallback", "useMemo", "useState", "ReactDOM", "c", "_c", "useMenuTriggerMatch", "trigger", "t0", "$", "_c", "maxLength", "t1", "minLength", "t2", "undefined", "t3", "t4", "query", "validChars", "PUNCTUATION", "match", "RegExp", "exec", "maybeLeadingWhitespace", "matchingString", "length", "leadOffset", "index", "replaceableString", "baseClass", "SlashMenuItem", "isSelected", "item", "onClick", "onMouseEnter", "ref", "fieldProps", "featureClientSchemaMap", "schemaPath", "useEditorConfigContext", "i18n", "useTranslation", "className", "key", "title", "label", "length", "substring", "_jsxs", "id", "role", "tabIndex", "type", "Icon", "_jsx", "SlashMenuPlugin", "anchorElem", "document", "body", "editor", "useLexicalComposerContext", "queryString", "setQueryString", "useState", "editorConfig", "checkForTriggerMatch", "useMenuTriggerMatch", "minLength", "getDynamicItems", "useCallback", "groupWithItems", "dynamicItem", "features", "slashMenu", "dynamicGroups", "dynamicGroupWithItems", "concat", "groups", "useMemo", "groupsWithItems", "groupWithItem", "push", "map", "group", "filteredItems", "items", "filter", "itemTitle", "RegExp", "exec", "keywords", "some", "keyword", "dynamicItemGroups", "dynamicGroup", "find", "LexicalTypeaheadMenuPlugin", "menuRenderFn", "anchorElementRef", "selectedItemKey", "selectItemAndCleanUp", "setSelectedItemKey", "current", "createPortal", "groupTitle", "oi", "index", "el", "onQueryChange", "triggerFn", "c", "_c", "useLexicalComposerContext", "TEXT_TYPE_TO_FORMAT", "TextNode", "useEffect", "TextPlugin", "t0", "$", "features", "editor", "t1", "enabledFormats", "disabledFormats", "getDisabledFormats", "length", "registerNodeTransform", "textNode", "forEach", "disabledFormat", "hasFormat", "toggleFormat", "t2", "allFormats", "Object", "keys", "enabledSet", "Set", "filter", "format", "has", "c", "_c", "useLexicalComposerContext", "ContentEditable", "useTranslation", "LexicalContentEditable", "t0", "$", "className", "editorConfig", "t", "t1", "getTheme", "t2", "admin", "placeholder", "theme", "_jsx", "children", "LexicalEditor", "props", "$", "_c", "editorConfig", "editorContainerRef", "isSmallWidthViewport", "onChange", "editorConfigContext", "useEditorConfigContext", "editor", "useLexicalComposerContext", "isEditable", "useLexicalEditable", "floatingAnchorElem", "setFloatingAnchorElem", "useState", "t0", "Symbol", "for", "_floatingAnchorElem", "onRef", "t1", "t2", "uuid", "console", "error", "parentEditor", "registerChild", "handleFocus", "focusEditor", "handleBlur", "blurEditor", "unregisterFocus", "registerCommand", "FOCUS_COMMAND", "COMMAND_PRIORITY_LOW", "unregisterBlur", "BLUR_COMMAND", "unregisterChild", "useEffect", "t3", "_jsxs", "Fragment", "children", "features", "plugins", "map", "_temp", "className", "ref", "_temp2", "_jsx", "RichTextPlugin", "contentEditable", "LexicalContentEditable", "NormalizeSelectionPlugin", "InsertParagraphAtEndPlugin", "DecoratorPlugin", "ClipboardPlugin", "TextPlugin", "SelectAllPlugin", "NodeViewOverridePlugin", "OnChangePlugin", "ignoreSelectionChange", "editorState", "editor_0", "tags", "has", "size", "admin", "hideDraggableBlockElement", "DraggableBlockPlugin", "anchorElem", "hideAddBlockButton", "AddBlockHandlePlugin", "plugin_1", "plugin", "position", "desktopOnly", "EditorPlugin", "clientProps", "key", "SlashMenuPlugin", "HistoryPlugin", "markdownTransformers", "length", "MarkdownShortcutPlugin", "_temp3", "_temp4", "_temp5", "plugin_0", "plugin_2", "plugin_3", "plugin_4", "NestProviders", "children", "providers", "length", "Component", "_jsx", "slice", "LexicalProvider", "props", "composerKey", "editorConfig", "fieldProps", "isSmallWidthViewport", "onChange", "readOnly", "value", "currentView", "views", "useRichTextView", "parentContext", "useEditorConfigContext", "editDepth", "useEditDepth", "editorContainerRef", "useRef", "initialConfig", "useMemo", "Error", "JSON", "stringify", "Array", "isArray", "nodeViews", "default", "editable", "editorState", "undefined", "namespace", "lexical", "nodes", "getEnabledNodes", "onError", "error", "theme", "LexicalComposer", "EditorConfigProvider", "features", "LexicalEditorComponent", "c", "_c", "ChevronIcon", "Popup", "PopupList", "ViewSelector", "$", "_c", "currentView", "setCurrentView", "views", "useRichTextView", "Object", "keys", "length", "t0", "t1", "Symbol", "for", "bb0", "viewKeys", "some", "_temp", "allViews", "filter", "_temp2", "currentViewLabel", "charAt", "toUpperCase", "slice", "_jsx", "className", "children", "Popup", "button", "_jsxs", "type", "ChevronIcon", "horizontalAlign", "render", "t2", "close", "PopupList", "ButtonGroup", "map", "viewName", "viewLabel", "Button", "active", "disabled", "onClick", "key_0", "key", "baseClass", "RichTextComponent", "props", "editorConfig", "field", "admin", "className", "description", "readOnly", "readOnlyFromAdmin", "label", "localized", "required", "path", "pathFromProps", "readOnlyFromTopLevelProps", "validate", "readOnlyFromProps", "editDepth", "useEditDepth", "memoizedValidate", "useCallback", "value", "validationOptions", "customComponents", "AfterInput", "BeforeInput", "Description", "Error", "Label", "disabled", "disabledFromField", "initialValue", "setValue", "showError", "useField", "potentiallyStalePath", "isSmallWidthViewport", "setIsSmallWidthViewport", "useState", "rerenderProviderKey", "setRerenderProviderKey", "prevInitialValueRef", "React", "useRef", "prevValueRef", "useEffect", "updateViewPortWidth", "isNextSmallWidthViewport", "window", "matchMedia", "matches", "addEventListener", "removeEventListener", "classes", "hideGutter", "filter", "Boolean", "join", "pathWithEditDepth", "runDeprioritized", "useRunDeprioritized", "currentView", "setCurrentView", "handleChange", "editorState", "updateFieldValue", "newState", "toJSON", "current", "styles", "useMemo", "mergeFieldStyles", "handleInitialValueChange", "useEffectEvent", "dequal", "JSON", "parse", "stringify", "Date", "Object", "is", "_jsx", "RichTextViewProvider", "views", "_jsxs", "style", "RenderCustomComponent", "CustomComponent", "Fallback", "FieldError", "FieldLabel", "ViewSelector", "ErrorBoundary", "fallbackRender", "onReset", "LexicalProvider", "composerKey", "fieldProps", "onChange", "FieldDescription", "error", "role", "color", "message", "RichText"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use client";import{a as h}from"./chunk-DBWINSQN.js";import{a as f}from"./chunk-F26IQ5RE.js";import{jsx as o,jsxs as c}from"react/jsx-runtime";import{useLexicalComposerContext as S}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as j}from"@lexical/react/useLexicalEditable";import{getTranslation as B}from"@payloadcms/translations";import{Button as b,useConfig as L,usePayloadAPI as A,useTranslation as I}from"@payloadcms/ui";import{$getNodeByKey as P}from"lexical";import k,{useCallback as H,useReducer as K,useRef as M,useState as O}from"react";var _={depth:0},X=g=>{let{className:e,data:{relationTo:R,value:s},nodeKey:a}=g;if(typeof s=="object")throw new Error("Relationship value should be a string or number. The Lexical Relationship component should not receive the populated value object.");let v=M(null),[l]=S(),i=j(),{config:{routes:{api:C},serverURL:N},getEntityConfig:$}=L(),[t]=O(()=>$({collectionSlug:R})),{i18n:w,t:n}=I(),[u,x]=K(r=>r+1,0),[{data:m},{setParams:d}]=A(`${N}${C}/${t.slug}/${s}`,{initialParams:_}),{closeDocumentDrawer:p,DocumentDrawer:D,DocumentDrawerToggler:E}=f({id:s,collectionSlug:t.slug}),T=H(()=>{l.update(()=>{P(a)?.remove()})},[l,a]),y=k.useCallback(()=>{d({..._,cacheBust:u}),p(),x()},[u,d,p]);return c("div",{className:`${e}__contents`,contentEditable:!1,ref:v,children:[c("div",{className:`${e}__wrap`,children:[o("p",{className:`${e}__label`,children:n("fields:labelRelationship",{label:t.labels?.singular?B(t.labels?.singular,w):t.slug})}),o(E,{className:`${e}__doc-drawer-toggler`,children:o("p",{className:`${e}__title`,children:m?m[t?.admin?.useAsTitle||"id"]:s})})]}),i&&c("div",{className:`${e}__actions`,children:[o(b,{buttonStyle:"icon-label",className:`${e}__swapButton`,disabled:!i,el:"button",icon:"swap",onClick:()=>{a&&l.dispatchCommand(h,{replace:{nodeKey:a}})},round:!0,tooltip:n("fields:swapRelationship")}),o(b,{buttonStyle:"icon-label",className:`${e}__removeButton`,disabled:!i,icon:"x",onClick:r=>{r.preventDefault(),T()},round:!0,tooltip:n("fields:removeRelationship")})]}),!!s&&o(D,{onSave:y})]})};export{X as RelationshipComponent};
2
+ //# sourceMappingURL=RelationshipComponent-UCIWIEVD.js.map