@payloadcms/richtext-lexical 4.0.0-internal.f05c47f → 4.0.0-internal.f715c6e

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 (65) hide show
  1. package/dist/exports/client/Field-IZKDIUJY.js +2 -0
  2. package/dist/exports/client/{Field-F22V5L4V.js.map → Field-IZKDIUJY.js.map} +3 -3
  3. package/dist/exports/client/bundled.css +1 -1
  4. package/dist/exports/client/chunk-SSMQFWCQ.js +2 -0
  5. package/dist/exports/client/{chunk-LN6VX25I.js.map → chunk-SSMQFWCQ.js.map} +4 -4
  6. package/dist/exports/client/index.js +25 -25
  7. package/dist/exports/client/index.js.map +4 -4
  8. package/dist/features/blocks/server/index.js +2 -2
  9. package/dist/features/blocks/server/index.js.map +1 -1
  10. package/dist/features/link/server/index.js +2 -2
  11. package/dist/features/link/server/index.js.map +1 -1
  12. package/dist/features/table/server/index.js +2 -2
  13. package/dist/features/table/server/index.js.map +1 -1
  14. package/dist/features/toolbars/fixed/client/Toolbar/index.css +3 -77
  15. package/dist/features/toolbars/fixed/client/Toolbar/index.d.ts.map +1 -1
  16. package/dist/features/toolbars/fixed/client/Toolbar/index.js +1 -4
  17. package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
  18. package/dist/features/typesServer.d.ts +1 -1
  19. package/dist/features/typesServer.d.ts.map +1 -1
  20. package/dist/features/typesServer.js.map +1 -1
  21. package/dist/features/upload/server/index.js +2 -2
  22. package/dist/features/upload/server/index.js.map +1 -1
  23. package/dist/field/bundled.css +1 -1
  24. package/dist/field/index.css +10 -10
  25. package/dist/i18n.d.ts.map +1 -1
  26. package/dist/i18n.js +0 -68
  27. package/dist/i18n.js.map +1 -1
  28. package/dist/index.js +3 -3
  29. package/dist/index.js.map +1 -1
  30. package/dist/lexical/config/server/loader.d.ts +1 -1
  31. package/dist/lexical/config/server/loader.d.ts.map +1 -1
  32. package/dist/lexical/config/server/loader.js +2 -2
  33. package/dist/lexical/config/server/loader.js.map +1 -1
  34. package/dist/lexical/config/server/sanitize.d.ts +1 -1
  35. package/dist/lexical/config/server/sanitize.d.ts.map +1 -1
  36. package/dist/lexical/config/server/sanitize.js +2 -2
  37. package/dist/lexical/config/server/sanitize.js.map +1 -1
  38. package/dist/lexical/plugins/InsertParagraphAtEnd/index.css +23 -16
  39. package/dist/lexical/plugins/InsertParagraphAtEnd/index.d.ts.map +1 -1
  40. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js +14 -27
  41. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js.map +1 -1
  42. package/dist/types/index.d.ts +1 -1
  43. package/dist/types/index.d.ts.map +1 -1
  44. package/dist/types/index.js.map +1 -1
  45. package/dist/utilities/createServerFeature.d.ts +1 -1
  46. package/dist/utilities/createServerFeature.d.ts.map +1 -1
  47. package/dist/utilities/createServerFeature.js +2 -2
  48. package/dist/utilities/createServerFeature.js.map +1 -1
  49. package/dist/utilities/editorConfigFactory.d.ts +6 -6
  50. package/dist/utilities/editorConfigFactory.d.ts.map +1 -1
  51. package/dist/utilities/editorConfigFactory.js +9 -9
  52. package/dist/utilities/editorConfigFactory.js.map +1 -1
  53. package/dist/utilities/getDefaultSanitizedEditorConfig.d.ts +2 -2
  54. package/dist/utilities/getDefaultSanitizedEditorConfig.d.ts.map +1 -1
  55. package/dist/utilities/getDefaultSanitizedEditorConfig.js +17 -6
  56. package/dist/utilities/getDefaultSanitizedEditorConfig.js.map +1 -1
  57. package/package.json +5 -5
  58. package/dist/exports/client/Field-F22V5L4V.js +0 -2
  59. package/dist/exports/client/chunk-LN6VX25I.js +0 -2
  60. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.d.ts +0 -8
  61. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.d.ts.map +0 -1
  62. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.js +0 -80
  63. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.js.map +0 -1
  64. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.spec.js +0 -65
  65. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.spec.js.map +0 -1
@@ -3,7 +3,7 @@ import { loadFeatures } from '../lexical/config/server/loader.js';
3
3
  import { sanitizeServerFeatures } from '../lexical/config/server/sanitize.js';
4
4
  import { getDefaultSanitizedEditorConfig } from './getDefaultSanitizedEditorConfig.js';
5
5
  export const editorConfigFactory = {
6
- default: args => {
6
+ default: async args => {
7
7
  return getDefaultSanitizedEditorConfig({
8
8
  config: args.config,
9
9
  parentIsLocalized: args.parentIsLocalized ?? false
@@ -17,8 +17,8 @@ export const editorConfigFactory = {
17
17
  * This is the least efficient way to get the editor config, and not recommended. It is recommended to extract the `features` arg
18
18
  * into a separate variable and use `fromFeatures` instead.
19
19
  */
20
- fromEditor: args => {
21
- const lexicalAdapter = args.editor({
20
+ fromEditor: async args => {
21
+ const lexicalAdapter = await args.editor({
22
22
  config: args.config,
23
23
  isRoot: args.isRoot ?? false,
24
24
  parentIsLocalized: args.parentIsLocalized ?? false
@@ -29,17 +29,17 @@ export const editorConfigFactory = {
29
29
  /**
30
30
  * Create a new editor config - behaves just like instantiating a new `lexicalEditor`
31
31
  */
32
- fromFeatures: args => {
33
- return featuresInputToEditorConfig(args).sanitizedConfig;
32
+ fromFeatures: async args => {
33
+ return (await featuresInputToEditorConfig(args)).sanitizedConfig;
34
34
  },
35
35
  fromField: args => {
36
36
  const lexicalAdapter = args.field.editor;
37
37
  const sanitizedServerEditorConfig = lexicalAdapter.editorConfig;
38
38
  return sanitizedServerEditorConfig;
39
39
  },
40
- fromUnsanitizedField: args => {
40
+ fromUnsanitizedField: async args => {
41
41
  const lexicalAdapterProvider = args.field.editor;
42
- const lexicalAdapter = lexicalAdapterProvider({
42
+ const lexicalAdapter = await lexicalAdapterProvider({
43
43
  config: args.config,
44
44
  isRoot: args.isRoot ?? false,
45
45
  parentIsLocalized: args.parentIsLocalized ?? false
@@ -48,7 +48,7 @@ export const editorConfigFactory = {
48
48
  return sanitizedServerEditorConfig;
49
49
  }
50
50
  };
51
- export const featuresInputToEditorConfig = args => {
51
+ export const featuresInputToEditorConfig = async args => {
52
52
  let features = [];
53
53
  if (args.features && typeof args.features === 'function') {
54
54
  const rootEditor = args.config.editor;
@@ -67,7 +67,7 @@ export const featuresInputToEditorConfig = args => {
67
67
  features = defaultEditorFeatures;
68
68
  }
69
69
  const lexical = args.lexical ?? defaultEditorConfig.lexical;
70
- const resolvedFeatureMap = loadFeatures({
70
+ const resolvedFeatureMap = await loadFeatures({
71
71
  config: args.config,
72
72
  isRoot: args.isRoot ?? false,
73
73
  parentIsLocalized: args.parentIsLocalized ?? false,
@@ -1 +1 @@
1
- {"version":3,"file":"editorConfigFactory.js","names":["defaultEditorConfig","defaultEditorFeatures","loadFeatures","sanitizeServerFeatures","getDefaultSanitizedEditorConfig","editorConfigFactory","default","args","config","parentIsLocalized","fromEditor","lexicalAdapter","editor","isRoot","sanitizedServerEditorConfig","editorConfig","fromFeatures","featuresInputToEditorConfig","sanitizedConfig","fromField","field","fromUnsanitizedField","lexicalAdapterProvider","features","rootEditor","rootEditorFeatures","defaultFeatures","rootFeatures","lexical","resolvedFeatureMap","unSanitizedEditorConfig"],"sources":["../../src/utilities/editorConfigFactory.ts"],"sourcesContent":["import type { EditorConfig as LexicalEditorConfig } from 'lexical'\nimport type { RichTextAdapterProvider, RichTextField, SanitizedConfig } from 'payload'\n\nimport type { FeatureProviderServer, ResolvedServerFeatureMap } from '../features/typesServer.js'\nimport type { SanitizedServerEditorConfig } from '../lexical/config/types.js'\nimport type {\n FeaturesInput,\n LexicalRichTextAdapter,\n LexicalRichTextAdapterProvider,\n} from '../types/index.js'\n\nimport { defaultEditorConfig, defaultEditorFeatures } from '../lexical/config/server/default.js'\nimport { loadFeatures } from '../lexical/config/server/loader.js'\nimport { sanitizeServerFeatures } from '../lexical/config/server/sanitize.js'\nimport { getDefaultSanitizedEditorConfig } from './getDefaultSanitizedEditorConfig.js'\n\nexport const editorConfigFactory = {\n default: (args: {\n config: SanitizedConfig\n parentIsLocalized?: boolean\n }): SanitizedServerEditorConfig => {\n return getDefaultSanitizedEditorConfig({\n config: args.config,\n parentIsLocalized: args.parentIsLocalized ?? false,\n })\n },\n /**\n * If you have instantiated a lexical editor and are accessing it outside a field (=> this is the unsanitized editor),\n * you can extract the editor config from it.\n * This is common if you define the editor in a re-usable module scope variable and pass it to the richText field.\n *\n * This is the least efficient way to get the editor config, and not recommended. It is recommended to extract the `features` arg\n * into a separate variable and use `fromFeatures` instead.\n */\n fromEditor: (args: {\n config: SanitizedConfig\n editor: LexicalRichTextAdapterProvider\n isRoot?: boolean\n lexical?: LexicalEditorConfig\n parentIsLocalized?: boolean\n }): SanitizedServerEditorConfig => {\n const lexicalAdapter: LexicalRichTextAdapter = args.editor({\n config: args.config,\n isRoot: args.isRoot ?? false,\n parentIsLocalized: args.parentIsLocalized ?? false,\n })\n\n const sanitizedServerEditorConfig: SanitizedServerEditorConfig = lexicalAdapter.editorConfig\n return sanitizedServerEditorConfig\n },\n /**\n * Create a new editor config - behaves just like instantiating a new `lexicalEditor`\n */\n fromFeatures: (args: {\n config: SanitizedConfig\n features?: FeaturesInput\n isRoot?: boolean\n lexical?: LexicalEditorConfig\n parentIsLocalized?: boolean\n }): SanitizedServerEditorConfig => {\n return featuresInputToEditorConfig(args).sanitizedConfig\n },\n fromField: (args: { field: RichTextField }): SanitizedServerEditorConfig => {\n const lexicalAdapter: LexicalRichTextAdapter = args.field.editor as LexicalRichTextAdapter\n\n const sanitizedServerEditorConfig: SanitizedServerEditorConfig = lexicalAdapter.editorConfig\n return sanitizedServerEditorConfig\n },\n fromUnsanitizedField: (args: {\n config: SanitizedConfig\n field: RichTextField\n isRoot?: boolean\n parentIsLocalized?: boolean\n }): SanitizedServerEditorConfig => {\n const lexicalAdapterProvider: RichTextAdapterProvider = args.field\n .editor as RichTextAdapterProvider\n\n const lexicalAdapter: LexicalRichTextAdapter = lexicalAdapterProvider({\n config: args.config,\n isRoot: args.isRoot ?? false,\n parentIsLocalized: args.parentIsLocalized ?? false,\n }) as LexicalRichTextAdapter\n\n const sanitizedServerEditorConfig: SanitizedServerEditorConfig = lexicalAdapter.editorConfig\n return sanitizedServerEditorConfig\n },\n}\n\nexport const featuresInputToEditorConfig = (args: {\n config: SanitizedConfig\n features?: FeaturesInput\n isRoot?: boolean\n lexical?: LexicalEditorConfig\n parentIsLocalized?: boolean\n}): {\n features: FeatureProviderServer<unknown, unknown, unknown>[]\n resolvedFeatureMap: ResolvedServerFeatureMap\n sanitizedConfig: SanitizedServerEditorConfig\n} => {\n let features: FeatureProviderServer<unknown, unknown, unknown>[] = []\n if (args.features && typeof args.features === 'function') {\n const rootEditor = args.config.editor\n let rootEditorFeatures: FeatureProviderServer<unknown, unknown, unknown>[] = []\n if (typeof rootEditor === 'object' && 'features' in rootEditor) {\n rootEditorFeatures = (rootEditor as LexicalRichTextAdapter).features\n }\n features = args.features({\n defaultFeatures: defaultEditorFeatures,\n rootFeatures: rootEditorFeatures,\n })\n } else {\n features = args.features as FeatureProviderServer<unknown, unknown, unknown>[]\n }\n\n if (!features) {\n features = defaultEditorFeatures\n }\n\n const lexical = args.lexical ?? defaultEditorConfig.lexical\n\n const resolvedFeatureMap = loadFeatures({\n config: args.config,\n isRoot: args.isRoot ?? false,\n parentIsLocalized: args.parentIsLocalized ?? false,\n unSanitizedEditorConfig: {\n features,\n lexical,\n },\n })\n\n return {\n features,\n resolvedFeatureMap,\n sanitizedConfig: {\n features: sanitizeServerFeatures(resolvedFeatureMap),\n lexical: args.lexical,\n resolvedFeatureMap,\n },\n }\n}\n"],"mappings":"AAWA,SAASA,mBAAmB,EAAEC,qBAAqB,QAAQ;AAC3D,SAASC,YAAY,QAAQ;AAC7B,SAASC,sBAAsB,QAAQ;AACvC,SAASC,+BAA+B,QAAQ;AAEhD,OAAO,MAAMC,mBAAA,GAAsB;EACjCC,OAAA,EAAUC,IAAA;IAIR,OAAOH,+BAAA,CAAgC;MACrCI,MAAA,EAAQD,IAAA,CAAKC,MAAM;MACnBC,iBAAA,EAAmBF,IAAA,CAAKE,iBAAiB,IAAI;IAC/C;EACF;EACA;;;;;;;;EAQAC,UAAA,EAAaH,IAAA;IAOX,MAAMI,cAAA,GAAyCJ,IAAA,CAAKK,MAAM,CAAC;MACzDJ,MAAA,EAAQD,IAAA,CAAKC,MAAM;MACnBK,MAAA,EAAQN,IAAA,CAAKM,MAAM,IAAI;MACvBJ,iBAAA,EAAmBF,IAAA,CAAKE,iBAAiB,IAAI;IAC/C;IAEA,MAAMK,2BAAA,GAA2DH,cAAA,CAAeI,YAAY;IAC5F,OAAOD,2BAAA;EACT;EACA;;;EAGAE,YAAA,EAAeT,IAAA;IAOb,OAAOU,2BAAA,CAA4BV,IAAA,EAAMW,eAAe;EAC1D;EACAC,SAAA,EAAYZ,IAAA;IACV,MAAMI,cAAA,GAAyCJ,IAAA,CAAKa,KAAK,CAACR,MAAM;IAEhE,MAAME,2BAAA,GAA2DH,cAAA,CAAeI,YAAY;IAC5F,OAAOD,2BAAA;EACT;EACAO,oBAAA,EAAuBd,IAAA;IAMrB,MAAMe,sBAAA,GAAkDf,IAAA,CAAKa,KAAK,CAC/DR,MAAM;IAET,MAAMD,cAAA,GAAyCW,sBAAA,CAAuB;MACpEd,MAAA,EAAQD,IAAA,CAAKC,MAAM;MACnBK,MAAA,EAAQN,IAAA,CAAKM,MAAM,IAAI;MACvBJ,iBAAA,EAAmBF,IAAA,CAAKE,iBAAiB,IAAI;IAC/C;IAEA,MAAMK,2BAAA,GAA2DH,cAAA,CAAeI,YAAY;IAC5F,OAAOD,2BAAA;EACT;AACF;AAEA,OAAO,MAAMG,2BAAA,GAA+BV,IAAA;EAW1C,IAAIgB,QAAA,GAA+D,EAAE;EACrE,IAAIhB,IAAA,CAAKgB,QAAQ,IAAI,OAAOhB,IAAA,CAAKgB,QAAQ,KAAK,YAAY;IACxD,MAAMC,UAAA,GAAajB,IAAA,CAAKC,MAAM,CAACI,MAAM;IACrC,IAAIa,kBAAA,GAAyE,EAAE;IAC/E,IAAI,OAAOD,UAAA,KAAe,YAAY,cAAcA,UAAA,EAAY;MAC9DC,kBAAA,GAAqBD,UAAC,CAAsCD,QAAQ;IACtE;IACAA,QAAA,GAAWhB,IAAA,CAAKgB,QAAQ,CAAC;MACvBG,eAAA,EAAiBzB,qBAAA;MACjB0B,YAAA,EAAcF;IAChB;EACF,OAAO;IACLF,QAAA,GAAWhB,IAAA,CAAKgB,QAAQ;EAC1B;EAEA,IAAI,CAACA,QAAA,EAAU;IACbA,QAAA,GAAWtB,qBAAA;EACb;EAEA,MAAM2B,OAAA,GAAUrB,IAAA,CAAKqB,OAAO,IAAI5B,mBAAA,CAAoB4B,OAAO;EAE3D,MAAMC,kBAAA,GAAqB3B,YAAA,CAAa;IACtCM,MAAA,EAAQD,IAAA,CAAKC,MAAM;IACnBK,MAAA,EAAQN,IAAA,CAAKM,MAAM,IAAI;IACvBJ,iBAAA,EAAmBF,IAAA,CAAKE,iBAAiB,IAAI;IAC7CqB,uBAAA,EAAyB;MACvBP,QAAA;MACAK;IACF;EACF;EAEA,OAAO;IACLL,QAAA;IACAM,kBAAA;IACAX,eAAA,EAAiB;MACfK,QAAA,EAAUpB,sBAAA,CAAuB0B,kBAAA;MACjCD,OAAA,EAASrB,IAAA,CAAKqB,OAAO;MACrBC;IACF;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"editorConfigFactory.js","names":["defaultEditorConfig","defaultEditorFeatures","loadFeatures","sanitizeServerFeatures","getDefaultSanitizedEditorConfig","editorConfigFactory","default","args","config","parentIsLocalized","fromEditor","lexicalAdapter","editor","isRoot","sanitizedServerEditorConfig","editorConfig","fromFeatures","featuresInputToEditorConfig","sanitizedConfig","fromField","field","fromUnsanitizedField","lexicalAdapterProvider","features","rootEditor","rootEditorFeatures","defaultFeatures","rootFeatures","lexical","resolvedFeatureMap","unSanitizedEditorConfig"],"sources":["../../src/utilities/editorConfigFactory.ts"],"sourcesContent":["import type { EditorConfig as LexicalEditorConfig } from 'lexical'\nimport type { RichTextAdapterProvider, RichTextField, SanitizedConfig } from 'payload'\n\nimport type { FeatureProviderServer, ResolvedServerFeatureMap } from '../features/typesServer.js'\nimport type { SanitizedServerEditorConfig } from '../lexical/config/types.js'\nimport type {\n FeaturesInput,\n LexicalRichTextAdapter,\n LexicalRichTextAdapterProvider,\n} from '../types/index.js'\n\nimport { defaultEditorConfig, defaultEditorFeatures } from '../lexical/config/server/default.js'\nimport { loadFeatures } from '../lexical/config/server/loader.js'\nimport { sanitizeServerFeatures } from '../lexical/config/server/sanitize.js'\nimport { getDefaultSanitizedEditorConfig } from './getDefaultSanitizedEditorConfig.js'\n\nexport const editorConfigFactory = {\n default: async (args: {\n config: SanitizedConfig\n parentIsLocalized?: boolean\n }): Promise<SanitizedServerEditorConfig> => {\n return getDefaultSanitizedEditorConfig({\n config: args.config,\n parentIsLocalized: args.parentIsLocalized ?? false,\n })\n },\n /**\n * If you have instantiated a lexical editor and are accessing it outside a field (=> this is the unsanitized editor),\n * you can extract the editor config from it.\n * This is common if you define the editor in a re-usable module scope variable and pass it to the richText field.\n *\n * This is the least efficient way to get the editor config, and not recommended. It is recommended to extract the `features` arg\n * into a separate variable and use `fromFeatures` instead.\n */\n fromEditor: async (args: {\n config: SanitizedConfig\n editor: LexicalRichTextAdapterProvider\n isRoot?: boolean\n lexical?: LexicalEditorConfig\n parentIsLocalized?: boolean\n }): Promise<SanitizedServerEditorConfig> => {\n const lexicalAdapter: LexicalRichTextAdapter = await args.editor({\n config: args.config,\n isRoot: args.isRoot ?? false,\n parentIsLocalized: args.parentIsLocalized ?? false,\n })\n\n const sanitizedServerEditorConfig: SanitizedServerEditorConfig = lexicalAdapter.editorConfig\n return sanitizedServerEditorConfig\n },\n /**\n * Create a new editor config - behaves just like instantiating a new `lexicalEditor`\n */\n fromFeatures: async (args: {\n config: SanitizedConfig\n features?: FeaturesInput\n isRoot?: boolean\n lexical?: LexicalEditorConfig\n parentIsLocalized?: boolean\n }): Promise<SanitizedServerEditorConfig> => {\n return (await featuresInputToEditorConfig(args)).sanitizedConfig\n },\n fromField: (args: { field: RichTextField }): SanitizedServerEditorConfig => {\n const lexicalAdapter: LexicalRichTextAdapter = args.field.editor as LexicalRichTextAdapter\n\n const sanitizedServerEditorConfig: SanitizedServerEditorConfig = lexicalAdapter.editorConfig\n return sanitizedServerEditorConfig\n },\n fromUnsanitizedField: async (args: {\n config: SanitizedConfig\n field: RichTextField\n isRoot?: boolean\n parentIsLocalized?: boolean\n }): Promise<SanitizedServerEditorConfig> => {\n const lexicalAdapterProvider: RichTextAdapterProvider = args.field\n .editor as RichTextAdapterProvider\n\n const lexicalAdapter: LexicalRichTextAdapter = (await lexicalAdapterProvider({\n config: args.config,\n isRoot: args.isRoot ?? false,\n parentIsLocalized: args.parentIsLocalized ?? false,\n })) as LexicalRichTextAdapter\n\n const sanitizedServerEditorConfig: SanitizedServerEditorConfig = lexicalAdapter.editorConfig\n return sanitizedServerEditorConfig\n },\n}\n\nexport const featuresInputToEditorConfig = async (args: {\n config: SanitizedConfig\n features?: FeaturesInput\n isRoot?: boolean\n lexical?: LexicalEditorConfig\n parentIsLocalized?: boolean\n}): Promise<{\n features: FeatureProviderServer<unknown, unknown, unknown>[]\n resolvedFeatureMap: ResolvedServerFeatureMap\n sanitizedConfig: SanitizedServerEditorConfig\n}> => {\n let features: FeatureProviderServer<unknown, unknown, unknown>[] = []\n if (args.features && typeof args.features === 'function') {\n const rootEditor = args.config.editor\n let rootEditorFeatures: FeatureProviderServer<unknown, unknown, unknown>[] = []\n if (typeof rootEditor === 'object' && 'features' in rootEditor) {\n rootEditorFeatures = (rootEditor as LexicalRichTextAdapter).features\n }\n features = args.features({\n defaultFeatures: defaultEditorFeatures,\n rootFeatures: rootEditorFeatures,\n })\n } else {\n features = args.features as FeatureProviderServer<unknown, unknown, unknown>[]\n }\n\n if (!features) {\n features = defaultEditorFeatures\n }\n\n const lexical = args.lexical ?? defaultEditorConfig.lexical\n\n const resolvedFeatureMap = await loadFeatures({\n config: args.config,\n isRoot: args.isRoot ?? false,\n parentIsLocalized: args.parentIsLocalized ?? false,\n unSanitizedEditorConfig: {\n features,\n lexical,\n },\n })\n\n return {\n features,\n resolvedFeatureMap,\n sanitizedConfig: {\n features: sanitizeServerFeatures(resolvedFeatureMap),\n lexical: args.lexical,\n resolvedFeatureMap,\n },\n }\n}\n"],"mappings":"AAWA,SAASA,mBAAmB,EAAEC,qBAAqB,QAAQ;AAC3D,SAASC,YAAY,QAAQ;AAC7B,SAASC,sBAAsB,QAAQ;AACvC,SAASC,+BAA+B,QAAQ;AAEhD,OAAO,MAAMC,mBAAA,GAAsB;EACjCC,OAAA,EAAS,MAAOC,IAAA;IAId,OAAOH,+BAAA,CAAgC;MACrCI,MAAA,EAAQD,IAAA,CAAKC,MAAM;MACnBC,iBAAA,EAAmBF,IAAA,CAAKE,iBAAiB,IAAI;IAC/C;EACF;EACA;;;;;;;;EAQAC,UAAA,EAAY,MAAOH,IAAA;IAOjB,MAAMI,cAAA,GAAyC,MAAMJ,IAAA,CAAKK,MAAM,CAAC;MAC/DJ,MAAA,EAAQD,IAAA,CAAKC,MAAM;MACnBK,MAAA,EAAQN,IAAA,CAAKM,MAAM,IAAI;MACvBJ,iBAAA,EAAmBF,IAAA,CAAKE,iBAAiB,IAAI;IAC/C;IAEA,MAAMK,2BAAA,GAA2DH,cAAA,CAAeI,YAAY;IAC5F,OAAOD,2BAAA;EACT;EACA;;;EAGAE,YAAA,EAAc,MAAOT,IAAA;IAOnB,OAAO,CAAC,MAAMU,2BAAA,CAA4BV,IAAA,CAAI,EAAGW,eAAe;EAClE;EACAC,SAAA,EAAYZ,IAAA;IACV,MAAMI,cAAA,GAAyCJ,IAAA,CAAKa,KAAK,CAACR,MAAM;IAEhE,MAAME,2BAAA,GAA2DH,cAAA,CAAeI,YAAY;IAC5F,OAAOD,2BAAA;EACT;EACAO,oBAAA,EAAsB,MAAOd,IAAA;IAM3B,MAAMe,sBAAA,GAAkDf,IAAA,CAAKa,KAAK,CAC/DR,MAAM;IAET,MAAMD,cAAA,GAA0C,MAAMW,sBAAA,CAAuB;MAC3Ed,MAAA,EAAQD,IAAA,CAAKC,MAAM;MACnBK,MAAA,EAAQN,IAAA,CAAKM,MAAM,IAAI;MACvBJ,iBAAA,EAAmBF,IAAA,CAAKE,iBAAiB,IAAI;IAC/C;IAEA,MAAMK,2BAAA,GAA2DH,cAAA,CAAeI,YAAY;IAC5F,OAAOD,2BAAA;EACT;AACF;AAEA,OAAO,MAAMG,2BAAA,GAA8B,MAAOV,IAAA;EAWhD,IAAIgB,QAAA,GAA+D,EAAE;EACrE,IAAIhB,IAAA,CAAKgB,QAAQ,IAAI,OAAOhB,IAAA,CAAKgB,QAAQ,KAAK,YAAY;IACxD,MAAMC,UAAA,GAAajB,IAAA,CAAKC,MAAM,CAACI,MAAM;IACrC,IAAIa,kBAAA,GAAyE,EAAE;IAC/E,IAAI,OAAOD,UAAA,KAAe,YAAY,cAAcA,UAAA,EAAY;MAC9DC,kBAAA,GAAqBD,UAAC,CAAsCD,QAAQ;IACtE;IACAA,QAAA,GAAWhB,IAAA,CAAKgB,QAAQ,CAAC;MACvBG,eAAA,EAAiBzB,qBAAA;MACjB0B,YAAA,EAAcF;IAChB;EACF,OAAO;IACLF,QAAA,GAAWhB,IAAA,CAAKgB,QAAQ;EAC1B;EAEA,IAAI,CAACA,QAAA,EAAU;IACbA,QAAA,GAAWtB,qBAAA;EACb;EAEA,MAAM2B,OAAA,GAAUrB,IAAA,CAAKqB,OAAO,IAAI5B,mBAAA,CAAoB4B,OAAO;EAE3D,MAAMC,kBAAA,GAAqB,MAAM3B,YAAA,CAAa;IAC5CM,MAAA,EAAQD,IAAA,CAAKC,MAAM;IACnBK,MAAA,EAAQN,IAAA,CAAKM,MAAM,IAAI;IACvBJ,iBAAA,EAAmBF,IAAA,CAAKE,iBAAiB,IAAI;IAC7CqB,uBAAA,EAAyB;MACvBP,QAAA;MACAK;IACF;EACF;EAEA,OAAO;IACLL,QAAA;IACAM,kBAAA;IACAX,eAAA,EAAiB;MACfK,QAAA,EAAUpB,sBAAA,CAAuB0B,kBAAA;MACjCD,OAAA,EAASrB,IAAA,CAAKqB,OAAO;MACrBC;IACF;EACF;AACF","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  import type { SanitizedConfig } from 'payload';
2
2
  import { type SanitizedServerEditorConfig } from '../index.js';
3
- export declare const getDefaultSanitizedEditorConfig: ({ config, parentIsLocalized, }: {
3
+ export declare const getDefaultSanitizedEditorConfig: (args: {
4
4
  config: SanitizedConfig;
5
5
  parentIsLocalized: boolean;
6
- }) => SanitizedServerEditorConfig;
6
+ }) => Promise<SanitizedServerEditorConfig>;
7
7
  //# sourceMappingURL=getDefaultSanitizedEditorConfig.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getDefaultSanitizedEditorConfig.d.ts","sourceRoot":"","sources":["../../src/utilities/getDefaultSanitizedEditorConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,OAAO,EAAE,KAAK,2BAA2B,EAAE,MAAM,aAAa,CAAA;AAQ9D,eAAO,MAAM,+BAA+B,mCAGzC;IACD,MAAM,EAAE,eAAe,CAAA;IACvB,iBAAiB,EAAE,OAAO,CAAA;CAC3B,KAAG,2BAGH,CAAA"}
1
+ {"version":3,"file":"getDefaultSanitizedEditorConfig.d.ts","sourceRoot":"","sources":["../../src/utilities/getDefaultSanitizedEditorConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,OAAO,EAAE,KAAK,2BAA2B,EAAE,MAAM,aAAa,CAAA;AAgB9D,eAAO,MAAM,+BAA+B,SAAgB;IAC1D,MAAM,EAAE,eAAe,CAAA;IACvB,iBAAiB,EAAE,OAAO,CAAA;CAC3B,KAAG,OAAO,CAAC,2BAA2B,CAoBtC,CAAA"}
@@ -1,10 +1,21 @@
1
1
  import { defaultEditorConfig } from '../lexical/config/server/default.js';
2
2
  import { sanitizeServerEditorConfig } from '../lexical/config/server/sanitize.js';
3
- const lexicalGlobal = globalThis;
4
- export const getDefaultSanitizedEditorConfig = ({
5
- config,
6
- parentIsLocalized
7
- }) => {
8
- return lexicalGlobal._payload_lexical_defaultSanitizedServerEditorConfig ??= sanitizeServerEditorConfig(defaultEditorConfig, config, parentIsLocalized);
3
+ let cachedDefaultSanitizedServerEditorConfig = global._payload_lexical_defaultSanitizedServerEditorConfig;
4
+ if (!cachedDefaultSanitizedServerEditorConfig) {
5
+ cachedDefaultSanitizedServerEditorConfig = global._payload_lexical_defaultSanitizedServerEditorConfig = null;
6
+ }
7
+ export const getDefaultSanitizedEditorConfig = async args => {
8
+ const {
9
+ config,
10
+ parentIsLocalized
11
+ } = args;
12
+ if (cachedDefaultSanitizedServerEditorConfig) {
13
+ return await cachedDefaultSanitizedServerEditorConfig;
14
+ }
15
+ cachedDefaultSanitizedServerEditorConfig = sanitizeServerEditorConfig(defaultEditorConfig, config, parentIsLocalized);
16
+ global.payload_lexical_defaultSanitizedServerEditorConfig = cachedDefaultSanitizedServerEditorConfig;
17
+ cachedDefaultSanitizedServerEditorConfig = await cachedDefaultSanitizedServerEditorConfig;
18
+ global.payload_lexical_defaultSanitizedServerEditorConfig = cachedDefaultSanitizedServerEditorConfig;
19
+ return cachedDefaultSanitizedServerEditorConfig;
9
20
  };
10
21
  //# sourceMappingURL=getDefaultSanitizedEditorConfig.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getDefaultSanitizedEditorConfig.js","names":["defaultEditorConfig","sanitizeServerEditorConfig","lexicalGlobal","globalThis","getDefaultSanitizedEditorConfig","config","parentIsLocalized","_payload_lexical_defaultSanitizedServerEditorConfig"],"sources":["../../src/utilities/getDefaultSanitizedEditorConfig.ts"],"sourcesContent":["import type { SanitizedConfig } from 'payload'\n\nimport { type SanitizedServerEditorConfig } from '../index.js'\nimport { defaultEditorConfig } from '../lexical/config/server/default.js'\nimport { sanitizeServerEditorConfig } from '../lexical/config/server/sanitize.js'\n\nconst lexicalGlobal = globalThis as {\n _payload_lexical_defaultSanitizedServerEditorConfig?: SanitizedServerEditorConfig\n} & typeof globalThis\n\nexport const getDefaultSanitizedEditorConfig = ({\n config,\n parentIsLocalized,\n}: {\n config: SanitizedConfig\n parentIsLocalized: boolean\n}): SanitizedServerEditorConfig => {\n return (lexicalGlobal._payload_lexical_defaultSanitizedServerEditorConfig ??=\n sanitizeServerEditorConfig(defaultEditorConfig, config, parentIsLocalized))\n}\n"],"mappings":"AAGA,SAASA,mBAAmB,QAAQ;AACpC,SAASC,0BAA0B,QAAQ;AAE3C,MAAMC,aAAA,GAAgBC,UAAA;AAItB,OAAO,MAAMC,+BAAA,GAAkCA,CAAC;EAC9CC,MAAM;EACNC;AAAiB,CAIlB;EACC,OAAQJ,aAAA,CAAcK,mDAAmD,KACvEN,0BAAA,CAA2BD,mBAAA,EAAqBK,MAAA,EAAQC,iBAAA;AAC5D","ignoreList":[]}
1
+ {"version":3,"file":"getDefaultSanitizedEditorConfig.js","names":["defaultEditorConfig","sanitizeServerEditorConfig","cachedDefaultSanitizedServerEditorConfig","global","_payload_lexical_defaultSanitizedServerEditorConfig","getDefaultSanitizedEditorConfig","args","config","parentIsLocalized","payload_lexical_defaultSanitizedServerEditorConfig"],"sources":["../../src/utilities/getDefaultSanitizedEditorConfig.ts"],"sourcesContent":["import type { SanitizedConfig } from 'payload'\n\nimport { type SanitizedServerEditorConfig } from '../index.js'\nimport { defaultEditorConfig } from '../lexical/config/server/default.js'\nimport { sanitizeServerEditorConfig } from '../lexical/config/server/sanitize.js'\n\nlet cachedDefaultSanitizedServerEditorConfig:\n | null\n | Promise<SanitizedServerEditorConfig>\n | SanitizedServerEditorConfig = (global as any)\n ._payload_lexical_defaultSanitizedServerEditorConfig\n\nif (!cachedDefaultSanitizedServerEditorConfig) {\n cachedDefaultSanitizedServerEditorConfig = (\n global as any\n )._payload_lexical_defaultSanitizedServerEditorConfig = null\n}\n\nexport const getDefaultSanitizedEditorConfig = async (args: {\n config: SanitizedConfig\n parentIsLocalized: boolean\n}): Promise<SanitizedServerEditorConfig> => {\n const { config, parentIsLocalized } = args\n\n if (cachedDefaultSanitizedServerEditorConfig) {\n return await cachedDefaultSanitizedServerEditorConfig\n }\n\n cachedDefaultSanitizedServerEditorConfig = sanitizeServerEditorConfig(\n defaultEditorConfig,\n config,\n parentIsLocalized,\n )\n ;(global as any).payload_lexical_defaultSanitizedServerEditorConfig =\n cachedDefaultSanitizedServerEditorConfig\n\n cachedDefaultSanitizedServerEditorConfig = await cachedDefaultSanitizedServerEditorConfig\n ;(global as any).payload_lexical_defaultSanitizedServerEditorConfig =\n cachedDefaultSanitizedServerEditorConfig\n\n return cachedDefaultSanitizedServerEditorConfig\n}\n"],"mappings":"AAGA,SAASA,mBAAmB,QAAQ;AACpC,SAASC,0BAA0B,QAAQ;AAE3C,IAAIC,wCAAA,GAG8BC,MAAC,CAChCC,mDAAmD;AAEtD,IAAI,CAACF,wCAAA,EAA0C;EAC7CA,wCAAA,GAA2CC,MACzC,CACAC,mDAAmD,GAAG;AAC1D;AAEA,OAAO,MAAMC,+BAAA,GAAkC,MAAOC,IAAA;EAIpD,MAAM;IAAEC,MAAM;IAAEC;EAAiB,CAAE,GAAGF,IAAA;EAEtC,IAAIJ,wCAAA,EAA0C;IAC5C,OAAO,MAAMA,wCAAA;EACf;EAEAA,wCAAA,GAA2CD,0BAAA,CACzCD,mBAAA,EACAO,MAAA,EACAC,iBAAA;EAEAL,MAAA,CAAeM,kDAAkD,GACjEP,wCAAA;EAEFA,wCAAA,GAA2C,MAAMA,wCAAA;EAC/CC,MAAA,CAAeM,kDAAkD,GACjEP,wCAAA;EAEF,OAAOA,wCAAA;AACT","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/richtext-lexical",
3
- "version": "4.0.0-internal.f05c47f",
3
+ "version": "4.0.0-internal.f715c6e",
4
4
  "description": "The officially supported Lexical richtext adapter for Payload",
5
5
  "homepage": "https://payloadcms.com",
6
6
  "repository": {
@@ -443,8 +443,8 @@
443
443
  "react-error-boundary": "6.1.1",
444
444
  "ts-essentials": "10.0.3",
445
445
  "uuid": "14.0.0",
446
- "@payloadcms/translations": "4.0.0-internal.f05c47f",
447
- "@payloadcms/ui": "4.0.0-internal.f05c47f"
446
+ "@payloadcms/translations": "4.0.0-internal.f715c6e",
447
+ "@payloadcms/ui": "4.0.0-internal.f715c6e"
448
448
  },
449
449
  "devDependencies": {
450
450
  "@babel/cli": "7.27.2",
@@ -464,14 +464,14 @@
464
464
  "esbuild-sass-plugin": "3.3.1",
465
465
  "swc-plugin-transform-remove-imports": "8.3.0",
466
466
  "@payloadcms/eslint-config": "3.28.0",
467
- "payload": "4.0.0-internal.f05c47f"
467
+ "payload": "4.0.0-internal.f715c6e"
468
468
  },
469
469
  "peerDependencies": {
470
470
  "@faceless-ui/modal": "3.0.1",
471
471
  "@faceless-ui/scroll-info": "2.0.0",
472
472
  "react": "^19.0.1 || ^19.1.2 || ^19.2.1",
473
473
  "react-dom": "^19.0.1 || ^19.1.2 || ^19.2.1",
474
- "payload": "4.0.0-internal.f05c47f"
474
+ "payload": "4.0.0-internal.f715c6e"
475
475
  },
476
476
  "engines": {
477
477
  "node": ">=24.15.0"
@@ -1,2 +0,0 @@
1
- "use client";import{b as Be,c as Oe,e as $,f as K,h as Ie,i as Fe,j as $e,k as Ke,l as Se,m as Pe,n as ze}from"./chunk-LN6VX25I.js";import{a as Ae,b as P}from"./chunk-RJ5MAOKZ.js";import{jsx as D,jsxs as le}from"react/jsx-runtime";import{BulkUploadProvider as rn,FieldDescription as nn,FieldError as sn,FieldLabel as ln,isFieldRTL as an,RenderCustomComponent as At,useConfig as cn,useEditDepth as un,useEffectEvent as dn,useField as fn,useLocale as mn}from"@payloadcms/ui";import{mergeFieldStyles as pn}from"@payloadcms/ui/shared";import{dequal as gn}from"dequal/lite";import Bt,{useCallback as Ot,useEffect as It,useMemo as hn,useState as Ft}from"react";import{ErrorBoundary as yn}from"react-error-boundary";import"./bundled.css";import{jsx as z}from"react/jsx-runtime";import{LexicalComposer as Ur}from"@lexical/react/LexicalComposer.js";import{useEditDepth as Jr}from"@payloadcms/ui";import*as _t from"react";import{useMemo as qr}from"react";import{c as Lr}from"react/compiler-runtime";import{jsx as E,jsxs as se}from"react/jsx-runtime";import{useLexicalComposerContext as Mr}from"@lexical/react/LexicalComposerContext.js";import{LexicalErrorBoundary as Ar}from"@lexical/react/LexicalErrorBoundary.js";import{HistoryPlugin as Br}from"@lexical/react/LexicalHistoryPlugin.js";import{OnChangePlugin as Or}from"@lexical/react/LexicalOnChangePlugin.js";import{RichTextPlugin as Ir}from"@lexical/react/LexicalRichTextPlugin.js";import{useLexicalEditable as Fr}from"@lexical/react/useLexicalEditable";import{BLUR_COMMAND as $r,COMMAND_PRIORITY_LOW as Rt,FOCUS_COMMAND as Kr}from"lexical";import*as Q from"react";import{useEffect as zr,useState as jr}from"react";import{jsx as je}from"react/jsx-runtime";import"react";var j=({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 jt}from"react/compiler-runtime";import{copyToClipboard as He}from"@lexical/clipboard";import{useLexicalComposerContext as Ht}from"@lexical/react/LexicalComposerContext.js";import{objectKlassEquals as Vt}from"@lexical/utils";import Ve from"bson-objectid";import{$getSelection as Wt,$isNodeSelection as Yt,COMMAND_PRIORITY_LOW as Gt,COPY_COMMAND as Ut}from"lexical";import{useEffect as Jt}from"react";var Te=e=>{if("fields"in e&&typeof e.fields=="object"&&e.fields!==null&&"id"in e.fields?e.fields.id=new Ve.default().toHexString():"id"in e&&(e.id=new Ve.default().toHexString()),e.children)for(let t of e.children)Te(t)};function We(){let e=jt(3),[t]=Ht(),o,n;return e[0]!==t?(o=()=>t.registerCommand(Ut,r=>{let a=Wt();if(Yt(a)){let l=a.getNodes()[0]?.exportJSON(),u=JSON.parse(JSON.stringify(l));Te(u);let d={namespace:t._config.namespace,nodes:[u]},m=JSON.stringify(d);return He(t,null,{"application/x-lexical-editor":m,"text/plain":""}).catch(qt),!0}return He(t,Vt(r,ClipboardEvent)?r:null).then(()=>{if(!(r instanceof ClipboardEvent)||!r.clipboardData)throw new Error("No clipboard event");let s=r.clipboardData.getData("application/x-lexical-editor");if(!s)return!0;let l=JSON.parse(s);for(let d of l.nodes)Te(d);let u=JSON.stringify(l);r.clipboardData.setData("application/x-lexical-editor",u)}).catch(s=>{throw r instanceof ClipboardEvent&&r.clipboardData?.setData("application/x-lexical-editor",""),s}),!0},Gt),n=[t],e[0]=t,e[1]=o,e[2]=n):(o=e[1],n=e[2]),Jt(o,n),null}function qt(e){throw e}import{c as Qt}from"react/compiler-runtime";import{useLexicalComposerContext as Xt}from"@lexical/react/LexicalComposerContext";import{$findMatchingParent as fe,mergeRegister as Zt}from"@lexical/utils";import{$createNodeSelection as eo,$getEditor as oe,$getNearestNodeFromDOMNode as to,$getSelection as me,$isDecoratorNode as H,$isElementNode as Re,$isLineBreakNode as oo,$isNodeSelection as pe,$isRangeSelection as Ye,$isRootOrShadowRoot as ro,$isTextNode as no,$setSelection as Ge,CLICK_COMMAND as io,COMMAND_PRIORITY_LOW as Y,KEY_ARROW_DOWN_COMMAND as so,KEY_ARROW_UP_COMMAND as lo,KEY_BACKSPACE_COMMAND as ao,KEY_DELETE_COMMAND as co,SELECTION_CHANGE_COMMAND as uo}from"lexical";import{useEffect as fo}from"react";function Ue(){let e=Qt(3),[t]=Xt(),o=Co,n,r;return e[0]!==t?(n=()=>Zt(t.registerCommand(io,xo,Y),t.registerCommand(co,o,Y),t.registerCommand(ao,o,Y),t.registerCommand(uo,yo,Y),t.registerCommand(lo,go,Y),t.registerCommand(so,mo,Y)),r=[t],e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]),fo(n,r),null}function mo(e){let t=me();if(pe(t)){e.preventDefault();let s=t.getNodes()[0]?.getNextSibling();if(H(s)){let d=oe().getElementByKey(s.getKey());return d&&re({element:d,node:s}),!0}if(!Re(s))return!0;let l=s.getFirstDescendant()??s;return l&&(fe(l,ge)?.selectEnd(),e.preventDefault()),!0}if(!Ye(t))return!1;let n=(t.isBackward()?t.anchor:t.focus).getNode(),r=fe(n,po),a=r?.getNextSibling();if(!r||a!==Je(r))return!1;if(H(a)){let s=oe().getElementByKey(a.getKey());if(s)return re({element:s,node:a}),e.preventDefault(),!0}return!1}function po(e){return Je(e)!==null}function go(e){let t=me();if(pe(t)){let s=t.getNodes()[0]?.getPreviousSibling();if(H(s)){let d=oe().getElementByKey(s.getKey());return d?(re({element:d,node:s}),e.preventDefault(),!0):!1}if(!Re(s))return!1;let l=s.getLastDescendant()??s;return l?(fe(l,ge)?.selectStart(),e.preventDefault(),!0):!1}if(!Ye(t))return!1;let n=(t.isBackward()?t.anchor:t.focus).getNode(),r=fe(n,ho),a=r?.getPreviousSibling();if(!r||a!==qe(r))return!1;if(H(a)){let s=oe().getElementByKey(a.getKey());if(s)return re({element:s,node:a}),e.preventDefault(),!0}return!1}function ho(e){return qe(e)!==null}function yo(){let e=No();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"]')?Ge(null):re(t),!0}function Co(e){let t=me();return pe(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=to(t);return H(o)?{element:t,node:o}:void 0}function No(){let e=me();if(!pe(e))return;let t=e.getNodes();if(t.length!==1)return;let o=t[0];return H(o)?{decorator:o,element:oe().getElementByKey(o.getKey())}:void 0}function re({element:e,node:t}){document.querySelector(".decorator-selected")?.classList.remove("decorator-selected");let o=eo();o.add(t.getKey()),Ge(o),e.scrollIntoView({behavior:"smooth",block:"nearest"}),e.classList.add("decorator-selected")}function ge(e){if(H(e)&&!e.isInline())return!0;if(!Re(e)||ro(e))return!1;let t=e.getFirstChild(),o=t===null||oo(t)||no(t)||t.isInline();return!e.isInline()&&e.canBeEmpty()!==!1&&o}function Je(e){let t=e.getNextSibling();for(;t!==null;){if(ge(t))return t;t=t.getNextSibling()}return null}function qe(e){let t=e.getPreviousSibling();for(;t!==null;){if(ge(t))return t;t=t.getPreviousSibling()}return null}import{jsx as ke}from"react/jsx-runtime";import{useLexicalComposerContext as ko}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as _o,isHTMLElement as vo}from"lexical";import*as et from"react";import{useCallback as Do,useEffect as Ze,useRef as Lo,useState as Mo}from"react";import{createPortal as Ao}from"react-dom";var G=(e,t,o,n,r=50,a=25)=>{let s=0;if(e&&!e.contains(n)){let{bottom:l,left:u,right:d,top:m}=e.getBoundingClientRect(),c=m+window.scrollY,i=l+window.scrollY;if(o<c-a||o>i+a||t<u-r||t>d+r)return-1;(t<u||t>d)&&(s=t<u?t-u:t-d)}return s};import{$getNodeByKey as ye}from"lexical";function U(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 he(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"),s=Math.max(parseFloat(n),r);return{marginBottom:Math.max(parseFloat(o),a),marginTop:s}}import{$getRoot as wo}from"lexical";function V(e){return e.getEditorState().read(()=>wo().getChildrenKeys())}var So=1,Po=-1,Qe=0,B={props:null,result:null};function To(e,t,o=20){let n=e.x-t.x,r=e.y-t.y;return n*n+r*r<=o*o}function J(e){let{anchorElem:t,cache_threshold:o=20,editor:n,fuzzy:r=!1,horizontalOffset:a=0,point:{x:s,y:l},startIndex:u=0,useEdgeAsDefault:d=!1}=e;if(o>0&&B.props&&B.result&&B.props.fuzzy===e.fuzzy&&B.props.horizontalOffset===e.horizontalOffset&&B.props.useEdgeAsDefault===e.useEdgeAsDefault&&To(B.props.point,e.point,o))return B.result;let m=t.getBoundingClientRect(),c=V(n),i={blockElem:null,blockNode:null,distance:1/0,foundAtIndex:-1,isFoundNodeEmptyParagraph:!1};return n.getEditorState().read(()=>{if(d){let p=n.getElementByKey(c[0]),g=n.getElementByKey(c[c.length-1]);if(p&&g){let[f,C]=[U(p),U(g)];if(l<f.top?(i.blockElem=p,i.distance=f.top-l,i.blockNode=ye(c[0]),i.foundAtIndex=0):l>C.bottom&&(i.distance=l-C.bottom,i.blockNode=ye(c[c.length-1]),i.blockElem=g,i.foundAtIndex=c.length-1),i?.blockElem)return{blockElem:null,isFoundNodeEmptyParagraph:!1}}}let x=u,y=Qe;for(;x>=0&&x<c.length;){let p=c[x],g=n.getElementByKey(p);if(g===null)break;let f=new K(s+a,l),C=Ke.fromDOMRect(U(g)),{marginBottom:h,marginTop:b}=he(g),_=C.generateNewRect({bottom:C.bottom+h,left:m.left,right:m.right,top:C.top-b}),{distance:w,isOnBottomSide:k,isOnTopSide:L}=_.distanceFromPoint(f);if(w===0){i.blockElem=g,i.blockNode=ye(p),i.foundAtIndex=x,i.distance=w,i.blockNode&&i.blockNode.getType()==="paragraph"&&i.blockNode.getTextContent()===""&&(!r&&!e.returnEmptyParagraphs&&(i.blockElem=null,i.blockNode=null),i.isFoundNodeEmptyParagraph=!0);break}else r&&w<i.distance&&(i.blockElem=g,i.blockNode=ye(p),i.distance=w,i.foundAtIndex=x);y===Qe&&(L?y=Po:k?y=So:y=1/0),x+=y}}),B.props=e,B.result={blockElem:i.blockElem,blockNode:i.blockNode,foundAtIndex:i.foundAtIndex,isFoundNodeEmptyParagraph:i.isFoundNodeEmptyParagraph},{blockElem:i.blockElem,blockNode:i.blockNode,foundAtIndex:i.foundAtIndex,isFoundNodeEmptyParagraph:i.isFoundNodeEmptyParagraph}}function xe(e,t){return!!e.closest(`.${t}`)}var Ro=["IMG","INPUT","TEXTAREA","SELECT","BUTTON","VIDEO","OBJECT","EMBED","IFRAME","HR"];function Xe(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 Ce(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),s=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=Xe(e)?parseInt(a.lineHeight,10):0;u=r.top+(c-s.height)/2-l.top}let m=n;t.style.opacity="1",t.style.transform=`translate(${m}px, ${u}px)`}var Bo="add-block-menu",Ee=1/0;function Oo(e){return e===0?1/0:Ee>=0&&Ee<e?Ee:Math.floor(e/2)}function Io(e,t,o){let n=t.parentElement,{editorConfig:r}=P(),a=r?.admin?.hideGutter?-24:12,s=Lo(null),[l,u]=Mo(null);Ze(()=>{function m(c){let i=c.target;if(!vo(i))return;let x=G(n,c.pageX,c.pageY,i);if(x===-1){u(null);return}if(xe(i,Bo))return;let y=V(e),{blockElem:p,blockNode:g,foundAtIndex:f}=J({anchorElem:t,cache_threshold:0,editor:e,horizontalOffset:-x,point:new K(c.x,c.y),returnEmptyParagraphs:!0,startIndex:Oo(y.length),useEdgeAsDefault:!1});Ee=f,p&&g&&(l?.node!==g||l?.elem!==p)&&u({elem:p,node:g})}return document?.addEventListener("mousemove",m),()=>{document?.removeEventListener("mousemove",m)}},[n,t,e,l]),Ze(()=>{s.current&&l?.node&&Ce(l?.elem,s.current,t,a)},[t,l,a]);let d=Do(m=>{let c=l;c?.node&&(e.update(()=>{let i=!0;if((c?.node.getType()!=="paragraph"||c.node.getTextContent()!=="")&&(i=!1),!i){let x=_o();c?.node.insertAfter(x),setTimeout(()=>{c={elem:e.getElementByKey(x.getKey()),node:x},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(Fe,{node:c?.node})},2),m.stopPropagation(),m.preventDefault())},[e,l]);return Ao(ke(et.Fragment,{children:ke("button",{"aria-label":"Add block",className:"icon add-block-menu",onClick:m=>{d(m)},ref:s,type:"button",children:ke("div",{className:o?"icon":""})})}),t)}function tt(e){let{anchorElem:t}=e,o=t===void 0?document.body:t,[n]=ko();return Io(n,o,n._editable)}import{jsx as be,jsxs as $o}from"react/jsx-runtime";import{useLexicalComposerContext as Ko}from"@lexical/react/LexicalComposerContext.js";import{eventFiles as nt}from"@lexical/rich-text";import{$getNearestNodeFromDOMNode as it,$getNodeByKey as zo,isHTMLElement as _e}from"lexical";import*as ut from"react";import{useEffect as ve,useRef as ne,useState as st}from"react";import{createPortal as jo}from"react-dom";var ot=0,Fo=-24;var W=0;function rt(e,t,o,n,r,a,s,l,u,d=!1){let{height:m,top:c}=n.getBoundingClientRect(),{top:i,width:x}=s.getBoundingClientRect(),{marginBottom:y,marginTop:p}=he(n),g=c,f=a>=c+m/2+window.scrollY,C=!1;if(r?.elem)if(n!==r?.elem)(f&&r?.elem&&r?.elem===n.nextElementSibling||!f&&r?.elem&&r?.elem===n.previousElementSibling)&&(W++,W<200&&(C=!0));else{W++;let w=r?.boundingBox?.y,k=n.getBoundingClientRect().y;(f===r?.isBelow&&w===k||W<200)&&(C=!1)}if(C)return{isBelow:f,willStayInSamePosition:C};d?g+=m/2:f?g+=m+y/2:g-=p/2;let h=0;d||(f?h=-ot:h=ot);let b=g-i+h,_=Fo-t;return o.style.width=`calc(${x}px - ${e} - var(--spacer-5))`,o.style.opacity=".8",o.style.transform=`translate(${_}px, calc(${b}px - 2px))`,r?.elem&&(r.elem.style.opacity="",r?.elem===n?f?r.elem.style.marginTop="":r.elem.style.marginBottom="":(r.elem.style.marginBottom="",r.elem.style.marginTop="")),W=0,{isBelow:f,willStayInSamePosition:C}}var Ho="draggable-block-menu",lt="application/x-lexical-drag-block",ie=1/0;function at(e){return e===0?1/0:ie>=0&&ie<e?ie:Math.floor(e/2)}function Vo(e,t){let{transform:o}=t.style;e.setDragImage(t,0,0),setTimeout(()=>{t.style.transform=o})}function ct(e,t){e&&(e.style.opacity="0"),t&&(t.style.opacity="",t.style.marginBottom="",t.style.marginTop="")}function Wo(e,t,o){let n=t.parentElement,r=ne(null),a=ne(null),s=ne(null),l=ne(!1),u=ne([]),[d,m]=st(null),[c,i]=st(null),{editorConfig:x}=P(),y=x?.admin?.hideGutter?-44:-8;ve(()=>{function f(C){let h=C.target;if(!_e(h))return;let b=G(n,C.pageX,C.pageY,h);if(b===-1){m(null);return}if(xe(h,Ho))return;let _=V(e),{blockElem:w,foundAtIndex:k,isFoundNodeEmptyParagraph:L}=J({anchorElem:t,cache_threshold:0,editor:e,horizontalOffset:-b,point:new K(C.x,C.y),startIndex:at(_.length),useEdgeAsDefault:!1,verbose:!1});ie=k,!(!w&&!L)&&d!==w&&m(w)}return document?.addEventListener("mousemove",f),()=>{document?.removeEventListener("mousemove",f)}},[n,t,e,d]),ve(()=>{r.current&&Ce(d,r.current,t,y)},[t,d,y]),ve(()=>{function f(h){if(!l.current)return!1;let[b]=nt(h);if(b)return!1;let{pageY:_,target:w}=h;if(!_e(w))return!1;let k=G(n,h.pageX,h.pageY,w,100,50),L=V(e),{blockElem:S,foundAtIndex:I,isFoundNodeEmptyParagraph:R}=J({anchorElem:t,editor:e,fuzzy:!0,horizontalOffset:-k,point:new K(h.x,h.y),startIndex:at(L.length),useEdgeAsDefault:!0,verbose:!0});ie=I;let F=a.current;if(S===null||F===null)return!1;if(h.preventDefault(),h.dataTransfer.dropEffect="move",d!==S){let{isBelow:v,willStayInSamePosition:M}=rt(x?.admin?.hideGutter?"0px":"var(--spacer-5)",y+(x?.admin?.hideGutter?r?.current?.getBoundingClientRect()?.width??0:-(r?.current?.getBoundingClientRect()?.width??0)),F,S,c,_,t,h,s,R);M||i({boundingBox:S.getBoundingClientRect(),elem:S,isBelow:v})}else c?.elem&&(ct(F,c.elem),i({boundingBox:S.getBoundingClientRect(),elem:S,isBelow:!1}));return!0}function C(h){if(!l.current)return!1;let[b]=nt(h);if(b)return!1;let{dataTransfer:_,pageY:w,target:k}=h,L=_?.getData(lt)||"";return e.update(()=>{let S=zo(L);if(!S||!_e(k))return!1;let I=G(n,h.pageX,h.pageY,k,100,50),{blockElem:R,isFoundNodeEmptyParagraph:F}=J({anchorElem:t,editor:e,fuzzy:!0,horizontalOffset:-I,point:new K(h.x,h.y),useEdgeAsDefault:!0});if(!R)return!1;let v=it(R);if(!v)return!1;if(v===S)return!0;let{height:M,top:ae}=U(R),Ne=w>=ae+M/2+window.scrollY;F?(v.insertBefore(S),v.remove()):Ne?v.insertAfter(S):v.insertBefore(S),d!==null&&m(null),document.querySelectorAll(".lexical-block-highlighter").forEach(T=>{T.remove()});let we=e.getElementByKey(S.getKey()),ce=setTimeout(()=>{let T=we?.getBoundingClientRect();if(!T)return;let N=document.createElement("div");N.className="lexical-block-highlighter",N.style.backgroundColor="var(--color-bg-inverse)",N.style.transition="opacity 0.5s ease-in-out",N.style.zIndex="1",N.style.pointerEvents="none",N.style.boxSizing="border-box",N.style.borderRadius="4px",N.style.position="absolute",document.body.appendChild(N),N.style.opacity="0.1",N.style.height=`${T.height+8}px`,N.style.width=`${T.width+8}px`,N.style.top=`${T.top+window.scrollY-4}px`,N.style.left=`${T.left-4}px`;let ue=setTimeout(()=>{N.style.opacity="0";let de=setTimeout(()=>{N.remove()},500);u.current.push(de)},1e3);u.current.push(ue)},120);u.current.push(ce)}),!0}return document.addEventListener("dragover",f),document.addEventListener("drop",C),()=>{document.removeEventListener("dragover",f),document.removeEventListener("drop",C),u.current.forEach(clearTimeout),u.current=[]}},[n,y,t,e,c,d,x?.admin?.hideGutter]);function p(f){let C=f.dataTransfer;if(!C||!d)return;Vo(C,d),C.effectAllowed="move";let h="";e.update(()=>{let b=it(d);b&&(h=b.getKey())}),l.current=!0,C.setData(lt,h)}function g(){l.current=!1,c?.elem&&ct(a.current,c?.elem)}return jo($o(ut.Fragment,{children:[be("button",{"aria-label":"Drag to move",className:"icon draggable-block-menu",draggable:!0,onDragEnd:g,onDragStart:p,ref:r,type:"button",children:be("div",{className:o?"icon":""})}),be("div",{className:"draggable-block-target-line",ref:a}),be("div",{className:"debug-highlight",ref:s})]}),t)}function dt(e){let{anchorElem:t}=e,o=t===void 0?document.body:t,[n]=Ko();return Wo(n,o,n._editable)}import{c as Yo}from"react/compiler-runtime";import{jsx as De}from"react/jsx-runtime";import{useLexicalComposerContext as Go}from"@lexical/react/LexicalComposerContext";import{useTranslation as Uo}from"@payloadcms/ui";import{$createParagraphNode as Jo,$getRoot as qo}from"lexical";import"react";var ft="insert-paragraph-at-end",mt=()=>{let e=Yo(5),[t]=Go(),{editorConfig:o}=P(),{t:n}=Uo();if(o?.admin?.hideInsertParagraphAtEnd)return null;let r;e[0]!==t?(r=()=>{t.update(Qo)},e[0]=t,e[1]=r):r=e[1];let a=r,s;return e[2]!==a||e[3]!==n?(s=De("button",{"aria-label":n("lexical:general:insertParagraph"),className:ft,onClick:a,type:"button",children:De("span",{className:`${ft}-inside`,children:De(Be,{size:16})})}),e[2]=a,e[3]=n,e[4]=s):s=e[4],s};function Qo(){let e=Jo();qo().append(e),e.select()}import{c as Xo}from"react/compiler-runtime";import{registerMarkdownShortcuts as Zo}from"@lexical/markdown";import{useLexicalComposerContext as er}from"@lexical/react/LexicalComposerContext";import*as pt from"react";var gt=()=>{let e=Xo(4),{editorConfig:t}=P(),[o]=er(),n,r;return e[0]!==o||e[1]!==t.features.markdownTransformers?(n=()=>Zo(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]),pt.useEffect(n,r),null};import{c as tr}from"react/compiler-runtime";import{useLexicalComposerContext as or}from"@lexical/react/LexicalComposerContext.js";import{$getRoot as rr}from"lexical";import{useEffect as nr}from"react";function ir(e){e.update(()=>{let t=o=>{let n=o.getType();if((n==="block"||n==="inlineBlock")&&o.markDirty(),"getChildren"in o&&typeof o.getChildren=="function")for(let r of o.getChildren())t(r)};t(rr())})}function ht(){let e=tr(5),[t]=or(),{currentView:o,views:n}=$(),r,a;return e[0]!==o||e[1]!==t||e[2]!==n?(r=()=>{n&&(o==="default"?n.default?Se(t,n.default?.nodes):Pe(t):n[o]&&(Pe(t),Se(t,n[o]?.nodes)),ir(t))},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]),nr(r,a),null}import{useLexicalComposerContext as sr}from"@lexical/react/LexicalComposerContext";import{$getSelection as lr,$isRangeSelection as ar,RootNode as cr}from"lexical";import{useEffect as ur}from"react";function yt(){let[e]=sr();return ur(()=>e.registerNodeTransform(cr,t=>{let o=lr();if(ar(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 dr}from"@lexical/react/LexicalComposerContext";import{$getSelection as fr,COMMAND_PRIORITY_LOW as mr,SELECT_ALL_COMMAND as pr}from"lexical";import{useEffect as gr}from"react";function xt(){let[e]=dr();return gr(()=>e.registerCommand(pr,()=>{if(fr())return!1;let o=document.activeElement;return o instanceof HTMLInputElement&&o.select(),!0},mr),[e]),null}import{jsx as q,jsxs as Et}from"react/jsx-runtime";import{useLexicalComposerContext as yr}from"@lexical/react/LexicalComposerContext.js";import{useTranslation as bt}from"@payloadcms/ui";import{useCallback as xr,useMemo as Cr,useState as Er}from"react";import"react";import*as Nt from"react-dom";import{c as hr}from"react/compiler-runtime";import"react";function Ct(e,t){let o=hr(4),{maxLength:n,minLength:r}=t,a=n===void 0?75:n,s=r===void 0?1:r,l;return o[0]!==a||o[1]!==s||o[2]!==e?(l=u=>{let{query:d}=u,m="[^"+e+Ie+"\\s]",i=new RegExp("(^|\\s|\\()(["+e+"]((?:"+m+"){0,"+a+"}))$").exec(d);if(i!==null){let x=i[1],y=i[3];if(y.length>=s)return{leadOffset:i.index+x.length,matchingString:y,replaceableString:i[2]}}return null},o[0]=a,o[1]=s,o[2]=e,o[3]=l):l=o[3],l}var O="slash-menu-popup";function br({isSelected:e,item:t,onClick:o,onMouseEnter:n,ref:r}){let{fieldProps:{featureClientSchemaMap:a,schemaPath:s}}=P(),{i18n:l}=bt(),u=`${O}__item ${O}__item-${t.key}`;e&&(u+=` ${O}__item--selected`);let d=t.key;return t.label&&(d=typeof t.label=="function"?t.label({featureClientSchemaMap:a,i18n:l,schemaPath:s}):t.label),d.length>25&&(d=d.substring(0,25)+"..."),Et("button",{"aria-selected":e,className:u,id:O+"__item-"+t.key,onClick:o,onMouseEnter:n,ref:r,role:"option",tabIndex:-1,type:"button",children:[t?.Icon&&q(t.Icon,{}),q("span",{className:`${O}__item-text`,children:d})]},t.key)}function wt({anchorElem:e=document.body}){let[t]=yr(),[o,n]=Er(null),{editorConfig:r}=P(),{i18n:a}=bt(),{fieldProps:{featureClientSchemaMap:s,schemaPath:l}}=P(),u=Ct("/",{minLength:0}),d=xr(()=>{let c=[];for(let i of r.features.slashMenu.dynamicGroups)if(o){let x=i({editor:t,queryString:o});c=c.concat(x)}return c},[t,o,r?.features]),m=Cr(()=>{let c=[];for(let i of r?.features.slashMenu.groups??[])c.push(i);if(o){let i=o.toLowerCase().replace(/[\s\-_]/g,"");c=c.map(y=>{let p=y.items.filter(g=>{let f=g.key;return g.label&&(f=typeof g.label=="function"?g.label({featureClientSchemaMap:s,i18n:a,schemaPath:l}):g.label),new RegExp(o,"gi").exec(f)||f.toLowerCase().replace(/[\s\-_]/g,"").includes(i)?!0:g.keywords!=null?g.keywords.some(h=>new RegExp(o,"gi").exec(h)?!0:h.toLowerCase().replace(/[\s\-_]/g,"").includes(i)):!1});return p.length?{...y,items:p}:null}),c=c.filter(y=>y!=null);let x=d();for(let y of x){let p=c.find(g=>g.key===y.key);p?c=c.filter(g=>g.key!==y.key):p={...y,items:[]},p?.items?.length&&(p.items=p.items.concat(p.items)),c.push(p)}}return c},[o,r?.features.slashMenu.groups,d,s,a,l]);return q($e,{anchorElem:e,groups:m,menuRenderFn:(c,{selectedItemKey:i,selectItemAndCleanUp:x,setSelectedItemKey:y})=>c.current&&m.length?Nt.createPortal(q("div",{className:O,"data-theme":"dark",children:m.map(p=>{let g=p.key;return p.label&&s&&(g=typeof p.label=="function"?p.label({featureClientSchemaMap:s,i18n:a,schemaPath:l}):p.label),Et("div",{className:`${O}__group ${O}__group-${p.key}`,children:[q("div",{className:`${O}__group-title`,children:g}),p.items.map((f,C)=>q(br,{index:C,isSelected:i===f.key,item:f,onClick:()=>{y(f.key),x(f)},onMouseEnter:()=>{y(f.key)},ref:h=>{f.ref={current:h}}},f.key))]},p.key)})}),c.current):null,onQueryChange:n,triggerFn:u})}import{c as Nr}from"react/compiler-runtime";import{useLexicalComposerContext as wr}from"@lexical/react/LexicalComposerContext";import{TEXT_TYPE_TO_FORMAT as Sr,TextNode as Pr}from"lexical";import{useEffect as Tr}from"react";function St(e){let t=Nr(6),{features:o}=e,[n]=wr(),r;t[0]!==n||t[1]!==o.enabledFormats?(r=()=>{let s=Rr(o.enabledFormats);if(s.length!==0)return n.registerNodeTransform(Pr,l=>{s.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],Tr(r,a),null}function Rr(e){let t=Object.keys(Sr),o=new Set(e);return t.filter(n=>!o.has(n))}import{c as kr}from"react/compiler-runtime";import{jsx as Pt}from"react/jsx-runtime";import{useLexicalComposerContext as _r}from"@lexical/react/LexicalComposerContext";import{ContentEditable as vr}from"@lexical/react/LexicalContentEditable.js";import{useTranslation as Dr}from"@payloadcms/ui";import"react";function Tt(e){let t=kr(5),{className:o,editorConfig:n}=e,{t:r}=Dr(),[,a]=_r(),{getTheme:s}=a,l;if(t[0]!==o||t[1]!==n?.admin?.placeholder||t[2]!==s||t[3]!==r){let u=s();l=Pt(vr,{"aria-placeholder":r("lexical:general:placeholder"),className:o??"ContentEditable__root",placeholder:Pt("p",{className:u?.placeholder,children:n?.admin?.placeholder??r("lexical:general:placeholder")})}),t[0]=o,t[1]=n?.admin?.placeholder,t[2]=s,t[3]=r,t[4]=l}else l=t[4];return l}var kt=e=>{let t=Lr(13),{editorConfig:o,editorContainerRef:n,isSmallWidthViewport:r,onChange:a,rtl:s}=e,l=P(),[u]=Mr(),d=Fr(),[m,c]=jr(null),i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=f=>{f!==null&&c(f)},t[0]=i):i=t[0];let x=i,y,p;t[1]!==u||t[2]!==l?(y=()=>{if(!l?.uuid){console.error("Lexical Editor must be used within an EditorConfigProvider");return}l?.parentEditor?.uuid&&l.parentEditor?.registerChild(l.uuid,l);let f=()=>{l.focusEditor(l)},C=()=>{l.blurEditor(l)},h=u.registerCommand(Kr,()=>(f(),!0),Rt),b=u.registerCommand($r,()=>(C(),!0),Rt);return()=>{h(),b(),l.parentEditor?.unregisterChild?.(l.uuid)}},p=[u,l],t[1]=u,t[2]=l,t[3]=y,t[4]=p):(y=t[3],p=t[4]),zr(y,p);let g;return t[5]!==o||t[6]!==n||t[7]!==m||t[8]!==d||t[9]!==r||t[10]!==a||t[11]!==s?(g=se(Q.Fragment,{children:[o.features.plugins?.map(Hr),se("div",{className:"editor-container",dir:s?"rtl":void 0,ref:n,children:[o.features.plugins?.map(Vr),E(Ir,{contentEditable:E("div",{className:"editor-scroller",children:E("div",{className:"editor",ref:x,children:E(Tt,{editorConfig:o})})}),ErrorBoundary:Ar}),E(yt,{}),d&&E(mt,{}),E(Ue,{}),E(We,{}),E(St,{features:o.features}),E(xt,{}),E(ht,{}),d&&E(Or,{ignoreSelectionChange:!0,onChange:(f,C,h)=>{(!h.has("focus")||h.size>1)&&a?.(f,C,h)}}),m&&se(Q.Fragment,{children:[!r&&d&&se(Q.Fragment,{children:[o.admin?.hideDraggableBlockElement?null:E(dt,{anchorElem:m}),o.admin?.hideAddBlockButton?null:E(tt,{anchorElem:m})]}),o.features.plugins?.map(f=>{if(f.position==="floatingAnchorElem"&&!(f.desktopOnly===!0&&r))return E(j,{anchorElem:m,clientProps:f.clientProps,plugin:f},f.key)}),d&&E(Q.Fragment,{children:E(wt,{anchorElem:m})})]}),d&&se(Q.Fragment,{children:[E(Br,{}),o?.features?.markdownTransformers?.length>0&&E(gt,{})]}),o.features.plugins?.map(Wr),o.features.plugins?.map(Yr)]}),o.features.plugins?.map(Gr)]}),t[5]=o,t[6]=n,t[7]=m,t[8]=d,t[9]=r,t[10]=a,t[11]=s,t[12]=g):g=t[12],g};function Hr(e){if(e.position==="aboveContainer")return E(j,{clientProps:e.clientProps,plugin:e},e.key)}function Vr(e){if(e.position==="top")return E(j,{clientProps:e.clientProps,plugin:e},e.key)}function Wr(e){if(e.position==="normal")return E(j,{clientProps:e.clientProps,plugin:e},e.key)}function Yr(e){if(e.position==="bottom")return E(j,{clientProps:e.clientProps,plugin:e},e.key)}function Gr(e){if(e.position==="belowContainer")return E(j,{clientProps:e.clientProps,plugin:e},e.key)}var vt=({children:e,providers:t})=>{if(!t?.length)return e;let o=t[0];return t.length>1?z(o,{children:z(vt,{providers:t.slice(1),children:e})}):z(o,{children:e})},Dt=e=>{let{composerKey:t,editorConfig:o,fieldProps:n,isSmallWidthViewport:r,onChange:a,readOnly:s,rtl:l,value:u}=e,{currentView:d,views:m}=$(),c=P(),i=Jr(),x=_t.useRef(null),y=qr(()=>{if(u&&typeof u!="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(u));if(u&&Array.isArray(u)&&!("root"in u))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(u&&"jsonContent"in u)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 p=m?.[d]?.nodes;return{editable:s!==!0,editorState:u!=null?JSON.stringify(u):void 0,namespace:o.lexical.namespace,nodes:ze({editorConfig:o,nodeViews:p}),onError:g=>{throw g},theme:o.lexical.theme}},[o,m,d]);return y?z(Ur,{initialConfig:y,children:z(Ae,{editorConfig:o,editorContainerRef:x,fieldProps:n,parentContext:c?.editDepth===i?c:void 0,children:z(vt,{providers:o.features.providers,children:z(kt,{editorConfig:o,editorContainerRef:x,isSmallWidthViewport:r,onChange:a,rtl:l})})})},t+y.editable+d):z("p",{children:"Loading..."})};import{c as Qr}from"react/compiler-runtime";import{jsx as X,jsxs as Xr}from"react/jsx-runtime";import{ChevronIcon as Zr,Popup as en,PopupList as Lt}from"@payloadcms/ui";import"react";function Mt(){let e=Qr(5),{currentView:t,setCurrentView:o,views:n}=$();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 s=Object.keys(n);if(!s.some(on)){a=null;break e}let u=["default",...s.filter(tn)],d=t.charAt(0).toUpperCase()+t.slice(1);r=X("div",{className:"lexical-view-selector",children:X(en,{button:Xr("button",{className:"lexical-view-selector__button",type:"button",children:[X("span",{className:"lexical-view-selector__label",children:d}),X(Zr,{className:"lexical-view-selector__icon"})]}),buttonType:"custom",horizontalAlign:"left",render:m=>{let{close:c}=m;return X(Lt.ButtonGroup,{children:u.map(i=>{let x=i.charAt(0).toUpperCase()+i.slice(1);return X(Lt.Button,{active:i===t,disabled:i===t,onClick:()=>{o?.(i),c()},children:x},i)})})},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 tn(e){return e!=="default"}function on(e){return e!=="default"}var Z="rich-text-lexical",xn=e=>{let{editorConfig:t,field:o,field:{admin:{className:n,description:r,readOnly:a}={},label:s,localized:l,required:u},path:d,readOnly:m,schemaPath:c,validate:i}=e,x=m||a,y=mn(),{config:{localization:p}}=cn(),g=an({fieldLocalized:l,locale:y,localizationConfig:p||void 0}),f=un(),{isControlledByParent:C}=$(),h=Ot((A,te)=>typeof i=="function"?i(A,{...te,required:u}):!0,[i,u]),{customComponents:{AfterInput:b,BeforeInput:_,Description:w,Error:k,Label:L}={},disabled:S,initialValue:I,path:R,setValue:F,showError:v,value:M}=fn({potentiallyStalePath:d,validate:h}),ae=x||S,[ee,Ne]=Ft(!1),[Le,we]=Ft(),ce=Bt.useRef(I),T=Bt.useRef(M);It(()=>{let A=()=>{let te=window.matchMedia("(max-width: 768px)").matches;te!==ee&&Ne(te)};return A(),window.addEventListener("resize",A),()=>{window.removeEventListener("resize",A)}},[ee]);let N=["field-type",Z,n,v&&"error",ae&&`${Z}--read-only`,t?.admin?.hideGutter!==!0&&!ee?`${Z}--show-gutter`:null].filter(Boolean).join(" "),ue=`${R}.${f}`,de=Oe(),$t=Ot(A=>{de(()=>{let Me=A.toJSON();T.current=Me,F(Me)})},[F,de]),Kt=hn(()=>pn(o),[o]),zt=dn(A=>{T.current!==M&&!gn(T.current!=null?JSON.parse(JSON.stringify(T.current)):T.current,M)&&(ce.current=A,T.current=M,we(new Date))});return It(()=>{Object.is(I,ce.current)||zt(I)},[I]),le("div",{className:N,"data-field-path":R,"data-field-schemapath":c,"data-lexical-view":t?.view,style:Kt,children:[le("div",{className:`${Z}__label-row`,children:[L||D(ln,{label:s,localized:l,path:R,required:u}),!C&&D(Mt,{})]}),le("div",{className:`${Z}__wrap`,children:[D(At,{CustomComponent:k,Fallback:D(sn,{path:R,showError:v})}),le(yn,{fallbackRender:Cn,onReset:()=>{},children:[_,D("div",{className:`${Z}__editor-content`,children:D(rn,{modalSlugPrefix:`lexical-${R}`,children:D(Dt,{composerKey:ue,editorConfig:t,fieldProps:e,isSmallWidthViewport:ee,onChange:$t,readOnly:ae,rtl:g,value:M},JSON.stringify({path:R,rerenderProviderKey:Le}))})}),b]}),D(At,{CustomComponent:w,Fallback:D(nn,{description:r,path:R})})]})]},ue)};function Cn({error:e}){return le("div",{className:"errorBoundary",role:"alert",children:[D("p",{children:"Something went wrong:"}),D("pre",{style:{color:"red"},children:e instanceof Error?e.message:String(e)})]})}var Ll=xn;export{Ll as RichText};
2
- //# sourceMappingURL=Field-F22V5L4V.js.map
@@ -1,2 +0,0 @@
1
- var P=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";import{c as le}from"react/compiler-runtime";import{useRef as ae}from"react";function Ze(o){let e=le(2),n=o===void 0?500:o,i=ae(void 0),t;return e[0]!==n?(t=c=>new Promise(a=>{let s=()=>{c(),a()};"requestIdleCallback"in window?("cancelIdleCallback"in window&&i.current!==void 0&&cancelIdleCallback(i.current),i.current=requestIdleCallback(s,{timeout:n})):ue().then(s)}),e[0]=n,e[1]=t):t=e[1],t}function ue(){return new Promise(o=>{setTimeout(o,100),requestAnimationFrame(()=>{setTimeout(o,0)})})}import{jsx as fe}from"react/jsx-runtime";import{useControllableState as de}from"@payloadcms/ui";import{createContext as he,use as me,useMemo as pe}from"react";var V=he({currentView:"default",inheritable:!1,setCurrentView:()=>{}}),rt=o=>{let e=ge(),n=o.currentView!==void 0,i=e.inheritable&&(!!e.views||!!e.hasExplicitCurrentView),t=n||e.inheritable&&!!e.hasExplicitCurrentView,{children:r,currentView:c,inheritable:a,views:s}={children:o.children,currentView:i?e.currentView:o.currentView,inheritable:e.inheritable||o.inheritable,views:i&&e.views?e.views:o.views},[f,d]=de(c,"default"),h=s&&f!=="default"&&!s[f]?"default":f,m=pe(()=>{let y=s?s[h]:void 0;return{currentView:h,currentViewMap:y,hasExplicitCurrentView:t,inheritable:a,isControlledByParent:i,setCurrentView:d,views:s}},[h,a,t,i,d,s]);return fe(V,{value:m,children:r})};function ge(){return me(V)}var T=class{_x;_y;constructor(e,n){this._x=e,this._y=n}calcDeltaXTo({x:e}){return this.x-e}calcDeltaYTo({y:e}){return this.y-e}calcDistanceTo(e){return Math.sqrt(Math.pow(this.calcDeltaXTo(e),2)+Math.pow(this.calcDeltaYTo(e),2))}calcHorizontalDistanceTo(e){return Math.abs(this.calcDeltaXTo(e))}calcVerticalDistance(e){return Math.abs(this.calcDeltaYTo(e))}equals({x:e,y:n}){return this.x===e&&this.y===n}get x(){return this._x}get y(){return this._y}};function $(o){return o instanceof T}import{jsx as Le}from"react/jsx-runtime";import{useLexicalComposerContext as Be}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Pe}from"@lexical/utils";import{$getSelection as I,$isRangeSelection as N,$isTextNode as Ve,COMMAND_PRIORITY_LOW as $e,createCommand as Ye,getDOMSelection as We}from"lexical";import{useCallback as J,useEffect as G,useState as je}from"react";import*as E from"react";import{c as q}from"react/compiler-runtime";import{useLexicalComposerContext as U}from"@lexical/react/LexicalComposerContext.js";import{getScrollParent as _e,mergeRegister as Y}from"@lexical/utils";import{$getSelection as F,$isRangeSelection as we,$setSelection as ye,COMMAND_PRIORITY_LOW as W,COMMAND_PRIORITY_NORMAL as C,createCommand as Oe,KEY_ARROW_DOWN_COMMAND as xe,KEY_ARROW_UP_COMMAND as be,KEY_ENTER_COMMAND as Ce,KEY_ESCAPE_COMMAND as Me,KEY_TAB_COMMAND as Se}from"lexical";import{useCallback as v,useEffect as x,useLayoutEffect as Re,useMemo as De,useRef as Te,useState as ve}from"react";var Ee="slash-menu-popup",j=o=>{let e=document.getElementById("slash-menu");if(!e)return;let n=e.getBoundingClientRect();n.top+n.height>window.innerHeight&&e.scrollIntoView({block:"center"}),n.top<0&&e.scrollIntoView({block:"center"}),o.scrollIntoView({block:"nearest"})};function Ie(o,e,n){let i=n;for(let t=i;t<=e.length;t++)o.substring(o.length-t)===e.substring(0,t)&&(i=t);return i}function Ne(o){let e=F();if(!we(e)||!e.isCollapsed())return;let n=e.anchor;if(n.type!=="text")return;let i=n.getNode();if(!i.isSimpleText())return;let t=n.offset,r=i.getTextContent().slice(0,t),c=o.replaceableString.length,a=Ie(r,o.matchingString,c),s=t-a;if(s<0)return;let f;return s===0?[f]=i.splitText(t):[,f]=i.splitText(s,t),f}function H(o,e){let n=o.getBoundingClientRect(),i=e.getBoundingClientRect();return n.top>i.top&&n.top<i.bottom}function ke(o,e,n,i){let t=q(7),[r]=U(),c,a;t[0]!==r||t[1]!==n||t[2]!==i||t[3]!==o||t[4]!==e?(c=()=>{let s=e.current;if(s!=null&&o!=null){let f=r.getRootElement(),d=f!=null?_e(f,!1):document.body,h=!1,m=H(s,d),y=function(){h||(window.requestAnimationFrame(function(){n(),h=!1}),h=!0);let l=H(s,d);l!==m&&(m=l,i?.(l))},u=new ResizeObserver(n);return window.addEventListener("resize",n),document.addEventListener("scroll",y,{capture:!0,passive:!0}),u.observe(s),()=>{u.disconnect(),window.removeEventListener("resize",n),document.removeEventListener("scroll",y,!0)}}},a=[r,i,n,o,e],t[0]=r,t[1]=n,t[2]=i,t[3]=o,t[4]=e,t[5]=c,t[6]=a):(c=t[5],a=t[6]),x(c,a)}var X=Oe("SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND");function K({anchorElementRef:o,close:e,editor:n,groups:i,menuRenderFn:t,resolution:r,shouldSplitNodeWithQuery:c=!1}){let[a,s]=ve(null),f=r.match&&r.match.matchingString||"",d=v(u=>{let l=n.getRootElement();l!==null&&(l.setAttribute("aria-activedescendant",`${Ee}__item-${u.key}`),s(u.key))},[n]),h=v(()=>{if(i!==null&&f!=null){let u=i.flatMap(l=>l.items);if(u.length){let l=u[0];d(l)}}},[i,d,f]);x(()=>{h()},[f,h]);let m=v(u=>{e(),n.update(()=>{let l=r.match!=null&&c?Ne(r.match):null;l&&l.remove()}),setTimeout(()=>{let l;n.read(()=>{l=F()?.clone()}),n.update(()=>{l&&ye(l)}),u.onSelect({editor:n,queryString:r.match?r.match.matchingString:""})},0)},[n,c,r.match,e]);x(()=>()=>{let u=n.getRootElement();u!==null&&u.removeAttribute("aria-activedescendant")},[n]),Re(()=>{i===null?s(null):a===null&&h()},[i,a,d,h]),x(()=>Y(n.registerCommand(X,({item:u})=>u.ref&&u.ref.current!=null?(j(u.ref.current),!0):!1,W)),[n,d]),x(()=>Y(n.registerCommand(xe,u=>{let l=u;if(i!==null&&i.length&&a!==null){let g=i.flatMap(_=>_.items),p=g.findIndex(_=>_.key===a),O=p!==g.length-1?p+1:0,w=g[O];if(!w)return!1;d(w),w.ref!=null&&w.ref.current&&n.dispatchCommand(X,{index:O,item:w}),l.preventDefault(),l.stopImmediatePropagation()}return!0},C),n.registerCommand(be,u=>{let l=u;if(i!==null&&i.length&&a!==null){let g=i.flatMap(_=>_.items),p=g.findIndex(_=>_.key===a),O=p!==0?p-1:g.length-1,w=g[O];if(!w)return!1;d(w),w.ref!=null&&w.ref.current&&j(w.ref.current),l.preventDefault(),l.stopImmediatePropagation()}return!0},C),n.registerCommand(Me,u=>{let l=u;return l.preventDefault(),l.stopImmediatePropagation(),e(),!0},W),n.registerCommand(Se,u=>{let l=u;if(i===null||a===null)return!1;let p=i.flatMap(O=>O.items).find(O=>O.key===a);return p?(l.preventDefault(),l.stopImmediatePropagation(),m(p),!0):!1},C),n.registerCommand(Ce,u=>{if(i===null||a===null)return!1;let g=i.flatMap(p=>p.items).find(p=>p.key===a);return g?(u!==null&&(u.preventDefault(),u.stopImmediatePropagation()),m(g),!0):!1},C)),[m,e,n,i,a,d]);let y=De(()=>({groups:i,selectedItemKey:a,selectItemAndCleanUp:m,setSelectedItemKey:s}),[m,a,i]);return t(o,y,r.match?r.match.matchingString:"")}function Ae(o,e){e!=null&&(o.className=e),o.setAttribute("aria-label","Slash menu"),o.setAttribute("role","listbox"),o.style.display="block",o.style.position="absolute"}function z(o,e,n,i){let t=q(14),[r]=U(),c;t[0]===Symbol.for("react.memo_cache_sentinel")?(c=P?document.createElement("div"):null,t[0]=c):c=t[0];let a=Te(c),s;t[1]!==o||t[2]!==i||t[3]!==r||t[4]!==e?(s=()=>{if(a.current===null||parent===void 0)return;let u=r.getRootElement(),l=a.current,g=l.firstChild;if(u!==null&&e!==null){let{height:p,width:O}=e.getRect(),{left:w,top:_}=e.getRect(),M=_;if(_=_-(o.getBoundingClientRect().top+window.scrollY),w=w-(o.getBoundingClientRect().left+window.scrollX),l.style.left=`${w+window.scrollX}px`,l.style.height=`${p}px`,l.style.width=`${O}px`,g!==null){let S=g.getBoundingClientRect(),A=S.height,R=S.width,D=u.getBoundingClientRect(),L=document.dir==="rtl"||document.documentElement.dir==="rtl",oe=o.getBoundingClientRect(),B=Math.max(0,D.left);if(!L&&w+R>D.right)l.style.left=`${D.right-R+window.scrollX}px`;else if(L&&S.left<B){let ce=B+R-oe.left;l.style.left=`${ce+window.scrollX}px`}let re=M+A+32>window.innerHeight,se=M<0;re&&!se?l.style.top=`${_+32-A+window.scrollY-(p+24)}px`:l.style.top=`${_+window.scrollY+32}px`}l.isConnected||(Ae(l,i),o.append(l)),l.setAttribute("id","slash-menu"),a.current=l,u.setAttribute("aria-controls","slash-menu")}},t[1]=o,t[2]=i,t[3]=r,t[4]=e,t[5]=s):s=t[5];let f=s,d,h;t[6]!==r||t[7]!==f||t[8]!==e?(d=()=>{let u=r.getRootElement();if(e!==null)return f(),()=>{u!==null&&u.removeAttribute("aria-controls");let l=a.current;l!==null&&l.isConnected&&(l.remove(),l.removeAttribute("id"))}},h=[r,f,e],t[6]=r,t[7]=f,t[8]=e,t[9]=d,t[10]=h):(d=t[9],h=t[10]),x(d,h);let m;return t[11]!==e||t[12]!==n?(m=u=>{e!==null&&(u||n(null))},t[11]=e,t[12]=n,t[13]=m):m=t[13],ke(e,a,f,m),a}var xt=`\\.,\\+\\*\\?\\$\\@\\|#{}\\(\\)\\^\\-\\[\\]\\\\/!%'"~=<>_:;`;function He(o){let e=o.anchor;if(e.type!=="text")return null;let n=e.getNode();if(!n.isSimpleText())return null;let i=e.offset;return n.getTextContent().slice(0,i)}function Q(o,e,n){let i=We(n);if(i===null||!i.isCollapsed)return!1;let t=i.anchorNode,r=o,c=i.anchorOffset;if(t==null||c==null)return!1;try{e.setStart(t,r),e.setEnd(t,c>1?c:1)}catch{return!1}return!0}function Xe(o){let e;return o.getEditorState().read(()=>{let n=I();N(n)&&(e=He(n))}),e}function Z(o,e){return e!==0?!1:o.getEditorState().read(()=>{let n=I();if(N(n)){let r=n.anchor.getNode().getPreviousSibling();return Ve(r)&&r.isTextEntity()}return!1})}function ee(o){E.startTransition?E.startTransition(o):o()}var qe=Ye("ENABLE_SLASH_MENU_COMMAND");function bt({anchorClassName:o,anchorElem:e,groups:n,menuRenderFn:i,onClose:t,onOpen:r,onQueryChange:c,triggerFn:a}){let[s]=Be(),[f,d]=je(null),h=z(e,f,d,o),m=J(()=>{d(null),t!=null&&f!==null&&t()},[t,f]),y=J(u=>{d(u),r!=null&&f===null&&r(u)},[r,f]);return G(()=>Pe(s.registerCommand(qe,({node:u})=>(s.getEditorState().read(()=>{let l={leadOffset:0,matchingString:"",replaceableString:""};if(!Z(s,l.leadOffset)&&u!==null){let g=s._window??window,p=g.document.createRange();Q(l.leadOffset,p,g)!==null&&ee(()=>y({getRect:()=>p.getBoundingClientRect(),match:l}));return}}),!0),$e)),[s,y]),G(()=>{let u=()=>{s.getEditorState().read(()=>{let g=s._window??window,p=g.document.createRange(),O=I(),w=Xe(s);if(!N(O)||!O.isCollapsed()||w===void 0||p===null){m();return}let _=a({editor:s,query:w});if(c(_?_.matchingString:null),_!==null&&!Z(s,_.leadOffset)&&Q(_.leadOffset,p,g)!==null){ee(()=>y({getRect:()=>p.getBoundingClientRect(),match:_}));return}m()})},l=s.registerUpdateListener(u);return()=>{l()}},[s,a,c,f,m,y]),h.current===null||f===null||s===null?null:Le(K,{anchorElementRef:h,close:m,editor:s,groups:n,menuRenderFn:i,resolution:f,shouldSplitNodeWithQuery:!0})}var te=class o{_bottom;_left;_right;_top;constructor(e,n,i,t){let[r,c]=n<=t?[n,t]:[t,n],[a,s]=e<=i?[e,i]:[i,e];this._top=r,this._right=s,this._left=a,this._bottom=c}static fromDOM(e){let{height:n,left:i,top:t,width:r}=e.getBoundingClientRect();return o.fromLWTH(i,r,t,n)}static fromDOMRect(e){let{height:n,left:i,top:t,width:r}=e;return o.fromLWTH(i,r,t,n)}static fromLTRB(e,n,i,t){return new o(e,n,i,t)}static fromLWTH(e,n,i,t){return new o(e,i,e+n,i+t)}static fromPoints(e,n){let{x:i,y:t}=e,{x:r,y:c}=n;return o.fromLTRB(i,t,r,c)}contains(e){if($(e)){let{x:c,y:a}=e,s=a<this._top,f=a>this._bottom,d=c<this._left,h=c>this._right;return{reason:{isOnBottomSide:f,isOnLeftSide:d,isOnRightSide:h,isOnTopSide:s},result:!s&&!f&&!d&&!h}}let{bottom:n,left:i,right:t,top:r}=e;return r>=this._top&&r<=this._bottom&&n>=this._top&&n<=this._bottom&&i>=this._left&&i<=this._right&&t>=this._left&&t<=this._right}distanceFromPoint(e){let n=this.contains(e);if(n.result)return{distance:0,isOnBottomSide:n.reason.isOnBottomSide,isOnLeftSide:n.reason.isOnLeftSide,isOnRightSide:n.reason.isOnRightSide,isOnTopSide:n.reason.isOnTopSide};let i=0,t=0;return e.x<this._left?i=this._left-e.x:e.x>this._right&&(i=e.x-this._right),e.y<this._top?t=this._top-e.y:e.y>this._bottom&&(t=e.y-this._bottom),{distance:Math.sqrt(i*i+t*t),isOnBottomSide:e.y>this._bottom,isOnLeftSide:e.x<this._left,isOnRightSide:e.x>this._right,isOnTopSide:e.y<this._top}}equals({bottom:e,left:n,right:i,top:t}){return t===this._top&&e===this._bottom&&n===this._left&&i===this._right}generateNewRect({bottom:e=this.bottom,left:n=this.left,right:i=this.right,top:t=this.top}){return new o(n,t,i,e)}intersectsWith(e){let{height:n,left:i,top:t,width:r}=e,{height:c,left:a,top:s,width:f}=this,d=i+r>=a+f?i+r:a+f,h=t+n>=s+c?t+n:s+c,m=i<=a?i:a,y=t<=s?t:s;return d-m<=r+f&&h-y<=n+c}get bottom(){return this._bottom}get height(){return Math.abs(this._bottom-this._top)}get left(){return this._left}get right(){return this._right}get top(){return this._top}get width(){return Math.abs(this._left-this._right)}};import k from"react";var b=new WeakMap;function Dt(o,e){b.has(o)||b.set(o,new Map);let n=b.get(o);for(let[i,t]of Object.entries(e))if(!(!t||typeof t!="object")){if(i==="blocks"){for(let[r,c]of Object.entries(t))n.set(`block:${r}`,c);continue}if(i==="inlineBlocks"){for(let[r,c]of Object.entries(t))n.set(`inlineBlock:${r}`,c);continue}n.set(i,t)}}function Tt(o){b.delete(o)}function ne(o,e,n){let i=b.get(o);if(e==="block"&&n?.__fields?.blockType){let t=n.__fields.blockType;return i?.get(`block:${t}`)}if(e==="inlineBlock"&&n?.__fields?.blockType){let t=n.__fields.blockType;return i?.get(`inlineBlock:${t}`)}return i?.get(e)}function Ue({node:o,nodeType:e}){if(!("getType"in o)||o.getType()!==e)return;let n=o;if(n.prototype._originalDecorate||(n.prototype._originalDecorate=n.prototype.decorate),n.prototype._originalCreateDOM||(n.prototype._originalCreateDOM=n.prototype.createDOM),n.prototype.decorate&&!n.prototype._decorateOverridden){n.prototype._decorateOverridden=!0;let i=!!n.prototype.createDOM;n.prototype.decorate=function(t,r){let c=ne(t,e,this);if(c){if(c.Component)return c.Component({config:r,editor:t,isEditor:!0,isJSXConverter:!1,node:this});if(c.createDOM&&c.html){let s=typeof c.html=="function"?c.html({config:r,editor:t,isEditor:!0,isJSXConverter:!1,node:this}):c.html;return k.createElement("span",{dangerouslySetInnerHTML:{__html:s}})}if(c.html&&i&&!c.createDOM)return k.createElement(k.Fragment);if(e==="block"){let s=c;if(s.Block||s.Label)return n.prototype._originalDecorate.call(this,t,r,s.Block,s.Label)}else if(e==="inlineBlock"){let s=c;if(s.Block||s.Label)return n.prototype._originalDecorate.call(this,t,r,s.Block,s.Label)}}return n.prototype._originalDecorate.call(this,t,r)}}n.prototype.createDOM&&!n.prototype._createDOMOverridden&&(n.prototype._createDOMOverridden=!0,n.prototype.createDOM=function(i,t){let r=ne(t,e,this);if(r){if(r.createDOM)return r.createDOM({config:i,editor:t,node:this});if(r.html){let c=typeof r.html=="function"?r.html({config:i,editor:t,isEditor:!0,isJSXConverter:!1,node:this}):r.html,a=document.createElement("div");return a.innerHTML=c,a.firstElementChild||a}}return n.prototype._originalCreateDOM.call(this,i,t)})}function vt({editorConfig:o,nodeViews:e}){let n=Fe({nodes:o.features.nodes});if(e){let i=new Set;for(let[t,r]of Object.entries(e))!r||typeof r!="object"||(t==="blocks"&&Object.keys(r).length>0?i.add("block"):t==="inlineBlocks"&&Object.keys(r).length>0?i.add("inlineBlock"):i.add(t));for(let t of n)if("getType"in t){let r=t.getType();i.has(r)&&Ue({node:t,nodeType:r})}}return n}function Fe({nodes:o}){return o.map(e=>"node"in e?e.node:e)}import{jsx as ie}from"react/jsx-runtime";import"react";var Ke={16:"M8.5 3.5a.5.5 0 0 0-1 0v4h-4a.5.5 0 0 0 0 1h4v4a.5.5 0 0 0 1 0v-4h4a.5.5 0 0 0 0-1h-4z",24:"M12 6a.5.5 0 0 1 .5.5v5h5a.5.5 0 0 1 0 1h-5v5a.5.5 0 0 1-1 0v-5h-5a.5.5 0 0 1 0-1h5v-5A.5.5 0 0 1 12 6"},At=({className:o,size:e=24})=>ie("svg",{className:o,fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:ie("path",{clipRule:"evenodd",d:Ke[e],fill:"currentColor",fillRule:"evenodd"})});export{P as a,At as b,Ze as c,rt as d,ge as e,T as f,$ as g,xt as h,qe as i,bt as j,te as k,Dt as l,Tt as m,vt as n};
2
- //# sourceMappingURL=chunk-LN6VX25I.js.map
@@ -1,8 +0,0 @@
1
- export declare function getHorizontalScrollDelta({ clientWidth, deltaMode, deltaY, isRightToLeft, }: {
2
- clientWidth: number;
3
- deltaMode: number;
4
- deltaY: number;
5
- isRightToLeft: boolean;
6
- }): number;
7
- export declare function useRedirectVerticalWheelToHorizontalScroll(): void;
8
- //# sourceMappingURL=horizontalWheelScroll.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"horizontalWheelScroll.d.ts","sourceRoot":"","sources":["../../../../../../src/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.ts"],"names":[],"mappings":"AASA,wBAAgB,wBAAwB,CAAC,EACvC,WAAW,EACX,SAAS,EACT,MAAM,EACN,aAAa,GACd,EAAE;IACD,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,aAAa,EAAE,OAAO,CAAA;CACvB,GAAG,MAAM,CAOT;AA0CD,wBAAgB,0CAA0C,IAAI,IAAI,CAgBjE"}
@@ -1,80 +0,0 @@
1
- 'use client';
2
-
3
- import { c as _c } from "react/compiler-runtime";
4
- import { useEffect } from 'react';
5
- const scrollContainerSelector = '.fixed-toolbar__scroll';
6
- // A single notch on a classic (non-trackpad) wheel mouse reports deltaMode 1 with a
7
- // deltaY of only 1-3, so it must be scaled up to a pixel value that actually moves the scroll.
8
- const PIXELS_PER_LINE = 40;
9
- export function getHorizontalScrollDelta({
10
- clientWidth,
11
- deltaMode,
12
- deltaY,
13
- isRightToLeft
14
- }) {
15
- const deltaInPixels = deltaMode === 1 ? deltaY * PIXELS_PER_LINE : deltaMode === 2 ? deltaY * clientWidth : deltaY;
16
- // scrollLeft moves toward the inline-start edge for a given positive delta in RTL,
17
- // the opposite of LTR, so the delta must be negated to keep the scroll direction consistent.
18
- return isRightToLeft ? -deltaInPixels : deltaInPixels;
19
- }
20
- function redirectVerticalWheelToHorizontalScroll(event) {
21
- const isPrimarilyVerticalWheelInput = Math.abs(event.deltaY) > Math.abs(event.deltaX);
22
- if (!isPrimarilyVerticalWheelInput) {
23
- return;
24
- }
25
- const target = event.target;
26
- if (!(target instanceof Element)) {
27
- return;
28
- }
29
- const scrollContainer = target.closest(scrollContainerSelector);
30
- if (!scrollContainer) {
31
- return;
32
- }
33
- const canScrollHorizontally = scrollContainer.scrollWidth > scrollContainer.clientWidth;
34
- if (!canScrollHorizontally) {
35
- return;
36
- }
37
- event.preventDefault();
38
- scrollContainer.scrollLeft += getHorizontalScrollDelta({
39
- clientWidth: scrollContainer.clientWidth,
40
- deltaMode: event.deltaMode,
41
- deltaY: event.deltaY,
42
- isRightToLeft: getComputedStyle(scrollContainer).direction === 'rtl'
43
- });
44
- }
45
- // A single page can render many fixed toolbars at once (e.g. rich text nested several
46
- // layers deep inside blocks), so this listener is delegated to `document` and shared
47
- // across every toolbar instance instead of being attached per instance. A wheel listener
48
- // that can call preventDefault() must be non-passive, and non-passive listeners make the
49
- // browser treat their element as a "non-fast-scrollable region" that every scroll gesture
50
- // on the page has to be checked against, even ones nowhere near it. Attaching one instance
51
- // per toolbar would multiply that bookkeeping by however many toolbars happen to be on the
52
- // page; a single delegated listener keeps that cost constant no matter how many there are.
53
- let toolbarsListeningForWheelEvents = 0;
54
- export function useRedirectVerticalWheelToHorizontalScroll() {
55
- const $ = _c(1);
56
- let t0;
57
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
58
- t0 = [];
59
- $[0] = t0;
60
- } else {
61
- t0 = $[0];
62
- }
63
- useEffect(_temp2, t0);
64
- }
65
- function _temp2() {
66
- if (toolbarsListeningForWheelEvents === 0) {
67
- document.addEventListener("wheel", redirectVerticalWheelToHorizontalScroll, {
68
- passive: false
69
- });
70
- }
71
- toolbarsListeningForWheelEvents = toolbarsListeningForWheelEvents + 1;
72
- return _temp;
73
- }
74
- function _temp() {
75
- toolbarsListeningForWheelEvents = toolbarsListeningForWheelEvents - 1;
76
- if (toolbarsListeningForWheelEvents === 0) {
77
- document.removeEventListener("wheel", redirectVerticalWheelToHorizontalScroll);
78
- }
79
- }
80
- //# sourceMappingURL=horizontalWheelScroll.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"horizontalWheelScroll.js","names":["c","_c","useEffect","scrollContainerSelector","PIXELS_PER_LINE","getHorizontalScrollDelta","clientWidth","deltaMode","deltaY","isRightToLeft","deltaInPixels","redirectVerticalWheelToHorizontalScroll","event","isPrimarilyVerticalWheelInput","Math","abs","deltaX","target","Element","scrollContainer","closest","canScrollHorizontally","scrollWidth","preventDefault","scrollLeft","getComputedStyle","direction","toolbarsListeningForWheelEvents","useRedirectVerticalWheelToHorizontalScroll","$","t0","Symbol","for","_temp2","document","addEventListener","passive","_temp","removeEventListener"],"sources":["../../../../../../src/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.ts"],"sourcesContent":["'use client'\nimport { useEffect } from 'react'\n\nconst scrollContainerSelector = '.fixed-toolbar__scroll'\n\n// A single notch on a classic (non-trackpad) wheel mouse reports deltaMode 1 with a\n// deltaY of only 1-3, so it must be scaled up to a pixel value that actually moves the scroll.\nconst PIXELS_PER_LINE = 40\n\nexport function getHorizontalScrollDelta({\n clientWidth,\n deltaMode,\n deltaY,\n isRightToLeft,\n}: {\n clientWidth: number\n deltaMode: number\n deltaY: number\n isRightToLeft: boolean\n}): number {\n const deltaInPixels =\n deltaMode === 1 ? deltaY * PIXELS_PER_LINE : deltaMode === 2 ? deltaY * clientWidth : deltaY\n\n // scrollLeft moves toward the inline-start edge for a given positive delta in RTL,\n // the opposite of LTR, so the delta must be negated to keep the scroll direction consistent.\n return isRightToLeft ? -deltaInPixels : deltaInPixels\n}\n\nfunction redirectVerticalWheelToHorizontalScroll(event: WheelEvent): void {\n const isPrimarilyVerticalWheelInput = Math.abs(event.deltaY) > Math.abs(event.deltaX)\n if (!isPrimarilyVerticalWheelInput) {\n return\n }\n\n const target = event.target\n if (!(target instanceof Element)) {\n return\n }\n\n const scrollContainer = target.closest<HTMLElement>(scrollContainerSelector)\n if (!scrollContainer) {\n return\n }\n\n const canScrollHorizontally = scrollContainer.scrollWidth > scrollContainer.clientWidth\n if (!canScrollHorizontally) {\n return\n }\n\n event.preventDefault()\n scrollContainer.scrollLeft += getHorizontalScrollDelta({\n clientWidth: scrollContainer.clientWidth,\n deltaMode: event.deltaMode,\n deltaY: event.deltaY,\n isRightToLeft: getComputedStyle(scrollContainer).direction === 'rtl',\n })\n}\n\n// A single page can render many fixed toolbars at once (e.g. rich text nested several\n// layers deep inside blocks), so this listener is delegated to `document` and shared\n// across every toolbar instance instead of being attached per instance. A wheel listener\n// that can call preventDefault() must be non-passive, and non-passive listeners make the\n// browser treat their element as a \"non-fast-scrollable region\" that every scroll gesture\n// on the page has to be checked against, even ones nowhere near it. Attaching one instance\n// per toolbar would multiply that bookkeeping by however many toolbars happen to be on the\n// page; a single delegated listener keeps that cost constant no matter how many there are.\nlet toolbarsListeningForWheelEvents = 0\n\nexport function useRedirectVerticalWheelToHorizontalScroll(): void {\n useEffect(() => {\n if (toolbarsListeningForWheelEvents === 0) {\n document.addEventListener('wheel', redirectVerticalWheelToHorizontalScroll, {\n passive: false,\n })\n }\n toolbarsListeningForWheelEvents += 1\n\n return () => {\n toolbarsListeningForWheelEvents -= 1\n if (toolbarsListeningForWheelEvents === 0) {\n document.removeEventListener('wheel', redirectVerticalWheelToHorizontalScroll)\n }\n }\n }, [])\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;AACA,SAASC,SAAS,QAAQ;AAE1B,MAAMC,uBAAA,GAA0B;AAEhC;AACA;AACA,MAAMC,eAAA,GAAkB;AAExB,OAAO,SAASC,yBAAyB;EACvCC,WAAW;EACXC,SAAS;EACTC,MAAM;EACNC;AAAa,CAMd;EACC,MAAMC,aAAA,GACJH,SAAA,KAAc,IAAIC,MAAA,GAASJ,eAAA,GAAkBG,SAAA,KAAc,IAAIC,MAAA,GAASF,WAAA,GAAcE,MAAA;EAExF;EACA;EACA,OAAOC,aAAA,GAAgB,CAACC,aAAA,GAAgBA,aAAA;AAC1C;AAEA,SAASC,wCAAwCC,KAAiB;EAChE,MAAMC,6BAAA,GAAgCC,IAAA,CAAKC,GAAG,CAACH,KAAA,CAAMJ,MAAM,IAAIM,IAAA,CAAKC,GAAG,CAACH,KAAA,CAAMI,MAAM;EACpF,IAAI,CAACH,6BAAA,EAA+B;IAClC;EACF;EAEA,MAAMI,MAAA,GAASL,KAAA,CAAMK,MAAM;EAC3B,IAAI,EAAEA,MAAA,YAAkBC,OAAM,GAAI;IAChC;EACF;EAEA,MAAMC,eAAA,GAAkBF,MAAA,CAAOG,OAAO,CAAcjB,uBAAA;EACpD,IAAI,CAACgB,eAAA,EAAiB;IACpB;EACF;EAEA,MAAME,qBAAA,GAAwBF,eAAA,CAAgBG,WAAW,GAAGH,eAAA,CAAgBb,WAAW;EACvF,IAAI,CAACe,qBAAA,EAAuB;IAC1B;EACF;EAEAT,KAAA,CAAMW,cAAc;EACpBJ,eAAA,CAAgBK,UAAU,IAAInB,wBAAA,CAAyB;IACrDC,WAAA,EAAaa,eAAA,CAAgBb,WAAW;IACxCC,SAAA,EAAWK,KAAA,CAAML,SAAS;IAC1BC,MAAA,EAAQI,KAAA,CAAMJ,MAAM;IACpBC,aAAA,EAAegB,gBAAA,CAAiBN,eAAA,EAAiBO,SAAS,KAAK;EACjE;AACF;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIC,+BAAA,GAAkC;AAEtC,OAAO,SAAAC,2CAAA;EAAA,MAAAC,CAAA,GAAA5B,EAAA;EAAA,IAAA6B,EAAA;EAAA,IAAAD,CAAA,QAAAE,MAAA,CAAAC,GAAA;IAeFF,EAAA;IAAED,CAAA,MAAAC,EAAA;EAAA;IAAAA,EAAA,GAAAD,CAAA;EAAA;EAdL3B,SAAA,CAAA+B,MAAA,EAcGH,EAAE;AAAA;AAfA,SAAAG,OAAA;EAAA,IAECN,+BAAA,MAAoC;IACtCO,QAAA,CAAAC,gBAAA,CAA0B,SAAAxB,uCAAA;MAAAyB,OAAA;IAAA,CAE1B;EAAA;EAAAT,+BAAA,GAEFA,+BAAA,IAAmC;EAAA,OAAAU,KAAA;AAAA;AAPhC,SAAAA,MAAA;EAAAV,+BAAA,GAUDA,+BAAA,IAAmC;EAAA,IAC/BA,+BAAA,MAAoC;IACtCO,QAAA,CAAAI,mBAAA,CAA6B,SAAA3B,uCAAS;EAAA;AAAA","ignoreList":[]}
@@ -1,65 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
- import { getHorizontalScrollDelta } from './horizontalWheelScroll.js';
3
- describe('getHorizontalScrollDelta', () => {
4
- describe('deltaMode 0 (pixel)', () => {
5
- it('should pass deltaY through unchanged for LTR', () => {
6
- const delta = getHorizontalScrollDelta({
7
- clientWidth: 300,
8
- deltaMode: 0,
9
- deltaY: 15,
10
- isRightToLeft: false
11
- });
12
- expect(delta).toBe(15);
13
- });
14
- it('should negate deltaY for RTL', () => {
15
- const delta = getHorizontalScrollDelta({
16
- clientWidth: 300,
17
- deltaMode: 0,
18
- deltaY: 15,
19
- isRightToLeft: true
20
- });
21
- expect(delta).toBe(-15);
22
- });
23
- });
24
- describe('deltaMode 1 (line)', () => {
25
- it('should scale deltaY by the pixels-per-line factor for LTR', () => {
26
- const delta = getHorizontalScrollDelta({
27
- clientWidth: 300,
28
- deltaMode: 1,
29
- deltaY: 3,
30
- isRightToLeft: false
31
- });
32
- expect(delta).toBe(120);
33
- });
34
- it('should scale and negate deltaY for RTL', () => {
35
- const delta = getHorizontalScrollDelta({
36
- clientWidth: 300,
37
- deltaMode: 1,
38
- deltaY: 3,
39
- isRightToLeft: true
40
- });
41
- expect(delta).toBe(-120);
42
- });
43
- });
44
- describe('deltaMode 2 (page)', () => {
45
- it('should scale deltaY by the scroll container width for LTR', () => {
46
- const delta = getHorizontalScrollDelta({
47
- clientWidth: 300,
48
- deltaMode: 2,
49
- deltaY: 2,
50
- isRightToLeft: false
51
- });
52
- expect(delta).toBe(600);
53
- });
54
- it('should scale and negate deltaY for RTL', () => {
55
- const delta = getHorizontalScrollDelta({
56
- clientWidth: 300,
57
- deltaMode: 2,
58
- deltaY: 2,
59
- isRightToLeft: true
60
- });
61
- expect(delta).toBe(-600);
62
- });
63
- });
64
- });
65
- //# sourceMappingURL=horizontalWheelScroll.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"horizontalWheelScroll.spec.js","names":["describe","expect","it","getHorizontalScrollDelta","delta","clientWidth","deltaMode","deltaY","isRightToLeft","toBe"],"sources":["../../../../../../src/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.spec.ts"],"sourcesContent":["import { describe, expect, it } from 'vitest'\n\nimport { getHorizontalScrollDelta } from './horizontalWheelScroll.js'\n\ndescribe('getHorizontalScrollDelta', () => {\n describe('deltaMode 0 (pixel)', () => {\n it('should pass deltaY through unchanged for LTR', () => {\n const delta = getHorizontalScrollDelta({\n clientWidth: 300,\n deltaMode: 0,\n deltaY: 15,\n isRightToLeft: false,\n })\n\n expect(delta).toBe(15)\n })\n\n it('should negate deltaY for RTL', () => {\n const delta = getHorizontalScrollDelta({\n clientWidth: 300,\n deltaMode: 0,\n deltaY: 15,\n isRightToLeft: true,\n })\n\n expect(delta).toBe(-15)\n })\n })\n\n describe('deltaMode 1 (line)', () => {\n it('should scale deltaY by the pixels-per-line factor for LTR', () => {\n const delta = getHorizontalScrollDelta({\n clientWidth: 300,\n deltaMode: 1,\n deltaY: 3,\n isRightToLeft: false,\n })\n\n expect(delta).toBe(120)\n })\n\n it('should scale and negate deltaY for RTL', () => {\n const delta = getHorizontalScrollDelta({\n clientWidth: 300,\n deltaMode: 1,\n deltaY: 3,\n isRightToLeft: true,\n })\n\n expect(delta).toBe(-120)\n })\n })\n\n describe('deltaMode 2 (page)', () => {\n it('should scale deltaY by the scroll container width for LTR', () => {\n const delta = getHorizontalScrollDelta({\n clientWidth: 300,\n deltaMode: 2,\n deltaY: 2,\n isRightToLeft: false,\n })\n\n expect(delta).toBe(600)\n })\n\n it('should scale and negate deltaY for RTL', () => {\n const delta = getHorizontalScrollDelta({\n clientWidth: 300,\n deltaMode: 2,\n deltaY: 2,\n isRightToLeft: true,\n })\n\n expect(delta).toBe(-600)\n })\n })\n})\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ;AAErC,SAASC,wBAAwB,QAAQ;AAEzCH,QAAA,CAAS,4BAA4B;EACnCA,QAAA,CAAS,uBAAuB;IAC9BE,EAAA,CAAG,gDAAgD;MACjD,MAAME,KAAA,GAAQD,wBAAA,CAAyB;QACrCE,WAAA,EAAa;QACbC,SAAA,EAAW;QACXC,MAAA,EAAQ;QACRC,aAAA,EAAe;MACjB;MAEAP,MAAA,CAAOG,KAAA,EAAOK,IAAI,CAAC;IACrB;IAEAP,EAAA,CAAG,gCAAgC;MACjC,MAAME,KAAA,GAAQD,wBAAA,CAAyB;QACrCE,WAAA,EAAa;QACbC,SAAA,EAAW;QACXC,MAAA,EAAQ;QACRC,aAAA,EAAe;MACjB;MAEAP,MAAA,CAAOG,KAAA,EAAOK,IAAI,CAAC,CAAC;IACtB;EACF;EAEAT,QAAA,CAAS,sBAAsB;IAC7BE,EAAA,CAAG,6DAA6D;MAC9D,MAAME,KAAA,GAAQD,wBAAA,CAAyB;QACrCE,WAAA,EAAa;QACbC,SAAA,EAAW;QACXC,MAAA,EAAQ;QACRC,aAAA,EAAe;MACjB;MAEAP,MAAA,CAAOG,KAAA,EAAOK,IAAI,CAAC;IACrB;IAEAP,EAAA,CAAG,0CAA0C;MAC3C,MAAME,KAAA,GAAQD,wBAAA,CAAyB;QACrCE,WAAA,EAAa;QACbC,SAAA,EAAW;QACXC,MAAA,EAAQ;QACRC,aAAA,EAAe;MACjB;MAEAP,MAAA,CAAOG,KAAA,EAAOK,IAAI,CAAC,CAAC;IACtB;EACF;EAEAT,QAAA,CAAS,sBAAsB;IAC7BE,EAAA,CAAG,6DAA6D;MAC9D,MAAME,KAAA,GAAQD,wBAAA,CAAyB;QACrCE,WAAA,EAAa;QACbC,SAAA,EAAW;QACXC,MAAA,EAAQ;QACRC,aAAA,EAAe;MACjB;MAEAP,MAAA,CAAOG,KAAA,EAAOK,IAAI,CAAC;IACrB;IAEAP,EAAA,CAAG,0CAA0C;MAC3C,MAAME,KAAA,GAAQD,wBAAA,CAAyB;QACrCE,WAAA,EAAa;QACbC,SAAA,EAAW;QACXC,MAAA,EAAQ;QACRC,aAAA,EAAe;MACjB;MAEAP,MAAA,CAAOG,KAAA,EAAOK,IAAI,CAAC,CAAC;IACtB;EACF;AACF","ignoreList":[]}