@payloadcms/richtext-lexical 4.0.0-beta.2 → 4.0.0-beta.4

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 (159) hide show
  1. package/dist/exports/client/Field-334JNLRF.js +2 -0
  2. package/dist/exports/client/Field-334JNLRF.js.map +7 -0
  3. package/dist/exports/client/{RelationshipComponent-YCPAKOL7.js → RelationshipComponent-TVK6I4W4.js} +2 -2
  4. package/dist/exports/client/chunk-BEKGION5.js +2 -0
  5. package/dist/exports/client/chunk-BEKGION5.js.map +7 -0
  6. package/dist/exports/client/{chunk-WSAPGI3Z.js → chunk-EA5BHQ2T.js} +1 -1
  7. package/dist/exports/client/{chunk-WSAPGI3Z.js.map → chunk-EA5BHQ2T.js.map} +1 -1
  8. package/dist/exports/client/chunk-FAJJXXCW.js +2 -0
  9. package/dist/exports/client/{chunk-3LRZDIIG.js.map → chunk-FAJJXXCW.js.map} +2 -2
  10. package/dist/exports/client/{chunk-5VIL27GI.js → chunk-IYBYNEKX.js} +1 -1
  11. package/dist/exports/client/{chunk-5VIL27GI.js.map → chunk-IYBYNEKX.js.map} +1 -1
  12. package/dist/exports/client/chunk-SE5IITBK.js +2 -0
  13. package/dist/exports/client/chunk-SE5IITBK.js.map +7 -0
  14. package/dist/exports/client/{component-6DQLENIE.js → component-QENB4QTS.js} +2 -2
  15. package/dist/exports/client/componentInline-AU7IBNY7.js +2 -0
  16. package/dist/exports/client/index.js +27 -27
  17. package/dist/exports/client/index.js.map +3 -3
  18. package/dist/features/align/client/index.js.map +1 -1
  19. package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
  20. package/dist/features/blocks/client/component/components/BlockCollapsible.js.map +1 -1
  21. package/dist/features/blocks/client/component/components/BlockEditButton.js.map +1 -1
  22. package/dist/features/blocks/client/component/components/BlockRemoveButton.js.map +1 -1
  23. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  24. package/dist/features/blocks/client/component/index.js +38 -16
  25. package/dist/features/blocks/client/component/index.js.map +1 -1
  26. package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.js.map +1 -1
  27. package/dist/features/blocks/client/componentInline/components/InlineBlockEditButton.js.map +1 -1
  28. package/dist/features/blocks/client/componentInline/components/InlineBlockLabel.js.map +1 -1
  29. package/dist/features/blocks/client/componentInline/components/InlineBlockRemoveButton.js.map +1 -1
  30. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  31. package/dist/features/blocks/client/componentInline/index.js +5 -11
  32. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  33. package/dist/features/blocks/client/getCachedFormStateIfDataMatches.js.map +1 -1
  34. package/dist/features/blocks/client/plugin/index.js.map +1 -1
  35. package/dist/features/blocks/premade/CodeBlock/Component/Block.js +121 -78
  36. package/dist/features/blocks/premade/CodeBlock/Component/Block.js.map +1 -1
  37. package/dist/features/blocks/premade/CodeBlock/Component/Code.js +142 -87
  38. package/dist/features/blocks/premade/CodeBlock/Component/Code.js.map +1 -1
  39. package/dist/features/converters/lexicalToHtml/sync/types.d.ts.map +1 -1
  40. package/dist/features/converters/lexicalToHtml/sync/types.js.map +1 -1
  41. package/dist/features/debug/jsxConverter/client/plugin/index.js.map +1 -1
  42. package/dist/features/debug/testRecorder/client/plugin/index.js.map +1 -1
  43. package/dist/features/debug/treeView/client/plugin/index.js.map +1 -1
  44. package/dist/features/heading/client/index.js.map +1 -1
  45. package/dist/features/horizontalRule/client/plugin/index.js.map +1 -1
  46. package/dist/features/indent/client/index.d.ts.map +1 -1
  47. package/dist/features/indent/client/index.js +0 -2
  48. package/dist/features/indent/client/index.js.map +1 -1
  49. package/dist/features/indent/server/i18n.d.ts.map +1 -1
  50. package/dist/features/indent/server/i18n.js.map +1 -1
  51. package/dist/features/link/client/plugins/autoLink/index.js.map +1 -1
  52. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
  53. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +10 -2
  54. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  55. package/dist/features/link/client/plugins/link/index.js.map +1 -1
  56. package/dist/features/link/markdownTransformer.js +2 -2
  57. package/dist/features/link/markdownTransformer.js.map +1 -1
  58. package/dist/features/link/server/baseFields.js.map +1 -1
  59. package/dist/features/lists/shared/schema.d.ts.map +1 -1
  60. package/dist/features/lists/shared/schema.js.map +1 -1
  61. package/dist/features/relationship/client/drawer/index.js.map +1 -1
  62. package/dist/features/relationship/client/plugins/index.js.map +1 -1
  63. package/dist/features/relationship/client/utils/useEnabledRelationships.js.map +1 -1
  64. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.css +1 -1
  65. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.js.map +1 -1
  66. package/dist/features/table/client/plugins/TableCellResizerPlugin/index.js +6 -6
  67. package/dist/features/table/client/plugins/TableCellResizerPlugin/index.js.map +1 -1
  68. package/dist/features/table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -1
  69. package/dist/features/table/client/plugins/TablePlugin/index.js +54 -18
  70. package/dist/features/table/client/plugins/TablePlugin/index.js.map +1 -1
  71. package/dist/features/table/client/utils/useDebounce.js.map +1 -1
  72. package/dist/features/textState/defaultColors.js +1 -1
  73. package/dist/features/textState/defaultColors.js.map +1 -1
  74. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.js.map +1 -1
  75. package/dist/features/toolbars/fixed/client/Toolbar/index.js +126 -70
  76. package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
  77. package/dist/features/toolbars/inline/client/Toolbar/index.js +67 -35
  78. package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
  79. package/dist/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -1
  80. package/dist/features/toolbars/shared/ToolbarButton/index.js +26 -2
  81. package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
  82. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +137 -72
  83. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
  84. package/dist/features/toolbars/shared/ToolbarDropdown/index.d.ts.map +1 -1
  85. package/dist/features/toolbars/shared/ToolbarDropdown/index.js +22 -6
  86. package/dist/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
  87. package/dist/features/toolbars/shared/useToolbarKeyboardNavigation.js +100 -70
  88. package/dist/features/toolbars/shared/useToolbarKeyboardNavigation.js.map +1 -1
  89. package/dist/features/upload/client/drawer/index.js.map +1 -1
  90. package/dist/features/upload/client/plugin/index.js.map +1 -1
  91. package/dist/field/RenderLexical/index.js.map +1 -1
  92. package/dist/field/ViewSelector.js +12 -4
  93. package/dist/field/ViewSelector.js.map +1 -1
  94. package/dist/field/bundled.css +1 -1
  95. package/dist/field/index.js.map +1 -1
  96. package/dist/i18n.d.ts.map +1 -1
  97. package/dist/i18n.js +44 -0
  98. package/dist/i18n.js.map +1 -1
  99. package/dist/lexical/LexicalEditor.js.map +1 -1
  100. package/dist/lexical/plugins/ClipboardPlugin/index.js.map +1 -1
  101. package/dist/lexical/plugins/DecoratorPlugin/index.js.map +1 -1
  102. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js.map +1 -1
  103. package/dist/lexical/plugins/MarkdownShortcut/index.js.map +1 -1
  104. package/dist/lexical/plugins/NodeViewOverridePlugin/index.js.map +1 -1
  105. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +234 -87
  106. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
  107. package/dist/lexical/plugins/SlashMenu/useMenuTriggerMatch.js.map +1 -1
  108. package/dist/lexical/plugins/TextPlugin/index.js.map +1 -1
  109. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
  110. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.css +16 -0
  111. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.d.ts.map +1 -1
  112. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +126 -38
  113. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  114. package/dist/lexical/plugins/handles/DraggableBlockPlugin/moveBlock.d.ts +7 -0
  115. package/dist/lexical/plugins/handles/DraggableBlockPlugin/moveBlock.d.ts.map +1 -0
  116. package/dist/lexical/plugins/handles/DraggableBlockPlugin/moveBlock.js +15 -0
  117. package/dist/lexical/plugins/handles/DraggableBlockPlugin/moveBlock.js.map +1 -0
  118. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.d.ts.map +1 -1
  119. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.js +9 -12
  120. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.js.map +1 -1
  121. package/dist/lexical/ui/ContentEditable.js.map +1 -1
  122. package/dist/lexical/utils/nodeFormat.d.ts.map +1 -1
  123. package/dist/lexical/utils/nodeFormat.js +0 -2
  124. package/dist/lexical/utils/nodeFormat.js.map +1 -1
  125. package/dist/lexical/utils/url.d.ts.map +1 -1
  126. package/dist/lexical/utils/url.js +1 -1
  127. package/dist/lexical/utils/url.js.map +1 -1
  128. package/dist/populateGraphQL/populate.js.map +1 -1
  129. package/dist/types/index.d.ts.map +1 -1
  130. package/dist/types/index.js.map +1 -1
  131. package/dist/utilities/buildEditorState.d.ts.map +1 -1
  132. package/dist/utilities/buildEditorState.js.map +1 -1
  133. package/dist/utilities/fieldsDrawer/Drawer.js +36 -36
  134. package/dist/utilities/fieldsDrawer/Drawer.js.map +1 -1
  135. package/dist/utilities/fieldsDrawer/DrawerContent.d.ts.map +1 -1
  136. package/dist/utilities/fieldsDrawer/DrawerContent.js +6 -9
  137. package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
  138. package/dist/utilities/fieldsDrawer/useDrawerSubmit.js.map +1 -1
  139. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.js.map +1 -1
  140. package/dist/utilities/fieldsDrawer/useLexicalDrawer.js.map +1 -1
  141. package/dist/utilities/fieldsDrawer/useLexicalListDrawer.js.map +1 -1
  142. package/dist/utilities/initLexicalFeatures.d.ts.map +1 -1
  143. package/dist/utilities/initLexicalFeatures.js +38 -4
  144. package/dist/utilities/initLexicalFeatures.js.map +1 -1
  145. package/dist/utilities/useLexicalFeature.js +15 -6
  146. package/dist/utilities/useLexicalFeature.js.map +1 -1
  147. package/dist/utilities/useRunDeprioritized.js.map +1 -1
  148. package/package.json +32 -35
  149. package/dist/exports/client/Field-W2ABOM7M.js +0 -2
  150. package/dist/exports/client/Field-W2ABOM7M.js.map +0 -7
  151. package/dist/exports/client/chunk-3LRZDIIG.js +0 -2
  152. package/dist/exports/client/chunk-E6LSRRP2.js +0 -2
  153. package/dist/exports/client/chunk-E6LSRRP2.js.map +0 -7
  154. package/dist/exports/client/chunk-ZQX5HXUL.js +0 -2
  155. package/dist/exports/client/chunk-ZQX5HXUL.js.map +0 -7
  156. package/dist/exports/client/componentInline-HNE5G4TE.js +0 -2
  157. /package/dist/exports/client/{RelationshipComponent-YCPAKOL7.js.map → RelationshipComponent-TVK6I4W4.js.map} +0 -0
  158. /package/dist/exports/client/{component-6DQLENIE.js.map → component-QENB4QTS.js.map} +0 -0
  159. /package/dist/exports/client/{componentInline-HNE5G4TE.js.map → componentInline-AU7IBNY7.js.map} +0 -0
package/package.json CHANGED
@@ -1,13 +1,8 @@
1
1
  {
2
2
  "name": "@payloadcms/richtext-lexical",
3
- "version": "4.0.0-beta.2",
3
+ "version": "4.0.0-beta.4",
4
4
  "description": "The officially supported Lexical richtext adapter for Payload",
5
5
  "homepage": "https://payloadcms.com",
6
- "repository": {
7
- "type": "git",
8
- "url": "https://github.com/payloadcms/payload.git",
9
- "directory": "packages/richtext-lexical"
10
- },
11
6
  "license": "MIT",
12
7
  "author": "Payload <dev@payloadcms.com> (https://payloadcms.com)",
13
8
  "maintainers": [
@@ -17,10 +12,20 @@
17
12
  "url": "https://payloadcms.com"
18
13
  }
19
14
  ],
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/payloadcms/payload.git",
18
+ "directory": "packages/richtext-lexical"
19
+ },
20
+ "files": [
21
+ "dist"
22
+ ],
23
+ "type": "module",
20
24
  "sideEffects": [
21
25
  "*.css"
22
26
  ],
23
- "type": "module",
27
+ "main": "./dist/index.js",
28
+ "types": "./dist/index.d.ts",
24
29
  "exports": {
25
30
  ".": {
26
31
  "import": "./dist/index.js",
@@ -403,18 +408,8 @@
403
408
  "default": "./dist/exports/shared.js"
404
409
  }
405
410
  },
406
- "main": "./dist/index.js",
407
- "types": "./dist/index.d.ts",
408
- "files": [
409
- "dist"
410
- ],
411
- "lint-staged": {
412
- "**/package.json": "sort-package-json",
413
- "*.{md,mdx,yml,json}": "prettier --write",
414
- "*.{js,jsx,ts,tsx}": [
415
- "eslint --flag v10_config_lookup_from_file --cache --fix",
416
- "prettier --write"
417
- ]
411
+ "publishConfig": {
412
+ "registry": "https://registry.npmjs.org/"
418
413
  },
419
414
  "dependencies": {
420
415
  "@lexical/clipboard": "0.52.0",
@@ -429,6 +424,8 @@
429
424
  "@lexical/selection": "0.52.0",
430
425
  "@lexical/table": "0.52.0",
431
426
  "@lexical/utils": "0.52.0",
427
+ "@payloadcms/translations": "4.0.0-beta.4",
428
+ "@payloadcms/ui": "4.0.0-beta.4",
432
429
  "acorn": "8.16.0",
433
430
  "bson-objectid": "2.0.4",
434
431
  "csstype": "3.2.3",
@@ -442,9 +439,7 @@
442
439
  "qs-esm": "8.0.1",
443
440
  "react-error-boundary": "6.1.1",
444
441
  "ts-essentials": "10.0.3",
445
- "uuid": "14.0.0",
446
- "@payloadcms/translations": "4.0.0-beta.2",
447
- "@payloadcms/ui": "4.0.0-beta.2"
442
+ "uuid": "14.0.0"
448
443
  },
449
444
  "devDependencies": {
450
445
  "@babel/cli": "7.27.2",
@@ -458,26 +453,30 @@
458
453
  "@types/node": "24.12.3",
459
454
  "@types/react": "19.3.0",
460
455
  "@types/react-dom": "19.3.0",
461
- "babel-plugin-react-compiler": "19.1.0-rc.3",
456
+ "babel-plugin-react-compiler": "1.0.0",
462
457
  "babel-plugin-transform-remove-imports": "^1.8.0",
463
458
  "esbuild": "0.27.1",
464
459
  "esbuild-sass-plugin": "3.3.1",
465
- "swc-plugin-transform-remove-imports": "8.3.0",
466
- "payload": "4.0.0-beta.2",
467
- "@payloadcms/eslint-config": "3.28.0"
460
+ "payload": "4.0.0-beta.4",
461
+ "swc-plugin-transform-remove-imports": "8.3.0"
468
462
  },
469
463
  "peerDependencies": {
470
464
  "@faceless-ui/modal": "3.0.2",
471
465
  "@faceless-ui/scroll-info": "2.0.0",
466
+ "payload": "4.0.0-beta.4",
472
467
  "react": "^19.0.1 || ^19.1.2 || ^19.2.1",
473
- "react-dom": "^19.0.1 || ^19.1.2 || ^19.2.1",
474
- "payload": "4.0.0-beta.2"
468
+ "react-dom": "^19.0.1 || ^19.1.2 || ^19.2.1"
475
469
  },
476
- "engines": {
477
- "node": ">=24.15.0"
470
+ "lint-staged": {
471
+ "*.{cjs,css,cts,graphql,html,json,jsonc,md,mdx,mjs,mts,scss,toml,yaml,yml}": "oxfmt --no-error-on-unmatched-pattern",
472
+ ".swcrc": "oxfmt --no-error-on-unmatched-pattern",
473
+ "*.{js,jsx,ts,tsx}": [
474
+ "oxlint -c ../../oxlint.config.ts --fix --no-error-on-unmatched-pattern",
475
+ "oxfmt --no-error-on-unmatched-pattern"
476
+ ]
478
477
  },
479
- "publishConfig": {
480
- "registry": "https://registry.npmjs.org/"
478
+ "engines": {
479
+ "node": ">=24.22.1"
481
480
  },
482
481
  "scripts": {
483
482
  "build": "pnpm build:reactcompiler",
@@ -494,8 +493,6 @@
494
493
  "build:without_reactcompiler": "rm -rf dist && rm -rf tsconfig.tsbuildinfo && pnpm copyfiles && pnpm build:types && pnpm build:swc && pnpm build:esbuild && pnpm build:esbuild:postproces && rm -rf dist/exports/client && mv dist/exports/client_unoptimized dist/exports/client",
495
494
  "clean": "rimraf -g {dist,*.tsbuildinfo,esbuild}",
496
495
  "copyfiles": "copyfiles -u 1 -e \"**/*.spec.*\" \"src/**/*.{html,css,ttf,woff,woff2,eot,svg,jpg,png,json}\" dist/",
497
- "copyfiles:debug": "copyfiles -u 1 -e \"**/*.spec.*\" \"src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png,json}\" dist/",
498
- "lint": "eslint .",
499
- "lint:fix": "eslint . --fix"
496
+ "copyfiles:debug": "copyfiles -u 1 -e \"**/*.spec.*\" \"src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png,json}\" dist/"
500
497
  }
501
498
  }
@@ -1,2 +0,0 @@
1
- "use client";import{b as Ie,c as $e,e as K,f as j,h as Fe,i as Ke,j as je,k as ze,l as Pe,m as Re,n as He}from"./chunk-3LRZDIIG.js";import{a as Be,b as R}from"./chunk-RJ5MAOKZ.js";import{jsx as v,jsxs as ce}from"react/jsx-runtime";import{getTranslation as xn}from"@payloadcms/translations";import{BulkUploadProvider as Cn,FieldDescription as En,FieldError as Nn,FieldLabel as Sn,isFieldRTL as wn,RenderCustomComponent as jt,useConfig as Pn,useEditDepth as Rn,useEffectEvent as Tn,useField as _n,useLocale as Dn,useTranslation as kn}from"@payloadcms/ui";import{mergeFieldStyles as vn}from"@payloadcms/ui/shared";import{dequal as Ln}from"dequal/lite";import zt,{useCallback as Ht,useEffect as Vt,useMemo as An,useState as Wt}from"react";import{ErrorBoundary as Mn}from"react-error-boundary";import"../../field/bundled.css";import{jsx as H}from"react/jsx-runtime";import{LexicalComposer as dn}from"@lexical/react/LexicalComposer.js";import{useEditDepth as un}from"@payloadcms/ui";import*as Bt from"react";import{useMemo as fn}from"react";import{c as Yr}from"react/compiler-runtime";import{jsx as E,jsxs as ae}from"react/jsx-runtime";import{useLexicalComposerContext as Gr}from"@lexical/react/LexicalComposerContext.js";import{LexicalErrorBoundary as Ur}from"@lexical/react/LexicalErrorBoundary.js";import{HistoryPlugin as qr}from"@lexical/react/LexicalHistoryPlugin.js";import{OnChangePlugin as Jr}from"@lexical/react/LexicalOnChangePlugin.js";import{RichTextPlugin as Qr}from"@lexical/react/LexicalRichTextPlugin.js";import{useLexicalEditable as Xr}from"@lexical/react/useLexicalEditable";import{useTranslation as Zr}from"@payloadcms/ui";import{BLUR_COMMAND as en,COMMAND_PRIORITY_LOW as Mt,FOCUS_COMMAND as tn}from"lexical";import*as z from"react";import{useEffect as on,useState as rn}from"react";import{jsx as Ve}from"react/jsx-runtime";import"react";var W=({anchorElem:e,clientProps:t,plugin:o})=>o.position==="floatingAnchorElem"&&e?o.Component&&Ve(o.Component,{anchorElem:e,clientProps:t}):o.Component&&Ve(o.Component,{clientProps:t});import{c as Ut}from"react/compiler-runtime";import{copyToClipboard as We}from"@lexical/clipboard";import{useLexicalComposerContext as qt}from"@lexical/react/LexicalComposerContext.js";import{objectKlassEquals as Jt}from"@lexical/utils";import Ye from"bson-objectid";import{$getSelection as Qt,$isNodeSelection as Xt,COMMAND_PRIORITY_LOW as Zt,COPY_COMMAND as eo}from"lexical";import{useEffect as to}from"react";var Te=e=>{if("fields"in e&&typeof e.fields=="object"&&e.fields!==null&&"id"in e.fields?e.fields.id=new Ye.default().toHexString():"id"in e&&(e.id=new Ye.default().toHexString()),e.children)for(let t of e.children)Te(t)};function Ge(){let e=Ut(3),[t]=qt(),o,r;return e[0]!==t?(o=()=>t.registerCommand(eo,n=>{let i=Qt();if(Xt(i)){let l=i.getNodes()[0]?.exportJSON(),d=JSON.parse(JSON.stringify(l));Te(d);let u={namespace:t._config.namespace,nodes:[d]},m=JSON.stringify(u);return We(t,null,{"application/x-lexical-editor":m,"text/plain":""}).catch(oo),!0}return We(t,Jt(n,ClipboardEvent)?n:null).then(()=>{if(!(n instanceof ClipboardEvent)||!n.clipboardData)throw new Error("No clipboard event");let s=n.clipboardData.getData("application/x-lexical-editor");if(!s)return!0;let l=JSON.parse(s);for(let u of l.nodes)Te(u);let d=JSON.stringify(l);n.clipboardData.setData("application/x-lexical-editor",d)}).catch(s=>{throw n instanceof ClipboardEvent&&n.clipboardData?.setData("application/x-lexical-editor",""),s}),!0},Zt),r=[t],e[0]=t,e[1]=o,e[2]=r):(o=e[1],r=e[2]),to(o,r),null}function oo(e){throw e}import{c as ro}from"react/compiler-runtime";import{useLexicalComposerContext as no}from"@lexical/react/LexicalComposerContext";import{$findMatchingParent as fe,mergeRegister as io}from"@lexical/utils";import{$createNodeSelection as so,$getEditor as me,$getNearestNodeFromDOMNode as lo,$getSelection as pe,$isDecoratorNode as Y,$isElementNode as _e,$isLineBreakNode as ao,$isNodeSelection as ge,$isRangeSelection as qe,$isRootOrShadowRoot as co,$isTextNode as uo,$onUpdate as fo,$setSelection as Je,CLICK_COMMAND as mo,COMMAND_PRIORITY_LOW as Q,KEY_ARROW_DOWN_COMMAND as po,KEY_ARROW_UP_COMMAND as go,KEY_BACKSPACE_COMMAND as ho,KEY_DELETE_COMMAND as yo,SELECTION_CHANGE_COMMAND as bo}from"lexical";import{useEffect as xo}from"react";function Qe(){let e=ro(3),[t]=no(),o=Po,r,n;return e[0]!==t?(r=()=>io(t.registerCommand(mo,wo,Q),t.registerCommand(yo,o,Q),t.registerCommand(ho,o,Q),t.registerCommand(bo,(i,s)=>{if(s!==t)return!1;let l=!!Ue();return fo(()=>{s.read("latest",()=>{let d=Ue();document.querySelector(".decorator-selected")?.classList.remove("decorator-selected"),d&&s.getElementByKey(d.getKey())?.classList.add("decorator-selected")})}),l},Q),t.registerCommand(go,No,Q),t.registerCommand(po,Co,Q)),n=[t],e[0]=t,e[1]=r,e[2]=n):(r=e[1],n=e[2]),xo(r,n),null}function Co(e){let t=pe();if(ge(t)){e.preventDefault();let s=t.getNodes()[0]?.getNextSibling();if(Y(s)){let u=me().getElementByKey(s.getKey());return u&&ie({element:u,node:s}),!0}if(!_e(s))return!0;let l=s.getFirstDescendant()??s;return l&&(fe(l,he)?.selectEnd(),e.preventDefault()),!0}if(!qe(t))return!1;let r=(t.isBackward()?t.anchor:t.focus).getNode(),n=fe(r,Eo),i=n?.getNextSibling();if(!n||i!==Xe(n))return!1;if(Y(i)){let s=me().getElementByKey(i.getKey());if(s)return ie({element:s,node:i}),e.preventDefault(),!0}return!1}function Eo(e){return Xe(e)!==null}function No(e){let t=pe();if(ge(t)){let s=t.getNodes()[0]?.getPreviousSibling();if(Y(s)){let u=me().getElementByKey(s.getKey());return u?(ie({element:u,node:s}),e.preventDefault(),!0):!1}if(!_e(s))return!1;let l=s.getLastDescendant()??s;return l?(fe(l,he)?.selectStart(),e.preventDefault(),!0):!1}if(!qe(t))return!1;let r=(t.isBackward()?t.anchor:t.focus).getNode(),n=fe(r,So),i=n?.getPreviousSibling();if(!n||i!==Ze(n))return!1;if(Y(i)){let s=me().getElementByKey(i.getKey());if(s)return ie({element:s,node:i}),e.preventDefault(),!0}return!1}function So(e){return Ze(e)!==null}function wo(e){document.querySelector(".decorator-selected")?.classList.remove("decorator-selected");let t=To(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"]')?Je(null):ie(t),!0}function Po(e){let t=pe();return ge(t)?(e.preventDefault(),t.getNodes().forEach(Ro),!0):!1}function Ro(e){e.remove()}function To(e){if(!(e.target instanceof HTMLElement))return;let t=e.target.closest('[data-lexical-decorator="true"]');if(!(t instanceof HTMLElement))return;let o=lo(t);return Y(o)?{element:t,node:o}:void 0}function Ue(){let e=pe();if(!ge(e))return;let t=e.getNodes();if(t.length!==1)return;let o=t[0];return Y(o)?o:void 0}function ie({element:e,node:t}){document.querySelector(".decorator-selected")?.classList.remove("decorator-selected");let o=so();o.add(t.getKey()),Je(o),e.scrollIntoView({behavior:"smooth",block:"nearest"}),e.classList.add("decorator-selected")}function he(e){if(Y(e)&&!e.isInline())return!0;if(!_e(e)||co(e))return!1;let t=e.getFirstChild(),o=t===null||ao(t)||uo(t)||t.isInline();return!e.isInline()&&e.canBeEmpty()!==!1&&o}function Xe(e){let t=e.getNextSibling();for(;t!==null;){if(he(t))return t;t=t.getNextSibling()}return null}function Ze(e){let t=e.getPreviousSibling();for(;t!==null;){if(he(t))return t;t=t.getPreviousSibling()}return null}import{jsx as De}from"react/jsx-runtime";import{useLexicalComposerContext as Ao}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as Mo,isHTMLElement as Oo}from"lexical";import*as rt from"react";import{useCallback as Bo,useEffect as ot,useRef as Io,useState as $o}from"react";import{createPortal as Fo}from"react-dom";var X=(e,t,o,r,n=50,i=25)=>{let s=0;if(e&&!e.contains(r)){let{bottom:l,left:d,right:u,top:m}=e.getBoundingClientRect(),a=m+window.scrollY,c=l+window.scrollY;if(o<a-i||o>c+i||t<d-n||t>u+n)return-1;(t<d||t>u)&&(s=t<d?t-d:t-u)}return s};import{$getNodeByKey as be}from"lexical";function Z(e){let t=e.getBoundingClientRect(),o=getComputedStyle(e).getPropertyValue("transform");if(!o||o==="none")return t;let r=o.split(",").pop();return t.y=t.y-Number(r?.replace(")","")),t}function ye(e){let t=(d,u)=>d?parseFloat(window.getComputedStyle(d)[u]):0,{marginBottom:o,marginTop:r}=window.getComputedStyle(e),n=t(e.previousElementSibling,"marginBottom"),i=t(e.nextElementSibling,"marginTop"),s=Math.max(parseFloat(r),n);return{marginBottom:Math.max(parseFloat(o),i),marginTop:s}}import{$getRoot as _o}from"lexical";function G(e){return e.getEditorState().read(()=>_o().getChildrenKeys())}var Do=1,ko=-1,et=0,M={props:null,result:null};function vo(e,t,o=20){let r=e.x-t.x,n=e.y-t.y;return r*r+n*n<=o*o}function ee(e){let{anchorElem:t,cache_threshold:o=20,editor:r,fuzzy:n=!1,horizontalOffset:i=0,point:{x:s,y:l},startIndex:d=0,useEdgeAsDefault:u=!1}=e;if(o>0&&M.props&&M.result&&M.props.fuzzy===e.fuzzy&&M.props.horizontalOffset===e.horizontalOffset&&M.props.useEdgeAsDefault===e.useEdgeAsDefault&&vo(M.props.point,e.point,o))return M.result;let m=t.getBoundingClientRect(),a=G(r),c={blockElem:null,blockNode:null,distance:1/0,foundAtIndex:-1,isFoundNodeEmptyParagraph:!1};return r.getEditorState().read(()=>{if(u){let f=r.getElementByKey(a[0]),p=r.getElementByKey(a[a.length-1]);if(f&&p){let[h,C]=[Z(f),Z(p)];if(l<h.top?(c.blockElem=f,c.distance=h.top-l,c.blockNode=be(a[0]),c.foundAtIndex=0):l>C.bottom&&(c.distance=l-C.bottom,c.blockNode=be(a[a.length-1]),c.blockElem=p,c.foundAtIndex=a.length-1),c?.blockElem)return{blockElem:null,isFoundNodeEmptyParagraph:!1}}}let g=d,y=et;for(;g>=0&&g<a.length;){let f=a[g],p=r.getElementByKey(f);if(p===null)break;let h=new j(s+i,l),C=ze.fromDOMRect(Z(p)),{marginBottom:x,marginTop:N}=ye(p),b=C.generateNewRect({bottom:C.bottom+x,left:m.left,right:m.right,top:C.top-N}),{distance:S,isOnBottomSide:D,isOnTopSide:_}=b.distanceFromPoint(h);if(S===0){c.blockElem=p,c.blockNode=be(f),c.foundAtIndex=g,c.distance=S,c.blockNode&&c.blockNode.getType()==="paragraph"&&c.blockNode.getTextContent()===""&&(!n&&!e.returnEmptyParagraphs&&(c.blockElem=null,c.blockNode=null),c.isFoundNodeEmptyParagraph=!0);break}else n&&S<c.distance&&(c.blockElem=p,c.blockNode=be(f),c.distance=S,c.foundAtIndex=g);y===et&&(_?y=ko:D?y=Do:y=1/0),g+=y}}),M.props=e,M.result={blockElem:c.blockElem,blockNode:c.blockNode,foundAtIndex:c.foundAtIndex,isFoundNodeEmptyParagraph:c.isFoundNodeEmptyParagraph},{blockElem:c.blockElem,blockNode:c.blockNode,foundAtIndex:c.foundAtIndex,isFoundNodeEmptyParagraph:c.isFoundNodeEmptyParagraph}}function xe(e,t){return!!e.closest(`.${t}`)}var Lo=["IMG","INPUT","TEXTAREA","SELECT","BUTTON","VIDEO","OBJECT","EMBED","IFRAME","HR"];function tt(e){if(!e||Lo.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 Ce(e,t,o,r=0){if(!e){t.style.visibility="hidden",t.style.opacity="0",t.style.transform="translate(-10000px, -10000px)";return}let n=e.getBoundingClientRect(),i=window.getComputedStyle(e),s=t.getBoundingClientRect(),l=o.getBoundingClientRect(),d;if(["LexicalEditorTheme__block","LexicalEditorTheme__upload","LexicalEditorTheme__relationship"].some(a=>e.classList.contains(a)||e.firstElementChild?.classList.contains(a)))d=n.top+8-l.top;else{let a=tt(e)?parseInt(i.lineHeight,10):0;d=n.top+(a-s.height)/2-l.top}let m=r;t.style.opacity="1",t.style.visibility="visible",t.style.transform=`translate(${m}px, ${d}px)`}var Ko="add-block-menu",Ee=1/0;function jo(e){return e===0?1/0:Ee>=0&&Ee<e?Ee:Math.floor(e/2)}function zo(e,t,o){let r=t.parentElement,{editorConfig:n}=R(),i=n?.admin?.hideGutter?-24:12,s=Io(null),[l,d]=$o(null);ot(()=>{function m(a){let c=a.target;if(!Oo(c))return;let g=X(r,a.pageX,a.pageY,c);if(g===-1){d(null);return}if(xe(c,Ko))return;let y=G(e),{blockElem:f,blockNode:p,foundAtIndex:h}=ee({anchorElem:t,cache_threshold:0,editor:e,horizontalOffset:-g,point:new j(a.x,a.y),returnEmptyParagraphs:!0,startIndex:jo(y.length),useEdgeAsDefault:!1});Ee=h,f&&p&&(l?.node!==p||l?.elem!==f)&&d({elem:f,node:p})}return document?.addEventListener("mousemove",m),()=>{document?.removeEventListener("mousemove",m)}},[r,t,e,l]),ot(()=>{s.current&&Ce(l?.elem??null,s.current,t,i)},[t,l,i]);let u=Bo(m=>{let a=l;a?.node&&(e.update(()=>{let c=!0;if((a?.node.getType()!=="paragraph"||a.node.getTextContent()!=="")&&(c=!1),!c){let g=Mo();a?.node.insertAfter(g),setTimeout(()=>{a={elem:e.getElementByKey(g.getKey()),node:g},d(a)},0)}}),setTimeout(()=>{e.update(()=>{e.focus(),a?.node&&"select"in a.node&&typeof a.node.select=="function"&&a.node.select()})},1),setTimeout(()=>{e.dispatchCommand(Ke,{node:a?.node})},2),m.stopPropagation(),m.preventDefault())},[e,l]);return Fo(De(rt.Fragment,{children:De("button",{"aria-label":"Add block",className:"icon add-block-menu",onClick:m=>{u(m)},ref:s,type:"button",children:De("div",{className:o?"icon":""})})}),t)}function nt(e){let{anchorElem:t}=e,o=t===void 0?document.body:t,[r]=Ao();return zo(r,o,r._editable)}import{jsx as Ne,jsxs as dt}from"react/jsx-runtime";import{useLexicalComposerContext as Jo}from"@lexical/react/LexicalComposerContext.js";import{eventFiles as ut}from"@lexical/rich-text";import{useTranslation as Qo}from"@payloadcms/ui";import{$getNearestNodeFromDOMNode as ft,$getNodeByKey as Xo,isHTMLElement as ke}from"lexical";import*as yt from"react";import{useEffect as ve,useId as Zo,useRef as se,useState as mt}from"react";import{createPortal as er}from"react-dom";var it=0,Ho=-24;var U=0;function st(e,t,o,r,n,i,s,l,d,u=!1){let{height:m,top:a}=r.getBoundingClientRect(),{top:c,width:g}=s.getBoundingClientRect(),{marginBottom:y,marginTop:f}=ye(r),p=a,h=i>=a+m/2+window.scrollY,C=!1;if(n?.elem)if(r!==n?.elem)(h&&n?.elem&&n?.elem===r.nextElementSibling||!h&&n?.elem&&n?.elem===r.previousElementSibling)&&(U++,U<200&&(C=!0));else{U++;let S=n?.boundingBox?.y,D=r.getBoundingClientRect().y;(h===n?.isBelow&&S===D||U<200)&&(C=!1)}if(C)return{isBelow:h,willStayInSamePosition:C};u?p+=m/2:h?p+=m+y/2:p-=f/2;let x=0;u||(h?x=-it:x=it);let N=p-c+x,b=Ho-t;return o.style.width=`calc(${g}px - ${e} - var(--spacer-5))`,o.style.opacity=".8",o.style.transform=`translate(${b}px, calc(${N}px - 2px))`,n?.elem&&(n.elem.style.opacity="",n?.elem===r?h?n.elem.style.marginTop="":n.elem.style.marginBottom="":(n.elem.style.marginBottom="",n.elem.style.marginTop="")),U=0,{isBelow:h,willStayInSamePosition:C}}import{mergeRegister as Vo}from"@lexical/utils";import{$getSelection as Wo,$isNodeSelection as Yo,$isRangeSelection as Go,COMMAND_PRIORITY_HIGH as lt,KEY_ARROW_DOWN_COMMAND as Uo,KEY_ARROW_UP_COMMAND as qo}from"lexical";import{useEffect as at}from"react";function ct({editor:e,instructionsID:t}){at(()=>{let o=({direction:r,event:n})=>{if(!e.isEditable()||!n.altKey||!n.shiftKey||n.ctrlKey||n.metaKey)return!1;let i=Wo(),l=(Go(i)&&i.isCollapsed()?i.anchor.getNode():Yo(i)&&i.getNodes().length===1?i.getNodes()[0]:null)?.getTopLevelElement();if(!l)return!1;n.preventDefault();let d=r===-1?l.getPreviousSibling():l.getNextSibling();return d&&(r===-1?d.insertBefore(l):d.insertAfter(l)),!0};return Vo(e.registerCommand(qo,r=>o({direction:-1,event:r}),lt),e.registerCommand(Uo,r=>o({direction:1,event:r}),lt))},[e]),at(()=>{let o,r=e.registerRootListener(n=>{if(o?.(),!n)return;let i=n.getAttribute("aria-describedby");n.setAttribute("aria-describedby",[i,t].filter(Boolean).join(" ")),o=()=>{i===null?n.removeAttribute("aria-describedby"):n.setAttribute("aria-describedby",i)}});return()=>{r(),o?.()}},[e,t])}var tr="draggable-block-menu",pt="application/x-lexical-drag-block",le=1/0;function gt(e){return e===0?1/0:le>=0&&le<e?le:Math.floor(e/2)}function or(e,t){let{transform:o}=t.style;e.setDragImage(t,0,0),setTimeout(()=>{t.style.transform=o})}function ht(e,t){e&&(e.style.opacity="0"),t&&(t.style.opacity="",t.style.marginBottom="",t.style.marginTop="")}function rr(e,t,o){let r=t.parentElement,n=Zo(),{t:i}=Qo();ct({editor:e,instructionsID:n});let s=se(null),l=se(null),d=se(null),u=se(!1),m=se([]),[a,c]=mt(null),[g,y]=mt(null),{editorConfig:f}=R(),p=f?.admin?.hideGutter?-44:-8;ve(()=>{function x(N){let b=N.target;if(!ke(b))return;let S=X(r,N.pageX,N.pageY,b);if(S===-1){c(null);return}if(xe(b,tr))return;let D=G(e),{blockElem:_,foundAtIndex:B,isFoundNodeEmptyParagraph:V}=ee({anchorElem:t,cache_threshold:0,editor:e,horizontalOffset:-S,point:new j(N.x,N.y),startIndex:gt(D.length),useEdgeAsDefault:!1,verbose:!1});le=B,!(!_&&!V)&&a!==_&&c(_)}return document?.addEventListener("mousemove",x),()=>{document?.removeEventListener("mousemove",x)}},[r,t,e,a]),ve(()=>{s.current&&Ce(a,s.current,t,p)},[t,a,p]),ve(()=>{function x(b){if(!u.current)return!1;let[S]=ut(b);if(S)return!1;let{pageY:D,target:_}=b;if(!ke(_))return!1;let B=X(r,b.pageX,b.pageY,_,100,50),V=G(e),{blockElem:w,foundAtIndex:k,isFoundNodeEmptyParagraph:I}=ee({anchorElem:t,editor:e,fuzzy:!0,horizontalOffset:-B,point:new j(b.x,b.y),startIndex:gt(V.length),useEdgeAsDefault:!0,verbose:!0});le=k;let $=l.current;if(w===null||$===null)return!1;if(b.preventDefault(),b.dataTransfer.dropEffect="move",a!==w){let{isBelow:T,willStayInSamePosition:q}=st(f?.admin?.hideGutter?"0px":"var(--spacer-5)",p+(f?.admin?.hideGutter?s?.current?.getBoundingClientRect()?.width??0:-(s?.current?.getBoundingClientRect()?.width??0)),$,w,g,D,t,b,d,I);q||y({boundingBox:w.getBoundingClientRect(),elem:w,isBelow:T})}else g?.elem&&(ht($,g.elem),y({boundingBox:w.getBoundingClientRect(),elem:w,isBelow:!1}));return!0}function N(b){if(!u.current)return!1;let[S]=ut(b);if(S)return!1;let{dataTransfer:D,pageY:_,target:B}=b,V=D?.getData(pt)||"";return e.update(()=>{let w=Xo(V);if(!w||!ke(B))return!1;let k=X(r,b.pageX,b.pageY,B,100,50),{blockElem:I,isFoundNodeEmptyParagraph:$}=ee({anchorElem:t,editor:e,fuzzy:!0,horizontalOffset:-k,point:new j(b.x,b.y),useEdgeAsDefault:!0});if(!I)return!1;let T=ft(I);if(!T)return!1;if(T===w)return!0;let{height:q,top:J}=Z(I),Se=_>=J+q/2+window.scrollY;$?(T.insertBefore(w),T.remove()):Se?T.insertAfter(w):T.insertBefore(w),a!==null&&c(null),document.querySelectorAll(".lexical-block-highlighter").forEach(L=>{L.remove()});let de=e.getElementByKey(w.getKey()),F=setTimeout(()=>{let L=de?.getBoundingClientRect();if(!L)return;let P=document.createElement("div");P.className="lexical-block-highlighter",P.style.backgroundColor="var(--color-bg-inverse)",P.style.transition="opacity 0.5s ease-in-out",P.style.zIndex="1",P.style.pointerEvents="none",P.style.boxSizing="border-box",P.style.borderRadius="4px",P.style.position="absolute",document.body.appendChild(P),P.style.opacity="0.1",P.style.height=`${L.height+8}px`,P.style.width=`${L.width+8}px`,P.style.top=`${L.top+window.scrollY-4}px`,P.style.left=`${L.left-4}px`;let ue=setTimeout(()=>{P.style.opacity="0";let we=setTimeout(()=>{P.remove()},500);m.current.push(we)},1e3);m.current.push(ue)},120);m.current.push(F)}),!0}return document.addEventListener("dragover",x),document.addEventListener("drop",N),()=>{document.removeEventListener("dragover",x),document.removeEventListener("drop",N),m.current.forEach(clearTimeout),m.current=[]}},[r,p,t,e,g,a,f?.admin?.hideGutter]);function h(x){let N=x.dataTransfer;if(!N||!a)return;or(N,a),N.effectAllowed="move";let b="";e.update(()=>{let S=ft(a);S&&(b=S.getKey())}),u.current=!0,N.setData(pt,b)}function C(){u.current=!1,g?.elem&&ht(l.current,g?.elem)}return er(dt(yt.Fragment,{children:[dt("span",{className:"sr-only",id:n,children:[i("general:moveUp"),": Alt + Shift + \u2191. ",i("general:moveDown"),": Alt + Shift + \u2193."]}),Ne("button",{"aria-label":"Drag to move",className:"icon draggable-block-menu",draggable:!0,onDragEnd:C,onDragStart:h,ref:s,type:"button",children:Ne("div",{className:o?"icon":""})}),Ne("div",{className:"draggable-block-target-line",ref:l}),Ne("div",{className:"debug-highlight",ref:d})]}),t)}function bt(e){let{anchorElem:t}=e,o=t===void 0?document.body:t,[r]=Jo();return rr(r,o,r._editable)}import{c as nr}from"react/compiler-runtime";import{jsx as Le}from"react/jsx-runtime";import{useLexicalComposerContext as ir}from"@lexical/react/LexicalComposerContext";import{useTranslation as sr}from"@payloadcms/ui";import{$createParagraphNode as lr,$getRoot as ar}from"lexical";import"react";var xt="insert-paragraph-at-end",Ct=()=>{let e=nr(5),[t]=ir(),{editorConfig:o}=R(),{t:r}=sr();if(o?.admin?.hideInsertParagraphAtEnd)return null;let n;e[0]!==t?(n=()=>{t.update(cr)},e[0]=t,e[1]=n):n=e[1];let i=n,s;return e[2]!==i||e[3]!==r?(s=Le("button",{"aria-label":r("lexical:general:insertParagraph"),className:xt,onClick:i,type:"button",children:Le("span",{className:`${xt}-inside`,children:Le(Ie,{size:16})})}),e[2]=i,e[3]=r,e[4]=s):s=e[4],s};function cr(){let e=lr();ar().append(e),e.select()}import{c as dr}from"react/compiler-runtime";import{registerMarkdownShortcuts as ur}from"@lexical/markdown";import{useLexicalComposerContext as fr}from"@lexical/react/LexicalComposerContext";import*as Et from"react";var Nt=()=>{let e=dr(4),{editorConfig:t}=R(),[o]=fr(),r,n;return e[0]!==o||e[1]!==t.features.markdownTransformers?(r=()=>ur(o,t.features.markdownTransformers??[]),n=[o,t.features.markdownTransformers],e[0]=o,e[1]=t.features.markdownTransformers,e[2]=r,e[3]=n):(r=e[2],n=e[3]),Et.useEffect(r,n),null};import{c as mr}from"react/compiler-runtime";import{useLexicalComposerContext as pr}from"@lexical/react/LexicalComposerContext.js";import{$getRoot as gr}from"lexical";import{useEffect as hr}from"react";function yr(e){e.update(()=>{let t=o=>{let r=o.getType();if((r==="block"||r==="inlineBlock")&&o.markDirty(),"getChildren"in o&&typeof o.getChildren=="function")for(let n of o.getChildren())t(n)};t(gr())})}function St(){let e=mr(5),[t]=pr(),{currentView:o,views:r}=K(),n,i;return e[0]!==o||e[1]!==t||e[2]!==r?(n=()=>{r&&(o==="default"?r.default?Pe(t,r.default?.nodes):Re(t):r[o]&&(Re(t),Pe(t,r[o]?.nodes)),yr(t))},i=[t,r,o],e[0]=o,e[1]=t,e[2]=r,e[3]=n,e[4]=i):(n=e[3],i=e[4]),hr(n,i),null}import{useLexicalComposerContext as br}from"@lexical/react/LexicalComposerContext";import{$getSelection as xr,$isRangeSelection as Cr,RootNode as Er}from"lexical";import{useEffect as Nr}from"react";function wt(){let[e]=br();return Nr(()=>e.registerNodeTransform(Er,t=>{let o=xr();if(Cr(o)){let r=o.anchor.getNode(),n=o.focus.getNode();(!r.isAttached()||!n.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 Sr}from"@lexical/react/LexicalComposerContext";import{$getSelection as wr,COMMAND_PRIORITY_LOW as Pr,SELECT_ALL_COMMAND as Rr}from"lexical";import{useEffect as Tr}from"react";function Pt(){let[e]=Sr();return Tr(()=>e.registerCommand(Rr,()=>{if(wr())return!1;let o=document.activeElement;return o instanceof HTMLInputElement&&o.select(),!0},Pr),[e]),null}import{jsx as te,jsxs as Tt}from"react/jsx-runtime";import{useLexicalComposerContext as Dr}from"@lexical/react/LexicalComposerContext.js";import{useTranslation as _t}from"@payloadcms/ui";import{useCallback as kr,useMemo as vr,useState as Lr}from"react";import"react";import*as Dt from"react-dom";import{c as _r}from"react/compiler-runtime";import"react";function Rt(e,t){let o=_r(4),{maxLength:r,minLength:n}=t,i=r===void 0?75:r,s=n===void 0?1:n,l;return o[0]!==i||o[1]!==s||o[2]!==e?(l=d=>{let{query:u}=d,m="[^"+e+Fe+"\\s]",c=new RegExp("(^|\\s|\\()(["+e+"]((?:"+m+"){0,"+i+"}))$").exec(u);if(c!==null){let g=c[1],y=c[3];if(y.length>=s)return{leadOffset:c.index+g.length,matchingString:y,replaceableString:c[2]}}return null},o[0]=i,o[1]=s,o[2]=e,o[3]=l):l=o[3],l}var O="slash-menu-popup";function Ar({isSelected:e,item:t,onClick:o,onMouseEnter:r,ref:n}){let{fieldProps:{featureClientSchemaMap:i,schemaPath:s}}=R(),{i18n:l}=_t(),d=`${O}__item ${O}__item-${t.key}`;e&&(d+=` ${O}__item--selected`);let u=t.key;return t.label&&(u=typeof t.label=="function"?t.label({featureClientSchemaMap:i,i18n:l,schemaPath:s}):t.label),u.length>25&&(u=u.substring(0,25)+"..."),Tt("button",{"aria-selected":e,className:d,id:O+"__item-"+t.key,onClick:o,onMouseEnter:r,ref:n,role:"option",tabIndex:-1,type:"button",children:[t?.Icon&&te(t.Icon,{}),te("span",{className:`${O}__item-text`,children:u})]},t.key)}function kt({anchorElem:e=document.body}){let[t]=Dr(),[o,r]=Lr(null),{editorConfig:n}=R(),{i18n:i}=_t(),{fieldProps:{featureClientSchemaMap:s,schemaPath:l}}=R(),d=Rt("/",{minLength:0}),u=kr(()=>{let a=[];for(let c of n.features.slashMenu.dynamicGroups)if(o){let g=c({editor:t,queryString:o});a=a.concat(g)}return a},[t,o,n?.features]),m=vr(()=>{let a=[];for(let c of n?.features.slashMenu.groups??[])a.push(c);if(o){let c=o.toLowerCase().replace(/[\s\-_]/g,"");a=a.map(y=>{let f=y.items.filter(p=>{let h=p.key;return p.label&&(h=typeof p.label=="function"?p.label({featureClientSchemaMap:s,i18n:i,schemaPath:l}):p.label),new RegExp(o,"gi").exec(h)||h.toLowerCase().replace(/[\s\-_]/g,"").includes(c)?!0:p.keywords!=null?p.keywords.some(x=>new RegExp(o,"gi").exec(x)?!0:x.toLowerCase().replace(/[\s\-_]/g,"").includes(c)):!1});return f.length?{...y,items:f}:null}),a=a.filter(y=>y!=null);let g=u();for(let y of g){let f=a.find(p=>p.key===y.key);f?a=a.filter(p=>p.key!==y.key):f={...y,items:[]},f?.items?.length&&(f.items=f.items.concat(f.items)),a.push(f)}}return a},[o,n?.features.slashMenu.groups,u,s,i,l]);return te(je,{anchorElem:e,groups:m,menuRenderFn:(a,{selectedItemKey:c,selectItemAndCleanUp:g,setSelectedItemKey:y})=>a.current&&m.length?Dt.createPortal(te("div",{className:O,"data-theme":"dark",children:m.map(f=>{let p=f.key;return f.label&&s&&(p=typeof f.label=="function"?f.label({featureClientSchemaMap:s,i18n:i,schemaPath:l}):f.label),Tt("div",{className:`${O}__group ${O}__group-${f.key}`,children:[te("div",{className:`${O}__group-title`,children:p}),f.items.map((h,C)=>te(Ar,{index:C,isSelected:c===h.key,item:h,onClick:()=>{y(h.key),g(h)},onMouseEnter:()=>{y(h.key)},ref:x=>{h.ref={current:x}}},h.key))]},f.key)})}),a.current):null,onQueryChange:r,triggerFn:d})}import{c as Mr}from"react/compiler-runtime";import{useLexicalComposerContext as Or}from"@lexical/react/LexicalComposerContext";import{TEXT_TYPE_TO_FORMAT as Br,TextNode as Ir}from"lexical";import{useEffect as $r}from"react";function vt(e){let t=Mr(6),{features:o}=e,[r]=Or(),n;t[0]!==r||t[1]!==o.enabledFormats?(n=()=>{let s=Fr(o.enabledFormats);if(s.length!==0)return r.registerNodeTransform(Ir,l=>{s.forEach(d=>{l.hasFormat(d)&&l.toggleFormat(d)})})},t[0]=r,t[1]=o.enabledFormats,t[2]=n):n=t[2];let i;return t[3]!==r||t[4]!==o?(i=[r,o],t[3]=r,t[4]=o,t[5]=i):i=t[5],$r(n,i),null}function Fr(e){let t=Object.keys(Br),o=new Set(e);return t.filter(r=>!o.has(r))}import{c as Kr}from"react/compiler-runtime";import{jsx as Lt}from"react/jsx-runtime";import{useLexicalComposerContext as jr}from"@lexical/react/LexicalComposerContext";import{ContentEditable as zr}from"@lexical/react/LexicalContentEditable.js";import{useLexicalEditable as Hr}from"@lexical/react/useLexicalEditable";import{getTranslation as Vr}from"@payloadcms/translations";import{useTranslation as Wr}from"@payloadcms/ui";import"react";function At(e){let t=Kr(10),{className:o,editorConfig:r,instructionsID:n}=e,{fieldProps:i}=R(),{i18n:s,t:l}=Wr(),[,d]=jr(),{getTheme:u}=d,m=Hr(),a;if(t[0]!==o||t[1]!==r?.admin?.placeholder||t[2]!==i.field.label||t[3]!==i.field.required||t[4]!==u||t[5]!==s||t[6]!==n||t[7]!==m||t[8]!==l){let c=u();a=Lt(zr,{"aria-describedby":n,"aria-label":Vr(i.field.label||"",s),"aria-required":i.field.required||void 0,className:o??"ContentEditable__root",...m?{"aria-placeholder":l("lexical:general:placeholder"),placeholder:Lt("p",{className:c?.placeholder,children:r?.admin?.placeholder??l("lexical:general:placeholder")})}:{placeholder:null}}),t[0]=o,t[1]=r?.admin?.placeholder,t[2]=i.field.label,t[3]=i.field.required,t[4]=u,t[5]=s,t[6]=n,t[7]=m,t[8]=l,t[9]=a}else a=t[9];return a}var Ot=e=>{let t=Yr(5),{editorConfig:o,editorContainerRef:r,isSmallWidthViewport:n,onChange:i,rtl:s}=e,l=R(),[d]=Gr(),u=Xr(),{t:m}=Zr(),a=z.useId(),c=u&&o.features.enabledFeatures.includes("indent"),[g,y]=rn(null),f;t[0]===Symbol.for("react.memo_cache_sentinel")?(f=x=>{x!==null&&y(x)},t[0]=f):f=t[0];let p=f,h,C;return t[1]!==d||t[2]!==l?(h=()=>{if(!l?.uuid){console.error("Lexical Editor must be used within an EditorConfigProvider");return}l?.parentEditor?.uuid&&l.parentEditor?.registerChild(l.uuid,l);let x=()=>{l.focusEditor(l)},N=()=>{l.blurEditor(l)},b=d.registerCommand(tn,()=>(x(),!0),Mt),S=d.registerCommand(en,()=>(N(),!0),Mt);return()=>{b(),S(),l.parentEditor?.unregisterChild?.(l.uuid)}},C=[d,l],t[1]=d,t[2]=l,t[3]=h,t[4]=C):(h=t[3],C=t[4]),on(h,C),ae(z.Fragment,{children:[o.features.plugins?.map(nn),ae("div",{className:"editor-container",dir:s?"rtl":void 0,ref:r,children:[o.features.plugins?.map(sn),E(Qr,{contentEditable:E("div",{className:"editor-scroller",children:E("div",{className:"editor",ref:p,children:E(At,{editorConfig:o,instructionsID:c?a:void 0})})}),ErrorBoundary:Ur}),E(wt,{}),u&&E(Ct,{}),E(Qe,{}),E(Ge,{}),E(vt,{features:o.features}),E(Pt,{}),E(St,{}),u&&E(Jr,{ignoreSelectionChange:!0,onChange:(x,N,b)=>{(!b.has("focus")||b.size>1)&&i?.(x,N,b)}}),g&&ae(z.Fragment,{children:[!n&&u&&ae(z.Fragment,{children:[o.admin?.hideDraggableBlockElement?null:E(bt,{anchorElem:g}),o.admin?.hideAddBlockButton?null:E(nt,{anchorElem:g})]}),o.features.plugins?.map(x=>{if(x.position==="floatingAnchorElem"&&!(x.desktopOnly===!0&&n))return E(W,{anchorElem:g,clientProps:x.clientProps,plugin:x},x.key)}),u&&E(z.Fragment,{children:E(kt,{anchorElem:g})})]}),u&&ae(z.Fragment,{children:[E(qr,{}),o?.features?.markdownTransformers?.length>0&&E(Nt,{})]}),o.features.plugins?.map(ln),o.features.plugins?.map(an)]}),c&&E("p",{className:"ContentEditable__keyboard-hint",id:a,children:m("lexical:indent:keyboardHint")}),o.features.plugins?.map(cn)]})};function nn(e){if(e.position==="aboveContainer")return E(W,{clientProps:e.clientProps,plugin:e},e.key)}function sn(e){if(e.position==="top")return E(W,{clientProps:e.clientProps,plugin:e},e.key)}function ln(e){if(e.position==="normal")return E(W,{clientProps:e.clientProps,plugin:e},e.key)}function an(e){if(e.position==="bottom")return E(W,{clientProps:e.clientProps,plugin:e},e.key)}function cn(e){if(e.position==="belowContainer")return E(W,{clientProps:e.clientProps,plugin:e},e.key)}var It=({children:e,providers:t})=>{if(!t?.length)return e;let o=t[0];return t.length>1?H(o,{children:H(It,{providers:t.slice(1),children:e})}):H(o,{children:e})},$t=e=>{let{composerKey:t,editorConfig:o,fieldProps:r,isSmallWidthViewport:n,onChange:i,readOnly:s,rtl:l,value:d}=e,{currentView:u,views:m}=K(),a=R(),c=un(),g=Bt.useRef(null),y=fn(()=>{if(d&&typeof d!="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(d));if(d&&Array.isArray(d)&&!("root"in d))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(d&&"jsonContent"in d)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 f=m?.[u]?.nodes;return{editable:s!==!0,editorState:d!=null?JSON.stringify(d):void 0,namespace:o.lexical.namespace,nodes:He({editorConfig:o,nodeViews:f}),onError:p=>{throw p},theme:o.lexical.theme}},[o,m,u]);return y?H(dn,{initialConfig:y,children:H(Be,{editorConfig:o,editorContainerRef:g,fieldProps:r,parentContext:a?.editDepth===c?a:void 0,children:H(It,{providers:o.features.providers,children:H(Ot,{editorConfig:o,editorContainerRef:g,isSmallWidthViewport:n,onChange:i,rtl:l})})})},t+y.editable+u):H("p",{children:"Loading..."})};import{c as mn}from"react/compiler-runtime";import{jsx as oe,jsxs as pn}from"react/jsx-runtime";import{ChevronIcon as gn,Popup as hn,PopupList as Ft}from"@payloadcms/ui";import"react";function Kt(){let e=mn(5),{currentView:t,setCurrentView:o,views:r}=K();if(!r||Object.keys(r).length===0)return null;let n,i;if(e[0]!==t||e[1]!==o||e[2]!==r){i=Symbol.for("react.early_return_sentinel");e:{let s=Object.keys(r);if(!s.some(bn)){i=null;break e}let d=["default",...s.filter(yn)],u=t.charAt(0).toUpperCase()+t.slice(1);n=oe("div",{className:"lexical-view-selector",children:oe(hn,{button:pn("button",{className:"lexical-view-selector__button",type:"button",children:[oe("span",{className:"lexical-view-selector__label",children:u}),oe(gn,{className:"lexical-view-selector__icon"})]}),buttonType:"custom",horizontalAlign:"left",popupType:"menu",render:m=>{let{close:a}=m;return oe(Ft.ButtonGroup,{children:d.map(c=>{let g=c.charAt(0).toUpperCase()+c.slice(1);return oe(Ft.Button,{active:c===t,disabled:c===t,onClick:()=>{o?.(c),a()},children:g},c)})})},size:"large"})})}e[0]=t,e[1]=o,e[2]=r,e[3]=n,e[4]=i}else n=e[3],i=e[4];return i!==Symbol.for("react.early_return_sentinel")?i:n}function yn(e){return e!=="default"}function bn(e){return e!=="default"}var re="rich-text-lexical",On=e=>{let{editorConfig:t,field:o,field:{admin:{className:r,description:n,readOnly:i}={},label:s,localized:l,required:d},path:u,readOnly:m,schemaPath:a,validate:c}=e,{i18n:g}=kn(),y=m||i,f=Dn(),{config:{localization:p}}=Pn(),h=wn({fieldLocalized:l,locale:f,localizationConfig:p||void 0}),C=Rn(),{isControlledByParent:x}=K(),N=Ht((A,ne)=>typeof c=="function"?c(A,{...ne,required:d}):!0,[c,d]),{customComponents:{AfterInput:b,BeforeInput:S,Description:D,Error:_,Label:B}={},disabled:V,initialValue:w,path:k,setValue:I,showError:$,value:T}=_n({potentiallyStalePath:u,validate:N}),q=y||V,[J,Ae]=Wt(!1),[Se,Me]=Wt(),de=zt.useRef(w),F=zt.useRef(T);Vt(()=>{let A=()=>{let ne=window.matchMedia("(max-width: 768px)").matches;ne!==J&&Ae(ne)};return A(),window.addEventListener("resize",A),()=>{window.removeEventListener("resize",A)}},[J]);let L=["field-type",re,r,$&&"error",q&&`${re}--read-only`,t?.admin?.hideGutter!==!0&&!J?`${re}--show-gutter`:null].filter(Boolean).join(" "),P=`${k}.${C}`,ue=$e(),we=Ht(A=>{ue(()=>{let Oe=A.toJSON();F.current=Oe,I(Oe)})},[I,ue]),Yt=An(()=>vn(o),[o]),Gt=Tn(A=>{F.current!==T&&!Ln(F.current!=null?JSON.parse(JSON.stringify(F.current)):F.current,T)&&(de.current=A,F.current=T,Me(new Date))});return Vt(()=>{Object.is(w,de.current)||Gt(w)},[w]),ce("div",{"aria-label":xn(s||"",g),className:L,"data-field-path":k,"data-field-schemapath":a,"data-lexical-view":t?.view,role:"group",style:Yt,children:[ce("div",{className:`${re}__label-row`,children:[B||v(Sn,{hasRequiredAccessibleState:!0,label:s,localized:l,path:k,required:d}),!x&&v(Kt,{})]}),ce("div",{className:`${re}__wrap`,children:[v(jt,{CustomComponent:_,Fallback:v(Nn,{path:k,showError:$})}),ce(Mn,{fallbackRender:Bn,onReset:()=>{},children:[S,v("div",{className:`${re}__editor-content`,children:v(Cn,{modalSlugPrefix:`lexical-${k}`,children:v($t,{composerKey:P,editorConfig:t,fieldProps:e,isSmallWidthViewport:J,onChange:we,readOnly:q,rtl:h,value:T},JSON.stringify({path:k,rerenderProviderKey:Se}))})}),b]}),v(jt,{CustomComponent:D,Fallback:v(En,{description:n,path:k})})]})]},P)};function Bn({error:e}){return ce("div",{className:"errorBoundary",role:"alert",children:[v("p",{children:"Something went wrong:"}),v("pre",{style:{color:"red"},children:e instanceof Error?e.message:String(e)})]})}var sa=On;export{sa as RichText};
2
- //# sourceMappingURL=Field-W2ABOM7M.js.map