@payloadcms/richtext-lexical 3.0.0-beta.13 → 3.0.0-beta.15

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 (120) hide show
  1. package/dist/field/features/blockquote/feature.server.d.ts.map +1 -1
  2. package/dist/field/features/blockquote/feature.server.js +3 -2
  3. package/dist/field/features/blockquote/feature.server.js.map +1 -1
  4. package/dist/field/features/blocks/component/index.d.ts.map +1 -1
  5. package/dist/field/features/blocks/component/index.js +31 -1
  6. package/dist/field/features/blocks/component/index.js.map +1 -1
  7. package/dist/field/features/blocks/feature.server.d.ts.map +1 -1
  8. package/dist/field/features/blocks/feature.server.js +90 -3
  9. package/dist/field/features/blocks/feature.server.js.map +1 -1
  10. package/dist/field/features/blocks/populationPromise.d.ts.map +1 -1
  11. package/dist/field/features/blocks/populationPromise.js +3 -5
  12. package/dist/field/features/blocks/populationPromise.js.map +1 -1
  13. package/dist/field/features/blocks/validate.d.ts.map +1 -1
  14. package/dist/field/features/blocks/validate.js +21 -23
  15. package/dist/field/features/blocks/validate.js.map +1 -1
  16. package/dist/field/features/heading/feature.server.d.ts.map +1 -1
  17. package/dist/field/features/heading/feature.server.js +4 -3
  18. package/dist/field/features/heading/feature.server.js.map +1 -1
  19. package/dist/field/features/horizontalrule/feature.server.d.ts.map +1 -1
  20. package/dist/field/features/horizontalrule/feature.server.js +3 -2
  21. package/dist/field/features/horizontalrule/feature.server.js.map +1 -1
  22. package/dist/field/features/link/drawer/baseFields.js +1 -1
  23. package/dist/field/features/link/drawer/baseFields.js.map +1 -1
  24. package/dist/field/features/link/feature.server.d.ts.map +1 -1
  25. package/dist/field/features/link/feature.server.js +15 -6
  26. package/dist/field/features/link/feature.server.js.map +1 -1
  27. package/dist/field/features/link/populationPromise.d.ts.map +1 -1
  28. package/dist/field/features/link/populationPromise.js +28 -26
  29. package/dist/field/features/link/populationPromise.js.map +1 -1
  30. package/dist/field/features/lists/checklist/feature.server.d.ts.map +1 -1
  31. package/dist/field/features/lists/checklist/feature.server.js +5 -4
  32. package/dist/field/features/lists/checklist/feature.server.js.map +1 -1
  33. package/dist/field/features/lists/orderedlist/feature.server.d.ts.map +1 -1
  34. package/dist/field/features/lists/orderedlist/feature.server.js +5 -4
  35. package/dist/field/features/lists/orderedlist/feature.server.js.map +1 -1
  36. package/dist/field/features/lists/unorderedlist/feature.server.d.ts.map +1 -1
  37. package/dist/field/features/lists/unorderedlist/feature.server.js +5 -4
  38. package/dist/field/features/lists/unorderedlist/feature.server.js.map +1 -1
  39. package/dist/field/features/migrations/lexicalPluginToLexical/converter/converters/upload/converter.d.ts.map +1 -1
  40. package/dist/field/features/migrations/lexicalPluginToLexical/converter/converters/upload/converter.js +2 -4
  41. package/dist/field/features/migrations/lexicalPluginToLexical/converter/converters/upload/converter.js.map +1 -1
  42. package/dist/field/features/migrations/slateToLexical/converter/converters/relationship/converter.d.ts.map +1 -1
  43. package/dist/field/features/migrations/slateToLexical/converter/converters/relationship/converter.js +2 -4
  44. package/dist/field/features/migrations/slateToLexical/converter/converters/relationship/converter.js.map +1 -1
  45. package/dist/field/features/migrations/slateToLexical/converter/converters/upload/converter.d.ts.map +1 -1
  46. package/dist/field/features/migrations/slateToLexical/converter/converters/upload/converter.js +2 -4
  47. package/dist/field/features/migrations/slateToLexical/converter/converters/upload/converter.js.map +1 -1
  48. package/dist/field/features/relationship/drawer/index.d.ts.map +1 -1
  49. package/dist/field/features/relationship/drawer/index.js +5 -9
  50. package/dist/field/features/relationship/drawer/index.js.map +1 -1
  51. package/dist/field/features/relationship/feature.server.d.ts.map +1 -1
  52. package/dist/field/features/relationship/feature.server.js +3 -2
  53. package/dist/field/features/relationship/feature.server.js.map +1 -1
  54. package/dist/field/features/relationship/nodes/RelationshipNode.d.ts +1 -4
  55. package/dist/field/features/relationship/nodes/RelationshipNode.d.ts.map +1 -1
  56. package/dist/field/features/relationship/nodes/RelationshipNode.js +7 -6
  57. package/dist/field/features/relationship/nodes/RelationshipNode.js.map +1 -1
  58. package/dist/field/features/relationship/nodes/components/RelationshipComponent.d.ts.map +1 -1
  59. package/dist/field/features/relationship/nodes/components/RelationshipComponent.js +1 -1
  60. package/dist/field/features/relationship/nodes/components/RelationshipComponent.js.map +1 -1
  61. package/dist/field/features/relationship/populationPromise.js +7 -6
  62. package/dist/field/features/relationship/populationPromise.js.map +1 -1
  63. package/dist/field/features/typeUtilities.d.ts +8 -0
  64. package/dist/field/features/typeUtilities.d.ts.map +1 -0
  65. package/dist/field/features/typeUtilities.js +8 -0
  66. package/dist/field/features/typeUtilities.js.map +1 -0
  67. package/dist/field/features/types.d.ts +50 -26
  68. package/dist/field/features/types.d.ts.map +1 -1
  69. package/dist/field/features/types.js.map +1 -1
  70. package/dist/field/features/upload/component/index.js +3 -3
  71. package/dist/field/features/upload/component/index.js.map +1 -1
  72. package/dist/field/features/upload/drawer/index.d.ts.map +1 -1
  73. package/dist/field/features/upload/drawer/index.js +6 -8
  74. package/dist/field/features/upload/drawer/index.js.map +1 -1
  75. package/dist/field/features/upload/feature.server.d.ts.map +1 -1
  76. package/dist/field/features/upload/feature.server.js +8 -4
  77. package/dist/field/features/upload/feature.server.js.map +1 -1
  78. package/dist/field/features/upload/nodes/UploadNode.d.ts +1 -11
  79. package/dist/field/features/upload/nodes/UploadNode.d.ts.map +1 -1
  80. package/dist/field/features/upload/nodes/UploadNode.js +4 -1
  81. package/dist/field/features/upload/nodes/UploadNode.js.map +1 -1
  82. package/dist/field/features/upload/plugin/index.d.ts +2 -2
  83. package/dist/field/features/upload/plugin/index.d.ts.map +1 -1
  84. package/dist/field/features/upload/plugin/index.js +1 -3
  85. package/dist/field/features/upload/plugin/index.js.map +1 -1
  86. package/dist/field/features/upload/populationPromise.d.ts.map +1 -1
  87. package/dist/field/features/upload/populationPromise.js +22 -9
  88. package/dist/field/features/upload/populationPromise.js.map +1 -1
  89. package/dist/field/features/upload/validate.js +5 -3
  90. package/dist/field/features/upload/validate.js.map +1 -1
  91. package/dist/field/lexical/config/server/sanitize.d.ts.map +1 -1
  92. package/dist/field/lexical/config/server/sanitize.js +20 -6
  93. package/dist/field/lexical/config/server/sanitize.js.map +1 -1
  94. package/dist/field/lexical/utils/url.d.ts.map +1 -1
  95. package/dist/field/lexical/utils/url.js +1 -0
  96. package/dist/field/lexical/utils/url.js.map +1 -1
  97. package/dist/forEachNodeRecursively.d.ts +10 -0
  98. package/dist/forEachNodeRecursively.d.ts.map +1 -0
  99. package/dist/forEachNodeRecursively.js +24 -0
  100. package/dist/forEachNodeRecursively.js.map +1 -0
  101. package/dist/index.d.ts +3 -2
  102. package/dist/index.d.ts.map +1 -1
  103. package/dist/index.js +103 -23
  104. package/dist/index.js.map +1 -1
  105. package/dist/populate/populate.d.ts +1 -1
  106. package/dist/populate/populate.d.ts.map +1 -1
  107. package/dist/populate/populate.js.map +1 -1
  108. package/dist/populate/populateLexicalPopulationPromises.d.ts +12 -0
  109. package/dist/populate/populateLexicalPopulationPromises.d.ts.map +1 -0
  110. package/dist/populate/populateLexicalPopulationPromises.js +35 -0
  111. package/dist/populate/populateLexicalPopulationPromises.js.map +1 -0
  112. package/dist/populate/recurseNestedFields.d.ts +5 -2
  113. package/dist/populate/recurseNestedFields.d.ts.map +1 -1
  114. package/dist/populate/recurseNestedFields.js +3 -5
  115. package/dist/populate/recurseNestedFields.js.map +1 -1
  116. package/package.json +9 -9
  117. package/dist/populate/richTextRelationshipPromise.d.ts +0 -23
  118. package/dist/populate/richTextRelationshipPromise.d.ts.map +0 -1
  119. package/dist/populate/richTextRelationshipPromise.js +0 -68
  120. package/dist/populate/richTextRelationshipPromise.js.map +0 -1
@@ -9,7 +9,11 @@ export const sanitizeServerFeatures = (features)=>{
9
9
  modifyOutputSchemas: []
10
10
  },
11
11
  hooks: {
12
- afterReadPromises: []
12
+ afterChange: new Map(),
13
+ afterRead: new Map(),
14
+ beforeChange: new Map(),
15
+ beforeDuplicate: new Map(),
16
+ beforeValidate: new Map()
13
17
  },
14
18
  markdownTransformers: [],
15
19
  nodes: [],
@@ -23,11 +27,6 @@ export const sanitizeServerFeatures = (features)=>{
23
27
  if (feature?.generatedTypes?.modifyOutputSchema) {
24
28
  sanitized.generatedTypes.modifyOutputSchemas.push(feature.generatedTypes.modifyOutputSchema);
25
29
  }
26
- if (feature.hooks) {
27
- if (feature.hooks.afterReadPromise) {
28
- sanitized.hooks.afterReadPromises = sanitized.hooks.afterReadPromises.concat(feature.hooks.afterReadPromise);
29
- }
30
- }
31
30
  if (feature.nodes?.length) {
32
31
  sanitized.nodes = sanitized.nodes.concat(feature.nodes);
33
32
  feature.nodes.forEach((node)=>{
@@ -42,6 +41,21 @@ export const sanitizeServerFeatures = (features)=>{
42
41
  if (node?.converters?.html) {
43
42
  sanitized.converters.html.push(node.converters.html);
44
43
  }
44
+ if (node?.hooks?.afterChange) {
45
+ sanitized.hooks.afterChange.set(nodeType, node.hooks.afterChange);
46
+ }
47
+ if (node?.hooks?.afterRead) {
48
+ sanitized.hooks.afterRead.set(nodeType, node.hooks.afterRead);
49
+ }
50
+ if (node?.hooks?.beforeChange) {
51
+ sanitized.hooks.beforeChange.set(nodeType, node.hooks.beforeChange);
52
+ }
53
+ if (node?.hooks?.beforeDuplicate) {
54
+ sanitized.hooks.beforeDuplicate.set(nodeType, node.hooks.beforeDuplicate);
55
+ }
56
+ if (node?.hooks?.beforeValidate) {
57
+ sanitized.hooks.beforeValidate.set(nodeType, node.hooks.beforeValidate);
58
+ }
45
59
  });
46
60
  }
47
61
  if (feature.markdownTransformers?.length) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/field/lexical/config/server/sanitize.ts"],"sourcesContent":["import type { ResolvedServerFeatureMap, SanitizedServerFeatures } from '../../../features/types.js'\nimport type { SanitizedServerEditorConfig, ServerEditorConfig } from '../types.js'\n\nimport { loadFeatures } from './loader.js'\n\nexport const sanitizeServerFeatures = (\n features: ResolvedServerFeatureMap,\n): SanitizedServerFeatures => {\n const sanitized: SanitizedServerFeatures = {\n converters: {\n html: [],\n },\n enabledFeatures: [],\n\n generatedTypes: {\n modifyOutputSchemas: [],\n },\n hooks: {\n afterReadPromises: [],\n },\n markdownTransformers: [],\n nodes: [],\n populationPromises: new Map(),\n\n validations: new Map(),\n }\n\n if (!features?.size) {\n return sanitized\n }\n\n features.forEach((feature) => {\n if (feature?.generatedTypes?.modifyOutputSchema) {\n sanitized.generatedTypes.modifyOutputSchemas.push(feature.generatedTypes.modifyOutputSchema)\n }\n if (feature.hooks) {\n if (feature.hooks.afterReadPromise) {\n sanitized.hooks.afterReadPromises = sanitized.hooks.afterReadPromises.concat(\n feature.hooks.afterReadPromise,\n )\n }\n }\n\n if (feature.nodes?.length) {\n sanitized.nodes = sanitized.nodes.concat(feature.nodes)\n feature.nodes.forEach((node) => {\n const nodeType = 'with' in node.node ? node.node.replace.getType() : node.node.getType() // TODO: Idk if this works for node replacements\n if (node?.populationPromises?.length) {\n sanitized.populationPromises.set(nodeType, node.populationPromises)\n }\n if (node?.validations?.length) {\n sanitized.validations.set(nodeType, node.validations)\n }\n if (node?.converters?.html) {\n sanitized.converters.html.push(node.converters.html)\n }\n })\n }\n\n if (feature.markdownTransformers?.length) {\n sanitized.markdownTransformers = sanitized.markdownTransformers.concat(\n feature.markdownTransformers,\n )\n }\n\n sanitized.enabledFeatures.push(feature.key)\n })\n\n return sanitized\n}\n\nexport function sanitizeServerEditorConfig(\n editorConfig: ServerEditorConfig,\n): SanitizedServerEditorConfig {\n const resolvedFeatureMap = loadFeatures({\n unSanitizedEditorConfig: editorConfig,\n })\n\n return {\n features: sanitizeServerFeatures(resolvedFeatureMap),\n lexical: editorConfig.lexical,\n resolvedFeatureMap,\n }\n}\n"],"names":["loadFeatures","sanitizeServerFeatures","features","sanitized","converters","html","enabledFeatures","generatedTypes","modifyOutputSchemas","hooks","afterReadPromises","markdownTransformers","nodes","populationPromises","Map","validations","size","forEach","feature","modifyOutputSchema","push","afterReadPromise","concat","length","node","nodeType","replace","getType","set","key","sanitizeServerEditorConfig","editorConfig","resolvedFeatureMap","unSanitizedEditorConfig","lexical"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAGA,SAASA,YAAY,QAAQ,cAAa;AAE1C,OAAO,MAAMC,yBAAyB,CACpCC;IAEA,MAAMC,YAAqC;QACzCC,YAAY;YACVC,MAAM,EAAE;QACV;QACAC,iBAAiB,EAAE;QAEnBC,gBAAgB;YACdC,qBAAqB,EAAE;QACzB;QACAC,OAAO;YACLC,mBAAmB,EAAE;QACvB;QACAC,sBAAsB,EAAE;QACxBC,OAAO,EAAE;QACTC,oBAAoB,IAAIC;QAExBC,aAAa,IAAID;IACnB;IAEA,IAAI,CAACZ,UAAUc,MAAM;QACnB,OAAOb;IACT;IAEAD,SAASe,OAAO,CAAC,CAACC;QAChB,IAAIA,SAASX,gBAAgBY,oBAAoB;YAC/ChB,UAAUI,cAAc,CAACC,mBAAmB,CAACY,IAAI,CAACF,QAAQX,cAAc,CAACY,kBAAkB;QAC7F;QACA,IAAID,QAAQT,KAAK,EAAE;YACjB,IAAIS,QAAQT,KAAK,CAACY,gBAAgB,EAAE;gBAClClB,UAAUM,KAAK,CAACC,iBAAiB,GAAGP,UAAUM,KAAK,CAACC,iBAAiB,CAACY,MAAM,CAC1EJ,QAAQT,KAAK,CAACY,gBAAgB;YAElC;QACF;QAEA,IAAIH,QAAQN,KAAK,EAAEW,QAAQ;YACzBpB,UAAUS,KAAK,GAAGT,UAAUS,KAAK,CAACU,MAAM,CAACJ,QAAQN,KAAK;YACtDM,QAAQN,KAAK,CAACK,OAAO,CAAC,CAACO;gBACrB,MAAMC,WAAW,UAAUD,KAAKA,IAAI,GAAGA,KAAKA,IAAI,CAACE,OAAO,CAACC,OAAO,KAAKH,KAAKA,IAAI,CAACG,OAAO,GAAG,gDAAgD;;gBACzI,IAAIH,MAAMX,oBAAoBU,QAAQ;oBACpCpB,UAAUU,kBAAkB,CAACe,GAAG,CAACH,UAAUD,KAAKX,kBAAkB;gBACpE;gBACA,IAAIW,MAAMT,aAAaQ,QAAQ;oBAC7BpB,UAAUY,WAAW,CAACa,GAAG,CAACH,UAAUD,KAAKT,WAAW;gBACtD;gBACA,IAAIS,MAAMpB,YAAYC,MAAM;oBAC1BF,UAAUC,UAAU,CAACC,IAAI,CAACe,IAAI,CAACI,KAAKpB,UAAU,CAACC,IAAI;gBACrD;YACF;QACF;QAEA,IAAIa,QAAQP,oBAAoB,EAAEY,QAAQ;YACxCpB,UAAUQ,oBAAoB,GAAGR,UAAUQ,oBAAoB,CAACW,MAAM,CACpEJ,QAAQP,oBAAoB;QAEhC;QAEAR,UAAUG,eAAe,CAACc,IAAI,CAACF,QAAQW,GAAG;IAC5C;IAEA,OAAO1B;AACT,EAAC;AAED,OAAO,SAAS2B,2BACdC,YAAgC;IAEhC,MAAMC,qBAAqBhC,aAAa;QACtCiC,yBAAyBF;IAC3B;IAEA,OAAO;QACL7B,UAAUD,uBAAuB+B;QACjCE,SAASH,aAAaG,OAAO;QAC7BF;IACF;AACF"}
1
+ {"version":3,"sources":["../../../../../src/field/lexical/config/server/sanitize.ts"],"sourcesContent":["import type { ResolvedServerFeatureMap, SanitizedServerFeatures } from '../../../features/types.js'\nimport type { SanitizedServerEditorConfig, ServerEditorConfig } from '../types.js'\n\nimport { loadFeatures } from './loader.js'\n\nexport const sanitizeServerFeatures = (\n features: ResolvedServerFeatureMap,\n): SanitizedServerFeatures => {\n const sanitized: SanitizedServerFeatures = {\n converters: {\n html: [],\n },\n enabledFeatures: [],\n\n generatedTypes: {\n modifyOutputSchemas: [],\n },\n hooks: {\n afterChange: new Map(),\n afterRead: new Map(),\n beforeChange: new Map(),\n beforeDuplicate: new Map(),\n beforeValidate: new Map(),\n },\n markdownTransformers: [],\n nodes: [],\n populationPromises: new Map(),\n\n validations: new Map(),\n }\n\n if (!features?.size) {\n return sanitized\n }\n\n features.forEach((feature) => {\n if (feature?.generatedTypes?.modifyOutputSchema) {\n sanitized.generatedTypes.modifyOutputSchemas.push(feature.generatedTypes.modifyOutputSchema)\n }\n\n if (feature.nodes?.length) {\n sanitized.nodes = sanitized.nodes.concat(feature.nodes)\n feature.nodes.forEach((node) => {\n const nodeType = 'with' in node.node ? node.node.replace.getType() : node.node.getType() // TODO: Idk if this works for node replacements\n if (node?.populationPromises?.length) {\n sanitized.populationPromises.set(nodeType, node.populationPromises)\n }\n if (node?.validations?.length) {\n sanitized.validations.set(nodeType, node.validations)\n }\n if (node?.converters?.html) {\n sanitized.converters.html.push(node.converters.html)\n }\n if (node?.hooks?.afterChange) {\n sanitized.hooks.afterChange.set(nodeType, node.hooks.afterChange)\n }\n if (node?.hooks?.afterRead) {\n sanitized.hooks.afterRead.set(nodeType, node.hooks.afterRead)\n }\n if (node?.hooks?.beforeChange) {\n sanitized.hooks.beforeChange.set(nodeType, node.hooks.beforeChange)\n }\n if (node?.hooks?.beforeDuplicate) {\n sanitized.hooks.beforeDuplicate.set(nodeType, node.hooks.beforeDuplicate)\n }\n if (node?.hooks?.beforeValidate) {\n sanitized.hooks.beforeValidate.set(nodeType, node.hooks.beforeValidate)\n }\n })\n }\n\n if (feature.markdownTransformers?.length) {\n sanitized.markdownTransformers = sanitized.markdownTransformers.concat(\n feature.markdownTransformers,\n )\n }\n\n sanitized.enabledFeatures.push(feature.key)\n })\n\n return sanitized\n}\n\nexport function sanitizeServerEditorConfig(\n editorConfig: ServerEditorConfig,\n): SanitizedServerEditorConfig {\n const resolvedFeatureMap = loadFeatures({\n unSanitizedEditorConfig: editorConfig,\n })\n\n return {\n features: sanitizeServerFeatures(resolvedFeatureMap),\n lexical: editorConfig.lexical,\n resolvedFeatureMap,\n }\n}\n"],"names":["loadFeatures","sanitizeServerFeatures","features","sanitized","converters","html","enabledFeatures","generatedTypes","modifyOutputSchemas","hooks","afterChange","Map","afterRead","beforeChange","beforeDuplicate","beforeValidate","markdownTransformers","nodes","populationPromises","validations","size","forEach","feature","modifyOutputSchema","push","length","concat","node","nodeType","replace","getType","set","key","sanitizeServerEditorConfig","editorConfig","resolvedFeatureMap","unSanitizedEditorConfig","lexical"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAGA,SAASA,YAAY,QAAQ,cAAa;AAE1C,OAAO,MAAMC,yBAAyB,CACpCC;IAEA,MAAMC,YAAqC;QACzCC,YAAY;YACVC,MAAM,EAAE;QACV;QACAC,iBAAiB,EAAE;QAEnBC,gBAAgB;YACdC,qBAAqB,EAAE;QACzB;QACAC,OAAO;YACLC,aAAa,IAAIC;YACjBC,WAAW,IAAID;YACfE,cAAc,IAAIF;YAClBG,iBAAiB,IAAIH;YACrBI,gBAAgB,IAAIJ;QACtB;QACAK,sBAAsB,EAAE;QACxBC,OAAO,EAAE;QACTC,oBAAoB,IAAIP;QAExBQ,aAAa,IAAIR;IACnB;IAEA,IAAI,CAACT,UAAUkB,MAAM;QACnB,OAAOjB;IACT;IAEAD,SAASmB,OAAO,CAAC,CAACC;QAChB,IAAIA,SAASf,gBAAgBgB,oBAAoB;YAC/CpB,UAAUI,cAAc,CAACC,mBAAmB,CAACgB,IAAI,CAACF,QAAQf,cAAc,CAACgB,kBAAkB;QAC7F;QAEA,IAAID,QAAQL,KAAK,EAAEQ,QAAQ;YACzBtB,UAAUc,KAAK,GAAGd,UAAUc,KAAK,CAACS,MAAM,CAACJ,QAAQL,KAAK;YACtDK,QAAQL,KAAK,CAACI,OAAO,CAAC,CAACM;gBACrB,MAAMC,WAAW,UAAUD,KAAKA,IAAI,GAAGA,KAAKA,IAAI,CAACE,OAAO,CAACC,OAAO,KAAKH,KAAKA,IAAI,CAACG,OAAO,GAAG,gDAAgD;;gBACzI,IAAIH,MAAMT,oBAAoBO,QAAQ;oBACpCtB,UAAUe,kBAAkB,CAACa,GAAG,CAACH,UAAUD,KAAKT,kBAAkB;gBACpE;gBACA,IAAIS,MAAMR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SAASH,aAAaG,OAAO;QAC7BF;IACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../../src/field/lexical/utils/url.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAa/C;AAMD,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAkBhD"}
1
+ {"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../../src/field/lexical/utils/url.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAa/C;AAMD,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAoBhD"}
@@ -10,6 +10,7 @@ const urlRegExp = /((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=+$,\w]+@)?[A-Za-z\d.-]+|(
10
10
  export function validateUrl(url) {
11
11
  // TODO Fix UI for link insertion; it should never default to an invalid URL such as https://.
12
12
  // Maybe show a dialog where they user can type the URL before inserting it.
13
+ if (!url) return false;
13
14
  if (url === 'https://') return true;
14
15
  // This makes sure URLs starting with www. instead of https are valid too
15
16
  if (urlRegExp.test(url)) return true;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/field/lexical/utils/url.ts"],"sourcesContent":["export function sanitizeUrl(url: string): string {\n /** A pattern that matches safe URLs. */\n const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi\n\n /** A pattern that matches safe data URLs. */\n const DATA_URL_PATTERN =\n /^data:(?:image\\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\\/(?:mpeg|mp4|ogg|webm)|audio\\/(?:mp3|oga|ogg|opus));base64,[a-z\\d+/]+=*$/i\n\n url = String(url).trim()\n\n if (url.match(SAFE_URL_PATTERN) != null || url.match(DATA_URL_PATTERN) != null) return url\n\n return 'https://'\n}\n\n// Source: https://stackoverflow.com/a/8234912/2013580\nconst urlRegExp =\n /((([A-Za-z]{3,9}:(?:\\/\\/)?)(?:[-;:&=+$,\\w]+@)?[A-Za-z\\d.-]+|(?:www.|[-;:&=+$,\\w]+@)[A-Za-z\\d.-]+)((?:\\/[+~%/.\\w-]*)?\\??[-+=&;%@.\\w]*#?\\w*)?)/\n\nexport function validateUrl(url: string): boolean {\n // TODO Fix UI for link insertion; it should never default to an invalid URL such as https://.\n // Maybe show a dialog where they user can type the URL before inserting it.\n\n if (url === 'https://') return true\n\n // This makes sure URLs starting with www. instead of https are valid too\n if (urlRegExp.test(url)) return true\n\n // While this doesn't allow URLs starting with www (which is why we use the regex above), it does properly handle tel: URLs\n try {\n new URL(url)\n return true\n } catch {\n /* empty */\n }\n\n return false\n}\n"],"names":["sanitizeUrl","url","SAFE_URL_PATTERN","DATA_URL_PATTERN","String","trim","match","urlRegExp","validateUrl","test","URL"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,OAAO,SAASA,YAAYC,GAAW;IACrC,uCAAuC,GACvC,MAAMC,mBAAmB;IAEzB,2CAA2C,GAC3C,MAAMC,mBACJ;IAEFF,MAAMG,OAAOH,KAAKI,IAAI;IAEtB,IAAIJ,IAAIK,KAAK,CAACJ,qBAAqB,QAAQD,IAAIK,KAAK,CAACH,qBAAqB,MAAM,OAAOF;IAEvF,OAAO;AACT;AAEA,sDAAsD;AACtD,MAAMM,YACJ;AAEF,OAAO,SAASC,YAAYP,GAAW;IACrC,8FAA8F;IAC9F,4EAA4E;IAE5E,IAAIA,QAAQ,YAAY,OAAO;IAE/B,yEAAyE;IACzE,IAAIM,UAAUE,IAAI,CAACR,MAAM,OAAO;IAEhC,2HAA2H;IAC3H,IAAI;QACF,IAAIS,IAAIT;QACR,OAAO;IACT,EAAE,OAAM;IACN,SAAS,GACX;IAEA,OAAO;AACT"}
1
+ {"version":3,"sources":["../../../../src/field/lexical/utils/url.ts"],"sourcesContent":["export function sanitizeUrl(url: string): string {\n /** A pattern that matches safe URLs. */\n const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi\n\n /** A pattern that matches safe data URLs. */\n const DATA_URL_PATTERN =\n /^data:(?:image\\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\\/(?:mpeg|mp4|ogg|webm)|audio\\/(?:mp3|oga|ogg|opus));base64,[a-z\\d+/]+=*$/i\n\n url = String(url).trim()\n\n if (url.match(SAFE_URL_PATTERN) != null || url.match(DATA_URL_PATTERN) != null) return url\n\n return 'https://'\n}\n\n// Source: https://stackoverflow.com/a/8234912/2013580\nconst urlRegExp =\n /((([A-Za-z]{3,9}:(?:\\/\\/)?)(?:[-;:&=+$,\\w]+@)?[A-Za-z\\d.-]+|(?:www.|[-;:&=+$,\\w]+@)[A-Za-z\\d.-]+)((?:\\/[+~%/.\\w-]*)?\\??[-+=&;%@.\\w]*#?\\w*)?)/\n\nexport function validateUrl(url: string): boolean {\n // TODO Fix UI for link insertion; it should never default to an invalid URL such as https://.\n // Maybe show a dialog where they user can type the URL before inserting it.\n\n if (!url) return false\n\n if (url === 'https://') return true\n\n // This makes sure URLs starting with www. instead of https are valid too\n if (urlRegExp.test(url)) return true\n\n // While this doesn't allow URLs starting with www (which is why we use the regex above), it does properly handle tel: URLs\n try {\n new URL(url)\n return true\n } catch {\n /* empty */\n }\n\n return false\n}\n"],"names":["sanitizeUrl","url","SAFE_URL_PATTERN","DATA_URL_PATTERN","String","trim","match","urlRegExp","validateUrl","test","URL"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,OAAO,SAASA,YAAYC,GAAW;IACrC,uCAAuC,GACvC,MAAMC,mBAAmB;IAEzB,2CAA2C,GAC3C,MAAMC,mBACJ;IAEFF,MAAMG,OAAOH,KAAKI,IAAI;IAEtB,IAAIJ,IAAIK,KAAK,CAACJ,qBAAqB,QAAQD,IAAIK,KAAK,CAACH,qBAAqB,MAAM,OAAOF;IAEvF,OAAO;AACT;AAEA,sDAAsD;AACtD,MAAMM,YACJ;AAEF,OAAO,SAASC,YAAYP,GAAW;IACrC,8FAA8F;IAC9F,4EAA4E;IAE5E,IAAI,CAACA,KAAK,OAAO;IAEjB,IAAIA,QAAQ,YAAY,OAAO;IAE/B,yEAAyE;IACzE,IAAIM,UAAUE,IAAI,CAACR,MAAM,OAAO;IAEhC,2HAA2H;IAC3H,IAAI;QACF,IAAIS,IAAIT;QACR,OAAO;IACT,EAAE,OAAM;IACN,SAAS,GACX;IAEA,OAAO;AACT"}
@@ -0,0 +1,10 @@
1
+ import type { SerializedLexicalNode } from 'lexical';
2
+ export declare function recurseNodes({ callback, nodes, }: {
3
+ callback: (node: SerializedLexicalNode) => void;
4
+ nodes: SerializedLexicalNode[];
5
+ }): void;
6
+ export declare function recurseNodesAsync({ callback, nodes, }: {
7
+ callback: (node: SerializedLexicalNode) => Promise<void>;
8
+ nodes: SerializedLexicalNode[];
9
+ }): Promise<void>;
10
+ //# sourceMappingURL=forEachNodeRecursively.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forEachNodeRecursively.d.ts","sourceRoot":"","sources":["../src/forEachNodeRecursively.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAEpD,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,KAAK,GACN,EAAE;IACD,QAAQ,EAAE,CAAC,IAAI,EAAE,qBAAqB,KAAK,IAAI,CAAA;IAC/C,KAAK,EAAE,qBAAqB,EAAE,CAAA;CAC/B,QAQA;AAED,wBAAsB,iBAAiB,CAAC,EACtC,QAAQ,EACR,KAAK,GACN,EAAE;IACD,QAAQ,EAAE,CAAC,IAAI,EAAE,qBAAqB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACxD,KAAK,EAAE,qBAAqB,EAAE,CAAA;CAC/B,iBAQA"}
@@ -0,0 +1,24 @@
1
+ export function recurseNodes({ callback, nodes }) {
2
+ for (const node of nodes){
3
+ callback(node);
4
+ if ('children' in node && Array.isArray(node?.children) && node?.children?.length) {
5
+ recurseNodes({
6
+ callback,
7
+ nodes: node.children
8
+ });
9
+ }
10
+ }
11
+ }
12
+ export async function recurseNodesAsync({ callback, nodes }) {
13
+ for (const node of nodes){
14
+ await callback(node);
15
+ if ('children' in node && Array.isArray(node?.children) && node?.children?.length) {
16
+ await recurseNodesAsync({
17
+ callback,
18
+ nodes: node.children
19
+ });
20
+ }
21
+ }
22
+ }
23
+
24
+ //# sourceMappingURL=forEachNodeRecursively.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/forEachNodeRecursively.ts"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\n\nexport function recurseNodes({\n callback,\n nodes,\n}: {\n callback: (node: SerializedLexicalNode) => void\n nodes: SerializedLexicalNode[]\n}) {\n for (const node of nodes) {\n callback(node)\n\n if ('children' in node && Array.isArray(node?.children) && node?.children?.length) {\n recurseNodes({ callback, nodes: node.children as SerializedLexicalNode[] })\n }\n }\n}\n\nexport async function recurseNodesAsync({\n callback,\n nodes,\n}: {\n callback: (node: SerializedLexicalNode) => Promise<void>\n nodes: SerializedLexicalNode[]\n}) {\n for (const node of nodes) {\n await callback(node)\n\n if ('children' in node && Array.isArray(node?.children) && node?.children?.length) {\n await recurseNodesAsync({ callback, nodes: node.children as SerializedLexicalNode[] })\n }\n }\n}\n"],"names":["recurseNodes","callback","nodes","node","Array","isArray","children","length","recurseNodesAsync"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,OAAO,SAASA,aAAa,EAC3BC,QAAQ,EACRC,KAAK,EAIN;IACC,KAAK,MAAMC,QAAQD,MAAO;QACxBD,SAASE;QAET,IAAI,cAAcA,QAAQC,MAAMC,OAAO,CAACF,MAAMG,aAAaH,MAAMG,UAAUC,QAAQ;YACjFP,aAAa;gBAAEC;gBAAUC,OAAOC,KAAKG,QAAQ;YAA4B;QAC3E;IACF;AACF;AAEA,OAAO,eAAeE,kBAAkB,EACtCP,QAAQ,EACRC,KAAK,EAIN;IACC,KAAK,MAAMC,QAAQD,MAAO;QACxB,MAAMD,SAASE;QAEf,IAAI,cAAcA,QAAQC,MAAMC,OAAO,CAACF,MAAMG,aAAaH,MAAMG,UAAUC,QAAQ;YACjF,MAAMC,kBAAkB;gBAAEP;gBAAUC,OAAOC,KAAKG,QAAQ;YAA4B;QACtF;IACF;AACF"}
package/dist/index.d.ts CHANGED
@@ -25,6 +25,7 @@ export { SubscriptFeature } from './field/features/format/subscript/feature.serv
25
25
  export { SuperscriptFeature } from './field/features/format/superscript/feature.server.js';
26
26
  export { UnderlineFeature } from './field/features/format/underline/feature.server.js';
27
27
  export { HeadingFeature } from './field/features/heading/feature.server.js';
28
+ export { HorizontalRuleFeature } from './field/features/horizontalrule/feature.server.js';
28
29
  export { IndentFeature } from './field/features/indent/feature.server.js';
29
30
  export { LinkFeature, type LinkFeatureServerProps } from './field/features/link/feature.server.js';
30
31
  export { $createAutoLinkNode, $isAutoLinkNode, AutoLinkNode, } from './field/features/link/nodes/AutoLinkNode.js';
@@ -51,10 +52,10 @@ export { SlateToLexicalFeature } from './field/features/migrations/slateToLexica
51
52
  export { ParagraphFeature } from './field/features/paragraph/feature.server.js';
52
53
  export { RelationshipFeature } from './field/features/relationship/feature.server.js';
53
54
  export { $createRelationshipNode, $isRelationshipNode, type RelationshipData, RelationshipNode, type SerializedRelationshipNode, } from './field/features/relationship/nodes/RelationshipNode.js';
54
- export type { ClientFeature, ClientFeatureProviderMap, FeatureProviderClient, FeatureProviderProviderClient, FeatureProviderProviderServer, FeatureProviderServer, NodeValidation, PopulationPromise, ResolvedClientFeature, ResolvedClientFeatureMap, ResolvedServerFeature, ResolvedServerFeatureMap, SanitizedClientFeatures, SanitizedPlugin, SanitizedServerFeatures, ServerFeature, ServerFeatureProviderMap, } from './field/features/types.js';
55
+ export { createNode } from './field/features/typeUtilities.js';
56
+ export type { ClientComponentProps, ClientFeature, ClientFeatureProviderMap, FeatureProviderClient, FeatureProviderProviderClient, FeatureProviderProviderServer, FeatureProviderServer, FieldNodeHook, FieldNodeHookArgs, NodeValidation, NodeWithHooks, PopulationPromise, ResolvedClientFeature, ResolvedClientFeatureMap, ResolvedServerFeature, ResolvedServerFeatureMap, SanitizedClientFeatures, SanitizedPlugin, SanitizedServerFeatures, ServerFeature, ServerFeatureProviderMap, } from './field/features/types.js';
55
57
  export { UploadFeature } from './field/features/upload/feature.server.js';
56
58
  export type { UploadFeatureProps } from './field/features/upload/feature.server.js';
57
- export type { RawUploadPayload } from './field/features/upload/nodes/UploadNode.js';
58
59
  export { $createUploadNode, $isUploadNode, type SerializedUploadNode, type UploadData, UploadNode, } from './field/features/upload/nodes/UploadNode.js';
59
60
  export { EditorConfigProvider, useEditorConfigContext, } from './field/lexical/config/client/EditorConfigProvider.js';
60
61
  export { sanitizeClientEditorConfig, sanitizeClientFeatures, } from './field/lexical/config/client/sanitize.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AAiB1F,wBAAgB,aAAa,CAAC,KAAK,CAAC,EAAE,kBAAkB,GAAG,sBAAsB,CAyLhF;AAED,OAAO,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAA;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAA;AACjF,OAAO,EACL,aAAa,EACb,KAAK,kBAAkB,EACvB,KAAK,YAAY,GAClB,MAAM,2CAA2C,CAAA;AAClD,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,KAAK,WAAW,EAChB,SAAS,EACT,KAAK,mBAAmB,GACzB,MAAM,6CAA6C,CAAA;AAEpD,OAAO,EAAE,8BAA8B,EAAE,MAAM,2EAA2E,CAAA;AAC1H,OA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E,eAAe,EAAE,MAAM,0CAA0C,CAAA;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAA;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAA;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAA;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,mDAAmD,CAAA;AACnF,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,sBAAsB,EACtB,sBAAsB,EACtB,iBAAiB,EACjB,SAAS,EACT,kBAAkB,EAClB,UAAU,EACV,SAAS,EACT,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,qCAAqC,CAAA;AAC5C,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAA;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAA;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kDAAkD,CAAA;AAC1F,OAAO,EAAE,oCAAoC,EAAE,MAAM,+DAA+D,CAAA;AACpH,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,gCAAgC,CAAA;AACvC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AAEjE,YAAY,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA"}
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ import { sanitizeServerFeatures } from './field/lexical/config/server/sanitize.j
8
8
  import { cloneDeep } from './field/lexical/utils/cloneDeep.js';
9
9
  import { getGenerateComponentMap } from './generateComponentMap.js';
10
10
  import { getGenerateSchemaMap } from './generateSchemaMap.js';
11
- import { richTextRelationshipPromise } from './populate/richTextRelationshipPromise.js';
11
+ import { populateLexicalPopulationPromises } from './populate/populateLexicalPopulationPromises.js';
12
12
  import { richTextValidateHOC } from './validate/index.js';
13
13
  export function lexicalEditor(props) {
14
14
  let resolvedFeatureMap = null;
@@ -50,24 +50,6 @@ export function lexicalEditor(props) {
50
50
  lexicalEditorConfig: finalSanitizedEditorConfig.lexical
51
51
  }
52
52
  }),
53
- afterReadPromise: ({ field, incomingEditorState, siblingDoc })=>{
54
- return new Promise((resolve, reject)=>{
55
- const promises = [];
56
- if (finalSanitizedEditorConfig?.features?.hooks?.afterReadPromises?.length) {
57
- for (const afterReadPromise of finalSanitizedEditorConfig.features.hooks.afterReadPromises){
58
- const promise = afterReadPromise({
59
- field,
60
- incomingEditorState,
61
- siblingDoc
62
- });
63
- if (promise) {
64
- promises.push(promise);
65
- }
66
- }
67
- }
68
- Promise.all(promises).then(()=>resolve()).catch((error)=>reject(error));
69
- });
70
- },
71
53
  editorConfig: finalSanitizedEditorConfig,
72
54
  generateComponentMap: getGenerateComponentMap({
73
55
  resolvedFeatureMap
@@ -75,7 +57,103 @@ export function lexicalEditor(props) {
75
57
  generateSchemaMap: getGenerateSchemaMap({
76
58
  resolvedFeatureMap
77
59
  }),
78
- outputSchema: ({ collectionIDFieldTypes, config, field, interfaceNameDefinitions, isRequired })=>{
60
+ /* hooks: {
61
+ afterChange: finalSanitizedEditorConfig.features.hooks.afterChange,
62
+ afterRead: finalSanitizedEditorConfig.features.hooks.afterRead,
63
+ beforeChange: finalSanitizedEditorConfig.features.hooks.beforeChange,
64
+ beforeDuplicate: finalSanitizedEditorConfig.features.hooks.beforeDuplicate,
65
+ beforeValidate: finalSanitizedEditorConfig.features.hooks.beforeValidate,
66
+ },*/ /* // TODO: Figure out docWithLocales / originalSiblingDoc => node matching. Can't use indexes, as the order of nodes could technically change between hooks.
67
+ hooks: {
68
+ afterChange: [
69
+ async ({ context, findMany, operation, overrideAccess, req, value }) => {
70
+ await recurseNodesAsync({
71
+ callback: async (node) => {
72
+ const afterChangeHooks = finalSanitizedEditorConfig.features.hooks.afterChange
73
+ if (afterChangeHooks?.has(node.type)) {
74
+ for (const hook of afterChangeHooks.get(node.type)) {
75
+ node = await hook({ context, findMany, node, operation, overrideAccess, req })
76
+ }
77
+ }
78
+ },
79
+ nodes: (value as SerializedEditorState)?.root?.children ?? [],
80
+ })
81
+
82
+ return value
83
+ },
84
+ ],
85
+ afterRead: [
86
+ async ({ context, findMany, operation, overrideAccess, req, value }) => {
87
+ await recurseNodesAsync({
88
+ callback: async (node) => {
89
+ const afterReadHooks = finalSanitizedEditorConfig.features.hooks.afterRead
90
+ if (afterReadHooks?.has(node.type)) {
91
+ for (const hook of afterReadHooks.get(node.type)) {
92
+ node = await hook({ context, findMany, node, operation, overrideAccess, req })
93
+ }
94
+ }
95
+ },
96
+ nodes: (value as SerializedEditorState)?.root?.children ?? [],
97
+ })
98
+
99
+ return value
100
+ },
101
+ ],
102
+ beforeChange: [
103
+ async ({ context, findMany, operation, overrideAccess, req, value }) => {
104
+ await recurseNodesAsync({
105
+ callback: async (node) => {
106
+ const beforeChangeHooks = finalSanitizedEditorConfig.features.hooks.beforeChange
107
+ if (beforeChangeHooks?.has(node.type)) {
108
+ for (const hook of beforeChangeHooks.get(node.type)) {
109
+ node = await hook({ context, findMany, node, operation, overrideAccess, req })
110
+ }
111
+ }
112
+ },
113
+ nodes: (value as SerializedEditorState)?.root?.children ?? [],
114
+ })
115
+
116
+ return value
117
+ },
118
+ ],
119
+ beforeDuplicate: [
120
+ async ({ context, findMany, operation, overrideAccess, req, value }) => {
121
+ await recurseNodesAsync({
122
+ callback: async (node) => {
123
+ const beforeDuplicateHooks = finalSanitizedEditorConfig.features.hooks.beforeDuplicate
124
+ if (beforeDuplicateHooks?.has(node.type)) {
125
+ for (const hook of beforeDuplicateHooks.get(node.type)) {
126
+ node = await hook({ context, findMany, node, operation, overrideAccess, req })
127
+ }
128
+ }
129
+ },
130
+ nodes: (value as SerializedEditorState)?.root?.children ?? [],
131
+ })
132
+
133
+ return value
134
+ },
135
+ ],
136
+ beforeValidate: [
137
+ async ({ context, findMany, operation, overrideAccess, req, value }) => {
138
+ await recurseNodesAsync({
139
+ callback: async (node) => {
140
+ const beforeValidateHooks = finalSanitizedEditorConfig.features.hooks.beforeValidate
141
+ if (beforeValidateHooks?.has(node.type)) {
142
+ for (const hook of beforeValidateHooks.get(node.type)) {
143
+ /**
144
+ * We cannot pass the originalNode here, as there is no way to map one node to a previous one, as a previous originalNode might be in a different position
145
+ */ /*
146
+ node = await hook({ context, findMany, node, operation, overrideAccess, req })
147
+ }
148
+ }
149
+ },
150
+ nodes: (value as SerializedEditorState)?.root?.children ?? [],
151
+ })
152
+
153
+ return value
154
+ },
155
+ ],
156
+ },*/ outputSchema: ({ collectionIDFieldTypes, config, field, interfaceNameDefinitions, isRequired })=>{
79
157
  let outputSchema = {
80
158
  // This schema matches the SerializedEditorState type so far, that it's possible to cast SerializedEditorState to this schema without any errors.
81
159
  // In the future, we should
@@ -167,15 +245,16 @@ export function lexicalEditor(props) {
167
245
  }
168
246
  return outputSchema;
169
247
  },
170
- populationPromise ({ context, currentDepth, depth, field, findMany, flattenLocales, overrideAccess, populationPromises, req, showHiddenFields, siblingDoc }) {
248
+ populationPromises ({ context, currentDepth, depth, field, fieldPromises, findMany, flattenLocales, overrideAccess, populationPromises, req, showHiddenFields, siblingDoc }) {
171
249
  // check if there are any features with nodes which have populationPromises for this field
172
250
  if (finalSanitizedEditorConfig?.features?.populationPromises?.size) {
173
- return richTextRelationshipPromise({
251
+ populateLexicalPopulationPromises({
174
252
  context,
175
253
  currentDepth,
176
254
  depth,
177
255
  editorPopulationPromises: finalSanitizedEditorConfig.features.populationPromises,
178
256
  field,
257
+ fieldPromises,
179
258
  findMany,
180
259
  flattenLocales,
181
260
  overrideAccess,
@@ -185,7 +264,6 @@ export function lexicalEditor(props) {
185
264
  siblingDoc
186
265
  });
187
266
  }
188
- return null;
189
267
  },
190
268
  validate: richTextValidateHOC({
191
269
  editorConfig: finalSanitizedEditorConfig
@@ -216,6 +294,7 @@ export { SubscriptFeature } from './field/features/format/subscript/feature.serv
216
294
  export { SuperscriptFeature } from './field/features/format/superscript/feature.server.js';
217
295
  export { UnderlineFeature } from './field/features/format/underline/feature.server.js';
218
296
  export { HeadingFeature } from './field/features/heading/feature.server.js';
297
+ export { HorizontalRuleFeature } from './field/features/horizontalrule/feature.server.js';
219
298
  export { IndentFeature } from './field/features/indent/feature.server.js';
220
299
  export { LinkFeature } from './field/features/link/feature.server.js';
221
300
  export { $createAutoLinkNode, $isAutoLinkNode, AutoLinkNode } from './field/features/link/nodes/AutoLinkNode.js';
@@ -240,6 +319,7 @@ export { SlateToLexicalFeature } from './field/features/migrations/slateToLexica
240
319
  export { ParagraphFeature } from './field/features/paragraph/feature.server.js';
241
320
  export { RelationshipFeature } from './field/features/relationship/feature.server.js';
242
321
  export { $createRelationshipNode, $isRelationshipNode, RelationshipNode } from './field/features/relationship/nodes/RelationshipNode.js';
322
+ export { createNode } from './field/features/typeUtilities.js';
243
323
  export { UploadFeature } from './field/features/upload/feature.server.js';
244
324
  export { $createUploadNode, $isUploadNode, UploadNode } from './field/features/upload/nodes/UploadNode.js';
245
325
  export { EditorConfigProvider, useEditorConfigContext } from './field/lexical/config/client/EditorConfigProvider.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { JSONSchema4 } from 'json-schema'\nimport type { EditorConfig as LexicalEditorConfig } from 'lexical/LexicalEditor.js'\n\nimport { withMergedProps } from '@payloadcms/ui/elements/withMergedProps'\nimport { withNullableJSONSchemaType } from 'payload/utilities'\n\nimport type { FeatureProviderServer, ResolvedServerFeatureMap } from './field/features/types.js'\nimport type { SanitizedServerEditorConfig } from './field/lexical/config/types.js'\nimport type { AdapterProps, LexicalEditorProps, LexicalRichTextAdapter } from './types.js'\n\nimport { RichTextCell } from './cell/index.js'\nimport { RichTextField } from './field/index.js'\nimport {\n defaultEditorConfig,\n defaultEditorFeatures,\n defaultSanitizedServerEditorConfig,\n} from './field/lexical/config/server/default.js'\nimport { loadFeatures } from './field/lexical/config/server/loader.js'\nimport { sanitizeServerFeatures } from './field/lexical/config/server/sanitize.js'\nimport { cloneDeep } from './field/lexical/utils/cloneDeep.js'\nimport { getGenerateComponentMap } from './generateComponentMap.js'\nimport { getGenerateSchemaMap } from './generateSchemaMap.js'\nimport { richTextRelationshipPromise } from './populate/richTextRelationshipPromise.js'\nimport { richTextValidateHOC } from './validate/index.js'\n\nexport function lexicalEditor(props?: LexicalEditorProps): LexicalRichTextAdapter {\n let resolvedFeatureMap: ResolvedServerFeatureMap = null\n\n let finalSanitizedEditorConfig: SanitizedServerEditorConfig // For server only\n if (!props || (!props.features && !props.lexical)) {\n finalSanitizedEditorConfig = cloneDeep(defaultSanitizedServerEditorConfig)\n resolvedFeatureMap = finalSanitizedEditorConfig.resolvedFeatureMap\n } else {\n let features: FeatureProviderServer<unknown, unknown>[] =\n props.features && typeof props.features === 'function'\n ? props.features({ defaultFeatures: cloneDeep(defaultEditorFeatures) })\n : (props.features as FeatureProviderServer<unknown, unknown>[])\n if (!features) {\n features = cloneDeep(defaultEditorFeatures)\n }\n\n const lexical: LexicalEditorConfig = props.lexical\n\n resolvedFeatureMap = loadFeatures({\n unSanitizedEditorConfig: {\n features,\n lexical: lexical ? lexical : defaultEditorConfig.lexical,\n },\n })\n\n finalSanitizedEditorConfig = {\n features: sanitizeServerFeatures(resolvedFeatureMap),\n lexical: lexical ? lexical : defaultEditorConfig.lexical,\n resolvedFeatureMap,\n }\n }\n\n return {\n CellComponent: withMergedProps({\n Component: RichTextCell,\n toMergeIntoProps: { lexicalEditorConfig: finalSanitizedEditorConfig.lexical },\n }),\n FieldComponent: withMergedProps({\n Component: RichTextField,\n toMergeIntoProps: { lexicalEditorConfig: finalSanitizedEditorConfig.lexical },\n }),\n afterReadPromise: ({ field, incomingEditorState, siblingDoc }) => {\n return new Promise<void>((resolve, reject) => {\n const promises: Promise<void>[] = []\n\n if (finalSanitizedEditorConfig?.features?.hooks?.afterReadPromises?.length) {\n for (const afterReadPromise of finalSanitizedEditorConfig.features.hooks\n .afterReadPromises) {\n const promise = afterReadPromise({\n field,\n incomingEditorState,\n siblingDoc,\n })\n if (promise) {\n promises.push(promise)\n }\n }\n }\n\n Promise.all(promises)\n .then(() => resolve())\n .catch((error) => reject(error))\n })\n },\n editorConfig: finalSanitizedEditorConfig,\n generateComponentMap: getGenerateComponentMap({\n resolvedFeatureMap,\n }),\n generateSchemaMap: getGenerateSchemaMap({\n resolvedFeatureMap,\n }),\n outputSchema: ({\n collectionIDFieldTypes,\n config,\n field,\n interfaceNameDefinitions,\n isRequired,\n }) => {\n let outputSchema: JSONSchema4 = {\n // This schema matches the SerializedEditorState type so far, that it's possible to cast SerializedEditorState to this schema without any errors.\n // In the future, we should\n // 1) allow recursive children\n // 2) Pass in all the different types for every node added to the editorconfig. This can be done with refs in the schema.\n type: withNullableJSONSchemaType('object', isRequired),\n properties: {\n root: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: {\n type: 'string',\n },\n children: {\n type: 'array',\n items: {\n type: 'object',\n additionalProperties: true,\n properties: {\n type: {\n type: 'string',\n },\n version: {\n type: 'integer',\n },\n },\n required: ['type', 'version'],\n },\n },\n direction: {\n oneOf: [\n {\n enum: ['ltr', 'rtl'],\n },\n {\n type: 'null',\n },\n ],\n },\n format: {\n type: 'string',\n enum: ['left', 'start', 'center', 'right', 'end', 'justify', ''], // ElementFormatType, since the root node is an element\n },\n indent: {\n type: 'integer',\n },\n version: {\n type: 'integer',\n },\n },\n required: ['children', 'direction', 'format', 'indent', 'type', 'version'],\n },\n },\n required: ['root'],\n }\n for (const modifyOutputSchema of finalSanitizedEditorConfig.features.generatedTypes\n .modifyOutputSchemas) {\n outputSchema = modifyOutputSchema({\n collectionIDFieldTypes,\n config,\n currentSchema: outputSchema,\n field,\n interfaceNameDefinitions,\n isRequired,\n })\n }\n\n return outputSchema\n },\n populationPromise({\n context,\n currentDepth,\n depth,\n field,\n findMany,\n flattenLocales,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc,\n }) {\n // check if there are any features with nodes which have populationPromises for this field\n if (finalSanitizedEditorConfig?.features?.populationPromises?.size) {\n return richTextRelationshipPromise({\n context,\n currentDepth,\n depth,\n editorPopulationPromises: finalSanitizedEditorConfig.features.populationPromises,\n field,\n findMany,\n flattenLocales,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc,\n })\n }\n\n return null\n },\n validate: richTextValidateHOC({\n editorConfig: finalSanitizedEditorConfig,\n }),\n }\n}\n\nexport { AlignFeature } from './field/features/align/feature.server.js'\nexport { BlockQuoteFeature } from './field/features/blockquote/feature.server.js'\nexport {\n BlocksFeature,\n type BlocksFeatureProps,\n type LexicalBlock,\n} from './field/features/blocks/feature.server.js'\nexport {\n $createBlockNode,\n $isBlockNode,\n type BlockFields,\n BlockNode,\n type SerializedBlockNode,\n} from './field/features/blocks/nodes/BlocksNode.js'\n\nexport { TextDropdownSectionWithEntries } from './field/features/common/floatingSelectToolbarTextDropdownSection/index.js'\nexport { LinebreakHTMLConverter } from './field/features/converters/html/converter/converters/linebreak.js'\nexport { ParagraphHTMLConverter } from './field/features/converters/html/converter/converters/paragraph.js'\n\nexport { TextHTMLConverter } from './field/features/converters/html/converter/converters/text.js'\nexport { defaultHTMLConverters } from './field/features/converters/html/converter/defaultConverters.js'\nexport {\n convertLexicalNodesToHTML,\n convertLexicalToHTML,\n} from './field/features/converters/html/converter/index.js'\nexport type { HTMLConverter } from './field/features/converters/html/converter/types.js'\nexport {\n HTMLConverterFeature,\n type HTMLConverterFeatureProps,\n} from './field/features/converters/html/feature.server.js'\nexport {\n consolidateHTMLConverters,\n lexicalHTML,\n} from './field/features/converters/html/field/index.js'\nexport { createClientComponent } from './field/features/createClientComponent.js'\nexport { TestRecorderFeature } from './field/features/debug/testrecorder/feature.server.js'\nexport { TreeViewFeature } from './field/features/debug/treeview/feature.server.js'\nexport { BoldFeature } from './field/features/format/bold/feature.server.js'\nexport { SectionWithEntries as FormatSectionWithEntries } from './field/features/format/common/floatingSelectToolbarSection.js'\nexport { InlineCodeFeature } from './field/features/format/inlinecode/feature.server.js'\nexport { ItalicFeature } from './field/features/format/italic/feature.server.js'\nexport { StrikethroughFeature } from './field/features/format/strikethrough/feature.server.js'\nexport { SubscriptFeature } from './field/features/format/subscript/feature.server.js'\nexport { SuperscriptFeature } from './field/features/format/superscript/feature.server.js'\nexport { UnderlineFeature } from './field/features/format/underline/feature.server.js'\n\nexport { HeadingFeature } from './field/features/heading/feature.server.js'\nexport { IndentFeature } from './field/features/indent/feature.server.js'\n\nexport { LinkFeature, type LinkFeatureServerProps } from './field/features/link/feature.server.js'\nexport {\n $createAutoLinkNode,\n $isAutoLinkNode,\n AutoLinkNode,\n} from './field/features/link/nodes/AutoLinkNode.js'\nexport {\n $createLinkNode,\n $isLinkNode,\n LinkNode,\n TOGGLE_LINK_COMMAND,\n} from './field/features/link/nodes/LinkNode.js'\nexport type {\n LinkFields,\n SerializedAutoLinkNode,\n SerializedLinkNode,\n} from './field/features/link/nodes/types.js'\nexport { CheckListFeature } from './field/features/lists/checklist/feature.server.js'\nexport { OrderedListFeature } from './field/features/lists/orderedlist/feature.server.js'\nexport { UnorderedListFeature } from './field/features/lists/unorderedlist/feature.server.js'\nexport { LexicalPluginToLexicalFeature } from './field/features/migrations/lexicalPluginToLexical/feature.server.js'\nexport { SlateBlockquoteConverter } from './field/features/migrations/slateToLexical/converter/converters/blockquote/index.js'\nexport { SlateHeadingConverter } from './field/features/migrations/slateToLexical/converter/converters/heading/index.js'\nexport { SlateIndentConverter } from './field/features/migrations/slateToLexical/converter/converters/indent/index.js'\nexport { SlateLinkConverter } from './field/features/migrations/slateToLexical/converter/converters/link/index.js'\nexport { SlateListItemConverter } from './field/features/migrations/slateToLexical/converter/converters/listItem/index.js'\nexport { SlateOrderedListConverter } from './field/features/migrations/slateToLexical/converter/converters/orderedList/index.js'\nexport { SlateRelationshipConverter } from './field/features/migrations/slateToLexical/converter/converters/relationship/index.js'\nexport { SlateUnknownConverter } from './field/features/migrations/slateToLexical/converter/converters/unknown/index.js'\nexport { SlateUnorderedListConverter } from './field/features/migrations/slateToLexical/converter/converters/unorderedList/index.js'\n\nexport { SlateUploadConverter } from './field/features/migrations/slateToLexical/converter/converters/upload/index.js'\nexport { defaultSlateConverters } from './field/features/migrations/slateToLexical/converter/defaultConverters.js'\nexport {\n convertSlateNodesToLexical,\n convertSlateToLexical,\n} from './field/features/migrations/slateToLexical/converter/index.js'\n\nexport type {\n SlateNode,\n SlateNodeConverter,\n} from './field/features/migrations/slateToLexical/converter/types.js'\nexport { SlateToLexicalFeature } from './field/features/migrations/slateToLexical/feature.server.js'\nexport { ParagraphFeature } from './field/features/paragraph/feature.server.js'\nexport { RelationshipFeature } from './field/features/relationship/feature.server.js'\nexport {\n $createRelationshipNode,\n $isRelationshipNode,\n type RelationshipData,\n RelationshipNode,\n type SerializedRelationshipNode,\n} from './field/features/relationship/nodes/RelationshipNode.js'\nexport type {\n ClientFeature,\n ClientFeatureProviderMap,\n FeatureProviderClient,\n FeatureProviderProviderClient,\n FeatureProviderProviderServer,\n FeatureProviderServer,\n NodeValidation,\n PopulationPromise,\n ResolvedClientFeature,\n ResolvedClientFeatureMap,\n ResolvedServerFeature,\n ResolvedServerFeatureMap,\n SanitizedClientFeatures,\n SanitizedPlugin,\n SanitizedServerFeatures,\n ServerFeature,\n ServerFeatureProviderMap,\n} from './field/features/types.js'\nexport { UploadFeature } from './field/features/upload/feature.server.js'\n\nexport type { UploadFeatureProps } from './field/features/upload/feature.server.js'\n\nexport type { RawUploadPayload } from './field/features/upload/nodes/UploadNode.js'\n\nexport {\n $createUploadNode,\n $isUploadNode,\n type SerializedUploadNode,\n type UploadData,\n UploadNode,\n} from './field/features/upload/nodes/UploadNode.js'\nexport {\n EditorConfigProvider,\n useEditorConfigContext,\n} from './field/lexical/config/client/EditorConfigProvider.js'\nexport {\n sanitizeClientEditorConfig,\n sanitizeClientFeatures,\n} from './field/lexical/config/client/sanitize.js'\nexport {\n defaultEditorConfig,\n defaultEditorFeatures,\n defaultEditorLexicalConfig,\n defaultSanitizedServerEditorConfig,\n} from './field/lexical/config/server/default.js'\nexport {\n loadFeatures,\n sortFeaturesForOptimalLoading,\n} from './field/lexical/config/server/loader.js'\nexport {\n sanitizeServerEditorConfig,\n sanitizeServerFeatures,\n} from './field/lexical/config/server/sanitize.js'\n\nexport type {\n ClientEditorConfig,\n SanitizedClientEditorConfig,\n SanitizedServerEditorConfig,\n ServerEditorConfig,\n} from './field/lexical/config/types.js'\nexport { getEnabledNodes } from './field/lexical/nodes/index.js'\n\nexport {\n type FloatingToolbarSection,\n type FloatingToolbarSectionEntry,\n} from './field/lexical/plugins/FloatingSelectToolbar/types.js'\nexport { ENABLE_SLASH_MENU_COMMAND } from './field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js'\nexport type { AdapterProps }\n\nexport {\n SlashMenuGroup,\n SlashMenuOption,\n} from './field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js'\nexport { CAN_USE_DOM } from './field/lexical/utils/canUseDOM.js'\nexport { cloneDeep } from './field/lexical/utils/cloneDeep.js'\nexport { getDOMRangeRect } from './field/lexical/utils/getDOMRangeRect.js'\nexport { getSelectedNode } from './field/lexical/utils/getSelectedNode.js'\nexport { isHTMLElement } from './field/lexical/utils/guard.js'\nexport { invariant } from './field/lexical/utils/invariant.js'\nexport { joinClasses } from './field/lexical/utils/joinClasses.js'\nexport { createBlockNode } from './field/lexical/utils/markdown/createBlockNode.js'\nexport {\n DETAIL_TYPE_TO_DETAIL,\n DOUBLE_LINE_BREAK,\n ELEMENT_FORMAT_TO_TYPE,\n ELEMENT_TYPE_TO_FORMAT,\n IS_ALL_FORMATTING,\n LTR_REGEX,\n NON_BREAKING_SPACE,\n NodeFormat,\n RTL_REGEX,\n TEXT_MODE_TO_TYPE,\n TEXT_TYPE_TO_FORMAT,\n TEXT_TYPE_TO_MODE,\n} from './field/lexical/utils/nodeFormat.js'\nexport { Point, isPoint } from './field/lexical/utils/point.js'\nexport { Rect } from './field/lexical/utils/rect.js'\nexport { setFloatingElemPosition } from './field/lexical/utils/setFloatingElemPosition.js'\nexport { setFloatingElemPositionForLinkEditor } from './field/lexical/utils/setFloatingElemPositionForLinkEditor.js'\nexport {\n addSwipeDownListener,\n addSwipeLeftListener,\n addSwipeRightListener,\n addSwipeUpListener,\n} from './field/lexical/utils/swipe.js'\nexport { sanitizeUrl, validateUrl } from './field/lexical/utils/url.js'\nexport { defaultRichTextValue } from './populate/defaultValue.js'\n\nexport type { LexicalEditorProps, LexicalRichTextAdapter } from './types.js'\n"],"names":["withMergedProps","withNullableJSONSchemaType","RichTextCell","RichTextField","defaultEditorConfig","defaultEditorFeatures","defaultSanitizedServerEditorConfig","loadFeatures","sanitizeServerFeatures","cloneDeep","getGenerateComponentMap","getGenerateSchemaMap","richTextRelationshipPromise","richTextValidateHOC","lexicalEditor","props","resolvedFeatureMap","finalSanitizedEditorConfig","features","lexical","defaultFeatures","unSanitizedEditorConfig","CellComponent","Component","toMergeIntoProps","lexicalEditorConfig","FieldComponent","afterReadPromise","field","incomingEditorState","siblingDoc","Promise","resolve","reject","promises","hooks","afterReadPromises","length","promise","push","all","then","catch","error","editorConfig","generateComponentMap","generateSchemaMap","outputSchema","collectionIDFieldTypes","config","interfaceNameDefinitions","isRequired","type","properties","root","additionalProperties","children","items","version","required","direction","oneOf","enum","format","indent","modifyOutputSchema","generatedTypes","modifyOutputSchemas","currentSchema","populationPromise","context","currentDepth","depth","findMany","flattenLocales","overrideAccess","populationPromises","req","showHiddenFields","size","editorPopulationPromises","validate","AlignFeature","BlockQuoteFeature","BlocksFeature","$createBlockNode","$isBlockNode","BlockNode","TextDropdownSectionWithEntries","LinebreakHTMLConverter","ParagraphHTMLConverter","TextHTMLConverter","defaultHTMLConverters","convertLexicalNodesToHTML","convertLexicalToHTML","HTMLConverterFeature","consolidateHTMLConverters","lexicalHTML","createClientComponent","TestRecorderFeature","TreeViewFeature","BoldFeature","SectionWithEntries","FormatSectionWithEntries","InlineCodeFeature","ItalicFeature","StrikethroughFeature","SubscriptFeature","SuperscriptFeature","UnderlineFeature","HeadingFeature","IndentFeature","LinkFeature","$createAutoLinkNode","$isAutoLinkNode","AutoLinkNode","$createLinkNode","$isLinkNode","LinkNode","TOGGLE_LINK_COMMAND","CheckListFeature","OrderedListFeature","UnorderedListFeature","LexicalPluginToLexicalFeature","SlateBlockquoteConverter","SlateHeadingConverter","SlateIndentConverter","SlateLinkConverter","SlateListItemConverter","SlateOrderedListConverter","SlateRelationshipConverter","SlateUnknownConverter","SlateUnorderedListConverter","SlateUploadConverter","defaultSlateConverters","convertSlateNodesToLexical","convertSlateToLexical","SlateToLexicalFeature","ParagraphFeature","RelationshipFeature","$createRelationshipNode","$isRelationshipNode","RelationshipNode","UploadFeature","$createUploadNode","$isUploadNode","UploadNode","EditorConfigProvider","useEditorConfigContext","sanitizeClientEditorConfig","sanitizeClientFeatures","defaultEditorLexicalConfig","sortFeaturesForOptimalLoading","sanitizeServerEditorConfig","getEnabledNodes","ENABLE_SLASH_MENU_COMMAND","SlashMenuGroup","SlashMenuOption","CAN_USE_DOM","getDOMRangeRect","getSelectedNode","isHTMLElement","invariant","joinClasses","createBlockNode","DETAIL_TYPE_TO_DETAIL","DOUBLE_LINE_BREAK","ELEMENT_FORMAT_TO_TYPE","ELEMENT_TYPE_TO_FORMAT","IS_ALL_FORMATTING","LTR_REGEX","NON_BREAKING_SPACE","NodeFormat","RTL_REGEX","TEXT_MODE_TO_TYPE","TEXT_TYPE_TO_FORMAT","TEXT_TYPE_TO_MODE","Point","isPoint","Rect","setFloatingElemPosition","setFloatingElemPositionForLinkEditor","addSwipeDownListener","addSwipeLeftListener","addSwipeRightListener","addSwipeUpListener","sanitizeUrl","validateUrl","defaultRichTextValue"],"rangeMappings":";;;;;;;;;;;;;;;;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AAQlD,SAASkJ,eAAe,QAAQ,iCAAgC;AAMhE,SAASC,yBAAyB,QAAQ,wEAAuE;AAGjH,SACEC,cAAc,EACdC,eAAe,QACV,wEAAuE;AAC9E,SAASC,WAAW,QAAQ,qCAAoC;AAChE,SAASrJ,SAAS,QAAQ,qCAAoC;AAC9D,SAASsJ,eAAe,QAAQ,2CAA0C;AAC1E,SAASC,eAAe,QAAQ,2CAA0C;AAC1E,SAASC,aAAa,QAAQ,iCAAgC;AAC9D,SAASC,SAAS,QAAQ,qCAAoC;AAC9D,SAASC,WAAW,QAAQ,uCAAsC;AAClE,SAASC,eAAe,QAAQ,oDAAmD;AACnF,SACEC,qBAAqB,EACrBC,iBAAiB,EACjBC,sBAAsB,EACtBC,sBAAsB,EACtBC,iBAAiB,EACjBC,SAAS,EACTC,kBAAkB,EAClBC,UAAU,EACVC,SAAS,EACTC,iBAAiB,EACjBC,mBAAmB,EACnBC,iBAAiB,QACZ,sCAAqC;AAC5C,SAASC,KAAK,EAAEC,OAAO,QAAQ,iCAAgC;AAC/D,SAASC,IAAI,QAAQ,gCAA+B;AACpD,SAASC,uBAAuB,QAAQ,mDAAkD;AAC1F,SAASC,oCAAoC,QAAQ,gEAA+D;AACpH,SACEC,oBAAoB,EACpBC,oBAAoB,EACpBC,qBAAqB,EACrBC,kBAAkB,QACb,iCAAgC;AACvC,SAASC,WAAW,EAAEC,WAAW,QAAQ,+BAA8B;AACvE,SAASC,oBAAoB,QAAQ,6BAA4B"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { JSONSchema4 } from 'json-schema'\nimport type { SerializedEditorState } from 'lexical'\nimport type { EditorConfig as LexicalEditorConfig } from 'lexical/LexicalEditor.js'\n\nimport { withMergedProps } from '@payloadcms/ui/elements/withMergedProps'\nimport { withNullableJSONSchemaType } from 'payload/utilities'\n\nimport type { FeatureProviderServer, ResolvedServerFeatureMap } from './field/features/types.js'\nimport type { SanitizedServerEditorConfig } from './field/lexical/config/types.js'\nimport type { AdapterProps, LexicalEditorProps, LexicalRichTextAdapter } from './types.js'\n\nimport { RichTextCell } from './cell/index.js'\nimport { RichTextField } from './field/index.js'\nimport {\n defaultEditorConfig,\n defaultEditorFeatures,\n defaultSanitizedServerEditorConfig,\n} from './field/lexical/config/server/default.js'\nimport { loadFeatures } from './field/lexical/config/server/loader.js'\nimport { sanitizeServerFeatures } from './field/lexical/config/server/sanitize.js'\nimport { cloneDeep } from './field/lexical/utils/cloneDeep.js'\nimport { recurseNodes, recurseNodesAsync } from './forEachNodeRecursively.js'\nimport { getGenerateComponentMap } from './generateComponentMap.js'\nimport { getGenerateSchemaMap } from './generateSchemaMap.js'\nimport { populateLexicalPopulationPromises } from './populate/populateLexicalPopulationPromises.js'\nimport { richTextValidateHOC } from './validate/index.js'\n\nexport function lexicalEditor(props?: LexicalEditorProps): LexicalRichTextAdapter {\n let resolvedFeatureMap: ResolvedServerFeatureMap = null\n\n let finalSanitizedEditorConfig: SanitizedServerEditorConfig // For server only\n if (!props || (!props.features && !props.lexical)) {\n finalSanitizedEditorConfig = cloneDeep(defaultSanitizedServerEditorConfig)\n resolvedFeatureMap = finalSanitizedEditorConfig.resolvedFeatureMap\n } else {\n let features: FeatureProviderServer<unknown, unknown>[] =\n props.features && typeof props.features === 'function'\n ? props.features({ defaultFeatures: cloneDeep(defaultEditorFeatures) })\n : (props.features as FeatureProviderServer<unknown, unknown>[])\n if (!features) {\n features = cloneDeep(defaultEditorFeatures)\n }\n\n const lexical: LexicalEditorConfig = props.lexical\n\n resolvedFeatureMap = loadFeatures({\n unSanitizedEditorConfig: {\n features,\n lexical: lexical ? lexical : defaultEditorConfig.lexical,\n },\n })\n\n finalSanitizedEditorConfig = {\n features: sanitizeServerFeatures(resolvedFeatureMap),\n lexical: lexical ? lexical : defaultEditorConfig.lexical,\n resolvedFeatureMap,\n }\n }\n\n return {\n CellComponent: withMergedProps({\n Component: RichTextCell,\n toMergeIntoProps: { lexicalEditorConfig: finalSanitizedEditorConfig.lexical },\n }),\n FieldComponent: withMergedProps({\n Component: RichTextField,\n toMergeIntoProps: { lexicalEditorConfig: finalSanitizedEditorConfig.lexical },\n }),\n editorConfig: finalSanitizedEditorConfig,\n generateComponentMap: getGenerateComponentMap({\n resolvedFeatureMap,\n }),\n generateSchemaMap: getGenerateSchemaMap({\n resolvedFeatureMap,\n }),\n /* hooks: {\n afterChange: finalSanitizedEditorConfig.features.hooks.afterChange,\n afterRead: finalSanitizedEditorConfig.features.hooks.afterRead,\n beforeChange: finalSanitizedEditorConfig.features.hooks.beforeChange,\n beforeDuplicate: finalSanitizedEditorConfig.features.hooks.beforeDuplicate,\n beforeValidate: finalSanitizedEditorConfig.features.hooks.beforeValidate,\n },*/\n /* // TODO: Figure out docWithLocales / originalSiblingDoc => node matching. Can't use indexes, as the order of nodes could technically change between hooks.\n hooks: {\n afterChange: [\n async ({ context, findMany, operation, overrideAccess, req, value }) => {\n await recurseNodesAsync({\n callback: async (node) => {\n const afterChangeHooks = finalSanitizedEditorConfig.features.hooks.afterChange\n if (afterChangeHooks?.has(node.type)) {\n for (const hook of afterChangeHooks.get(node.type)) {\n node = await hook({ context, findMany, node, operation, overrideAccess, req })\n }\n }\n },\n nodes: (value as SerializedEditorState)?.root?.children ?? [],\n })\n\n return value\n },\n ],\n afterRead: [\n async ({ context, findMany, operation, overrideAccess, req, value }) => {\n await recurseNodesAsync({\n callback: async (node) => {\n const afterReadHooks = finalSanitizedEditorConfig.features.hooks.afterRead\n if (afterReadHooks?.has(node.type)) {\n for (const hook of afterReadHooks.get(node.type)) {\n node = await hook({ context, findMany, node, operation, overrideAccess, req })\n }\n }\n },\n nodes: (value as SerializedEditorState)?.root?.children ?? [],\n })\n\n return value\n },\n ],\n beforeChange: [\n async ({ context, findMany, operation, overrideAccess, req, value }) => {\n await recurseNodesAsync({\n callback: async (node) => {\n const beforeChangeHooks = finalSanitizedEditorConfig.features.hooks.beforeChange\n if (beforeChangeHooks?.has(node.type)) {\n for (const hook of beforeChangeHooks.get(node.type)) {\n node = await hook({ context, findMany, node, operation, overrideAccess, req })\n }\n }\n },\n nodes: (value as SerializedEditorState)?.root?.children ?? [],\n })\n\n return value\n },\n ],\n beforeDuplicate: [\n async ({ context, findMany, operation, overrideAccess, req, value }) => {\n await recurseNodesAsync({\n callback: async (node) => {\n const beforeDuplicateHooks = finalSanitizedEditorConfig.features.hooks.beforeDuplicate\n if (beforeDuplicateHooks?.has(node.type)) {\n for (const hook of beforeDuplicateHooks.get(node.type)) {\n node = await hook({ context, findMany, node, operation, overrideAccess, req })\n }\n }\n },\n nodes: (value as SerializedEditorState)?.root?.children ?? [],\n })\n\n return value\n },\n ],\n beforeValidate: [\n async ({ context, findMany, operation, overrideAccess, req, value }) => {\n await recurseNodesAsync({\n callback: async (node) => {\n const beforeValidateHooks = finalSanitizedEditorConfig.features.hooks.beforeValidate\n if (beforeValidateHooks?.has(node.type)) {\n for (const hook of beforeValidateHooks.get(node.type)) {\n /**\n * We cannot pass the originalNode here, as there is no way to map one node to a previous one, as a previous originalNode might be in a different position\n */ /*\n node = await hook({ context, findMany, node, operation, overrideAccess, req })\n }\n }\n },\n nodes: (value as SerializedEditorState)?.root?.children ?? [],\n })\n\n return value\n },\n ],\n },*/\n outputSchema: ({\n collectionIDFieldTypes,\n config,\n field,\n interfaceNameDefinitions,\n isRequired,\n }) => {\n let outputSchema: JSONSchema4 = {\n // This schema matches the SerializedEditorState type so far, that it's possible to cast SerializedEditorState to this schema without any errors.\n // In the future, we should\n // 1) allow recursive children\n // 2) Pass in all the different types for every node added to the editorconfig. This can be done with refs in the schema.\n type: withNullableJSONSchemaType('object', isRequired),\n properties: {\n root: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: {\n type: 'string',\n },\n children: {\n type: 'array',\n items: {\n type: 'object',\n additionalProperties: true,\n properties: {\n type: {\n type: 'string',\n },\n version: {\n type: 'integer',\n },\n },\n required: ['type', 'version'],\n },\n },\n direction: {\n oneOf: [\n {\n enum: ['ltr', 'rtl'],\n },\n {\n type: 'null',\n },\n ],\n },\n format: {\n type: 'string',\n enum: ['left', 'start', 'center', 'right', 'end', 'justify', ''], // ElementFormatType, since the root node is an element\n },\n indent: {\n type: 'integer',\n },\n version: {\n type: 'integer',\n },\n },\n required: ['children', 'direction', 'format', 'indent', 'type', 'version'],\n },\n },\n required: ['root'],\n }\n for (const modifyOutputSchema of finalSanitizedEditorConfig.features.generatedTypes\n .modifyOutputSchemas) {\n outputSchema = modifyOutputSchema({\n collectionIDFieldTypes,\n config,\n currentSchema: outputSchema,\n field,\n interfaceNameDefinitions,\n isRequired,\n })\n }\n\n return outputSchema\n },\n populationPromises({\n context,\n currentDepth,\n depth,\n field,\n fieldPromises,\n findMany,\n flattenLocales,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc,\n }) {\n // check if there are any features with nodes which have populationPromises for this field\n if (finalSanitizedEditorConfig?.features?.populationPromises?.size) {\n populateLexicalPopulationPromises({\n context,\n currentDepth,\n depth,\n editorPopulationPromises: finalSanitizedEditorConfig.features.populationPromises,\n field,\n fieldPromises,\n findMany,\n flattenLocales,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc,\n })\n }\n },\n validate: richTextValidateHOC({\n editorConfig: finalSanitizedEditorConfig,\n }),\n }\n}\n\nexport { AlignFeature } from './field/features/align/feature.server.js'\nexport { BlockQuoteFeature } from './field/features/blockquote/feature.server.js'\nexport {\n BlocksFeature,\n type BlocksFeatureProps,\n type LexicalBlock,\n} from './field/features/blocks/feature.server.js'\nexport {\n $createBlockNode,\n $isBlockNode,\n type BlockFields,\n BlockNode,\n type SerializedBlockNode,\n} from './field/features/blocks/nodes/BlocksNode.js'\n\nexport { TextDropdownSectionWithEntries } from './field/features/common/floatingSelectToolbarTextDropdownSection/index.js'\nexport { LinebreakHTMLConverter } from './field/features/converters/html/converter/converters/linebreak.js'\nexport { ParagraphHTMLConverter } from './field/features/converters/html/converter/converters/paragraph.js'\n\nexport { TextHTMLConverter } from './field/features/converters/html/converter/converters/text.js'\nexport { defaultHTMLConverters } from './field/features/converters/html/converter/defaultConverters.js'\nexport {\n convertLexicalNodesToHTML,\n convertLexicalToHTML,\n} from './field/features/converters/html/converter/index.js'\nexport type { HTMLConverter } from './field/features/converters/html/converter/types.js'\nexport {\n HTMLConverterFeature,\n type HTMLConverterFeatureProps,\n} from './field/features/converters/html/feature.server.js'\nexport {\n consolidateHTMLConverters,\n lexicalHTML,\n} from './field/features/converters/html/field/index.js'\nexport { createClientComponent } from './field/features/createClientComponent.js'\nexport { TestRecorderFeature } from './field/features/debug/testrecorder/feature.server.js'\nexport { TreeViewFeature } from './field/features/debug/treeview/feature.server.js'\nexport { BoldFeature } from './field/features/format/bold/feature.server.js'\n\nexport { SectionWithEntries as FormatSectionWithEntries } from './field/features/format/common/floatingSelectToolbarSection.js'\nexport { InlineCodeFeature } from './field/features/format/inlinecode/feature.server.js'\nexport { ItalicFeature } from './field/features/format/italic/feature.server.js'\nexport { StrikethroughFeature } from './field/features/format/strikethrough/feature.server.js'\nexport { SubscriptFeature } from './field/features/format/subscript/feature.server.js'\nexport { SuperscriptFeature } from './field/features/format/superscript/feature.server.js'\nexport { UnderlineFeature } from './field/features/format/underline/feature.server.js'\nexport { HeadingFeature } from './field/features/heading/feature.server.js'\n\nexport { HorizontalRuleFeature } from './field/features/horizontalrule/feature.server.js'\nexport { IndentFeature } from './field/features/indent/feature.server.js'\n\nexport { LinkFeature, type LinkFeatureServerProps } from './field/features/link/feature.server.js'\nexport {\n $createAutoLinkNode,\n $isAutoLinkNode,\n AutoLinkNode,\n} from './field/features/link/nodes/AutoLinkNode.js'\nexport {\n $createLinkNode,\n $isLinkNode,\n LinkNode,\n TOGGLE_LINK_COMMAND,\n} from './field/features/link/nodes/LinkNode.js'\nexport type {\n LinkFields,\n SerializedAutoLinkNode,\n SerializedLinkNode,\n} from './field/features/link/nodes/types.js'\nexport { CheckListFeature } from './field/features/lists/checklist/feature.server.js'\nexport { OrderedListFeature } from './field/features/lists/orderedlist/feature.server.js'\nexport { UnorderedListFeature } from './field/features/lists/unorderedlist/feature.server.js'\nexport { LexicalPluginToLexicalFeature } from './field/features/migrations/lexicalPluginToLexical/feature.server.js'\nexport { SlateBlockquoteConverter } from './field/features/migrations/slateToLexical/converter/converters/blockquote/index.js'\nexport { SlateHeadingConverter } from './field/features/migrations/slateToLexical/converter/converters/heading/index.js'\nexport { SlateIndentConverter } from './field/features/migrations/slateToLexical/converter/converters/indent/index.js'\nexport { SlateLinkConverter } from './field/features/migrations/slateToLexical/converter/converters/link/index.js'\nexport { SlateListItemConverter } from './field/features/migrations/slateToLexical/converter/converters/listItem/index.js'\nexport { SlateOrderedListConverter } from './field/features/migrations/slateToLexical/converter/converters/orderedList/index.js'\nexport { SlateRelationshipConverter } from './field/features/migrations/slateToLexical/converter/converters/relationship/index.js'\nexport { SlateUnknownConverter } from './field/features/migrations/slateToLexical/converter/converters/unknown/index.js'\nexport { SlateUnorderedListConverter } from './field/features/migrations/slateToLexical/converter/converters/unorderedList/index.js'\n\nexport { SlateUploadConverter } from './field/features/migrations/slateToLexical/converter/converters/upload/index.js'\nexport { defaultSlateConverters } from './field/features/migrations/slateToLexical/converter/defaultConverters.js'\nexport {\n convertSlateNodesToLexical,\n convertSlateToLexical,\n} from './field/features/migrations/slateToLexical/converter/index.js'\n\nexport type {\n SlateNode,\n SlateNodeConverter,\n} from './field/features/migrations/slateToLexical/converter/types.js'\nexport { SlateToLexicalFeature } from './field/features/migrations/slateToLexical/feature.server.js'\nexport { ParagraphFeature } from './field/features/paragraph/feature.server.js'\nexport { RelationshipFeature } from './field/features/relationship/feature.server.js'\nexport {\n $createRelationshipNode,\n $isRelationshipNode,\n type RelationshipData,\n RelationshipNode,\n type SerializedRelationshipNode,\n} from './field/features/relationship/nodes/RelationshipNode.js'\nexport { createNode } from './field/features/typeUtilities.js'\nexport type {\n ClientComponentProps,\n ClientFeature,\n ClientFeatureProviderMap,\n FeatureProviderClient,\n FeatureProviderProviderClient,\n FeatureProviderProviderServer,\n FeatureProviderServer,\n FieldNodeHook,\n FieldNodeHookArgs,\n NodeValidation,\n NodeWithHooks,\n PopulationPromise,\n ResolvedClientFeature,\n ResolvedClientFeatureMap,\n ResolvedServerFeature,\n ResolvedServerFeatureMap,\n SanitizedClientFeatures,\n SanitizedPlugin,\n SanitizedServerFeatures,\n ServerFeature,\n ServerFeatureProviderMap,\n} from './field/features/types.js'\nexport { UploadFeature } from './field/features/upload/feature.server.js'\n\nexport type { UploadFeatureProps } from './field/features/upload/feature.server.js'\n\nexport {\n $createUploadNode,\n $isUploadNode,\n type SerializedUploadNode,\n type UploadData,\n UploadNode,\n} from './field/features/upload/nodes/UploadNode.js'\nexport {\n EditorConfigProvider,\n useEditorConfigContext,\n} from './field/lexical/config/client/EditorConfigProvider.js'\nexport {\n sanitizeClientEditorConfig,\n sanitizeClientFeatures,\n} from './field/lexical/config/client/sanitize.js'\nexport {\n defaultEditorConfig,\n defaultEditorFeatures,\n defaultEditorLexicalConfig,\n defaultSanitizedServerEditorConfig,\n} from './field/lexical/config/server/default.js'\nexport {\n loadFeatures,\n sortFeaturesForOptimalLoading,\n} from './field/lexical/config/server/loader.js'\nexport {\n sanitizeServerEditorConfig,\n sanitizeServerFeatures,\n} from './field/lexical/config/server/sanitize.js'\n\nexport type {\n ClientEditorConfig,\n SanitizedClientEditorConfig,\n SanitizedServerEditorConfig,\n ServerEditorConfig,\n} from './field/lexical/config/types.js'\nexport { getEnabledNodes } from './field/lexical/nodes/index.js'\n\nexport {\n type FloatingToolbarSection,\n type FloatingToolbarSectionEntry,\n} from './field/lexical/plugins/FloatingSelectToolbar/types.js'\nexport { ENABLE_SLASH_MENU_COMMAND } from './field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js'\nexport type { AdapterProps }\n\nexport {\n SlashMenuGroup,\n SlashMenuOption,\n} from './field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js'\nexport { CAN_USE_DOM } from './field/lexical/utils/canUseDOM.js'\nexport { cloneDeep } from './field/lexical/utils/cloneDeep.js'\nexport { getDOMRangeRect } from './field/lexical/utils/getDOMRangeRect.js'\nexport { getSelectedNode } from './field/lexical/utils/getSelectedNode.js'\nexport { isHTMLElement } from './field/lexical/utils/guard.js'\nexport { invariant } from './field/lexical/utils/invariant.js'\nexport { joinClasses } from './field/lexical/utils/joinClasses.js'\nexport { createBlockNode } from './field/lexical/utils/markdown/createBlockNode.js'\nexport {\n DETAIL_TYPE_TO_DETAIL,\n DOUBLE_LINE_BREAK,\n ELEMENT_FORMAT_TO_TYPE,\n ELEMENT_TYPE_TO_FORMAT,\n IS_ALL_FORMATTING,\n LTR_REGEX,\n NON_BREAKING_SPACE,\n NodeFormat,\n RTL_REGEX,\n TEXT_MODE_TO_TYPE,\n TEXT_TYPE_TO_FORMAT,\n TEXT_TYPE_TO_MODE,\n} from './field/lexical/utils/nodeFormat.js'\nexport { Point, isPoint } from './field/lexical/utils/point.js'\nexport { Rect } from './field/lexical/utils/rect.js'\nexport { setFloatingElemPosition } from './field/lexical/utils/setFloatingElemPosition.js'\nexport { setFloatingElemPositionForLinkEditor } from './field/lexical/utils/setFloatingElemPositionForLinkEditor.js'\nexport {\n addSwipeDownListener,\n addSwipeLeftListener,\n addSwipeRightListener,\n addSwipeUpListener,\n} from './field/lexical/utils/swipe.js'\nexport { sanitizeUrl, validateUrl } from './field/lexical/utils/url.js'\nexport { defaultRichTextValue } from './populate/defaultValue.js'\n\nexport type { LexicalEditorProps, LexicalRichTextAdapter } from './types.js'\n"],"names":["withMergedProps","withNullableJSONSchemaType","RichTextCell","RichTextField","defaultEditorConfig","defaultEditorFeatures","defaultSanitizedServerEditorConfig","loadFeatures","sanitizeServerFeatures","cloneDeep","getGenerateComponentMap","getGenerateSchemaMap","populateLexicalPopulationPromises","richTextValidateHOC","lexicalEditor","props","resolvedFeatureMap","finalSanitizedEditorConfig","features","lexical","defaultFeatures","unSanitizedEditorConfig","CellComponent","Component","toMergeIntoProps","lexicalEditorConfig","FieldComponent","editorConfig","generateComponentMap","generateSchemaMap","outputSchema","collectionIDFieldTypes","config","field","interfaceNameDefinitions","isRequired","type","properties","root","additionalProperties","children","items","version","required","direction","oneOf","enum","format","indent","modifyOutputSchema","generatedTypes","modifyOutputSchemas","currentSchema","populationPromises","context","currentDepth","depth","fieldPromises","findMany","flattenLocales","overrideAccess","req","showHiddenFields","siblingDoc","size","editorPopulationPromises","validate","AlignFeature","BlockQuoteFeature","BlocksFeature","$createBlockNode","$isBlockNode","BlockNode","TextDropdownSectionWithEntries","LinebreakHTMLConverter","ParagraphHTMLConverter","TextHTMLConverter","defaultHTMLConverters","convertLexicalNodesToHTML","convertLexicalToHTML","HTMLConverterFeature","consolidateHTMLConverters","lexicalHTML","createClientComponent","TestRecorderFeature","TreeViewFeature","BoldFeature","SectionWithEntries","FormatSectionWithEntries","InlineCodeFeature","ItalicFeature","StrikethroughFeature","SubscriptFeature","SuperscriptFeature","UnderlineFeature","HeadingFeature","HorizontalRuleFeature","IndentFeature","LinkFeature","$createAutoLinkNode","$isAutoLinkNode","AutoLinkNode","$createLinkNode","$isLinkNode","LinkNode","TOGGLE_LINK_COMMAND","CheckListFeature","OrderedListFeature","UnorderedListFeature","LexicalPluginToLexicalFeature","SlateBlockquoteConverter","SlateHeadingConverter","SlateIndentConverter","SlateLinkConverter","SlateListItemConverter","SlateOrderedListConverter","SlateRelationshipConverter","SlateUnknownConverter","SlateUnorderedListConverter","SlateUploadConverter","defaultSlateConverters","convertSlateNodesToLexical","convertSlateToLexical","SlateToLexicalFeature","ParagraphFeature","RelationshipFeature","$createRelationshipNode","$isRelationshipNode","RelationshipNode","createNode","UploadFeature","$createUploadNode","$isUploadNode","UploadNode","EditorConfigProvider","useEditorConfigContext","sanitizeClientEditorConfig","sanitizeClientFeatures","defaultEditorLexicalConfig","sortFeaturesForOptimalLoading","sanitizeServerEditorConfig","getEnabledNodes","ENABLE_SLASH_MENU_COMMAND","SlashMenuGroup","SlashMenuOption","CAN_USE_DOM","getDOMRangeRect","getSelectedNode","isHTMLElement","invariant","joinClasses","createBlockNode","DETAIL_TYPE_TO_DETAIL","DOUBLE_LINE_BREAK","ELEMENT_FORMAT_TO_TYPE","ELEMENT_TYPE_TO_FORMAT","IS_ALL_FORMATTING","LTR_REGEX","NON_BREAKING_SPACE","NodeFormat","RTL_REGEX","TEXT_MODE_TO_TYPE","TEXT_TYPE_TO_FORMAT","TEXT_TYPE_TO_MODE","Point","isPoint","Rect","setFloatingElemPosition","setFloatingElemPositionForLinkEditor","addSwipeDownListener","addSwipeLeftListener","addSwipeRightListener","addSwipeUpListener","sanitizeUrl","validateUrl","defaultRichTextValue"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAIA,SAASA,eAAe,QAAQ,0CAAyC;AACzE,SAASC,0BAA0B,QAAQ,oBAAmB;AAM9D,SAASC,YAAY,QAAQ,kBAAiB;AAC9C,SAASC,aAAa,QAAQ,mBAAkB;AAChD,SACEC,mBAAmB,EACnBC,qBAAqB,EACrBC,kCAAkC,QAC7B,2CAA0C;AACjD,SAASC,YAAY,QAAQ,0CAAyC;AACtE,SAASC,sBAAsB,QAAQ,4CAA2C;AAClF,SAASC,SAAS,QAAQ,qCAAoC;AAE9D,SAASC,uBAAuB,QAAQ,4BAA2B;AACnE,SAASC,oBAAoB,QAAQ,yBA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,SACEC,0BAA0B,EAC1BC,sBAAsB,QACjB,4CAA2C;AAClD,SACErI,mBAAmB,EACnBC,qBAAqB,EACrBqI,0BAA0B,EAC1BpI,kCAAkC,QAC7B,2CAA0C;AACjD,SACEC,YAAY,EACZoI,6BAA6B,QACxB,0CAAyC;AAChD,SACEC,0BAA0B,EAC1BpI,sBAAsB,QACjB,4CAA2C;AAQlD,SAASqI,eAAe,QAAQ,iCAAgC;AAMhE,SAASC,yBAAyB,QAAQ,wEAAuE;AAGjH,SACEC,cAAc,EACdC,eAAe,QACV,wEAAuE;AAC9E,SAASC,WAAW,QAAQ,qCAAoC;AAChE,SAASxI,SAAS,QAAQ,qCAAoC;AAC9D,SAASyI,eAAe,QAAQ,2CAA0C;AAC1E,SAASC,eAAe,QAAQ,2CAA0C;AAC1E,SAASC,aAAa,QAAQ,iCAAgC;AAC9D,SAASC,SAAS,QAAQ,qCAAoC;AAC9D,SAASC,WAAW,QAAQ,uCAAsC;AAClE,SAASC,eAAe,QAAQ,oDAAmD;AACnF,SACEC,qBAAqB,EACrBC,iBAAiB,EACjBC,sBAAsB,EACtBC,sBAAsB,EACtBC,iBAAiB,EACjBC,SAAS,EACTC,kBAAkB,EAClBC,UAAU,EACVC,SAAS,EACTC,iBAAiB,EACjBC,mBAAmB,EACnBC,iBAAiB,QACZ,sCAAqC;AAC5C,SAASC,KAAK,EAAEC,OAAO,QAAQ,iCAAgC;AAC/D,SAASC,IAAI,QAAQ,gCAA+B;AACpD,SAASC,uBAAuB,QAAQ,mDAAkD;AAC1F,SAASC,oCAAoC,QAAQ,gEAA+D;AACpH,SACEC,oBAAoB,EACpBC,oBAAoB,EACpBC,qBAAqB,EACrBC,kBAAkB,QACb,iCAAgC;AACvC,SAASC,WAAW,EAAEC,WAAW,QAAQ,+BAA8B;AACvE,SAASC,oBAAoB,QAAQ,6BAA4B"}
@@ -15,7 +15,7 @@ type Arguments = {
15
15
  export declare const populate: ({ id, collection, currentDepth, data, depth, key, overrideAccess, req, showHiddenFields, }: Omit<Arguments, 'field'> & {
16
16
  collection: Collection;
17
17
  field: Field;
18
- id: string;
18
+ id: number | string;
19
19
  }) => Promise<void>;
20
20
  export {};
21
21
  //# sourceMappingURL=populate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"populate.d.ts","sourceRoot":"","sources":["../../src/populate/populate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAErE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C,KAAK,SAAS,GAAG;IACf,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,IAAI,EAAE,OAAO,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,aAAa,CAAC,qBAAqB,EAAE,YAAY,CAAC,CAAA;IACzD,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;IACpB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,GAAG,EAAE,cAAc,CAAA;IACnB,gBAAgB,EAAE,OAAO,CAAA;CAC1B,CAAA;AAED,eAAO,MAAM,QAAQ,+FAUlB,KAAK,SAAS,EAAE,OAAO,CAAC,GAAG;IAC5B,UAAU,EAAE,UAAU,CAAA;IACtB,KAAK,EAAE,KAAK,CAAA;IACZ,EAAE,EAAE,MAAM,CAAA;CACX,KAAG,QAAQ,IAAI,CAsBf,CAAA"}
1
+ {"version":3,"file":"populate.d.ts","sourceRoot":"","sources":["../../src/populate/populate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAErE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C,KAAK,SAAS,GAAG;IACf,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,IAAI,EAAE,OAAO,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,aAAa,CAAC,qBAAqB,EAAE,YAAY,CAAC,CAAA;IACzD,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;IACpB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,GAAG,EAAE,cAAc,CAAA;IACnB,gBAAgB,EAAE,OAAO,CAAA;CAC1B,CAAA;AAED,eAAO,MAAM,QAAQ,+FAUlB,KAAK,SAAS,EAAE,OAAO,CAAC,GAAG;IAC5B,UAAU,EAAE,UAAU,CAAA;IACtB,KAAK,EAAE,KAAK,CAAA;IACZ,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;CACpB,KAAG,QAAQ,IAAI,CAsBf,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/populate/populate.ts"],"sourcesContent":["import type { SerializedEditorState } from 'lexical'\nimport type { PayloadRequest } from 'payload/types'\nimport type { Collection, Field, RichTextField } from 'payload/types'\n\nimport type { AdapterProps } from '../types.js'\n\ntype Arguments = {\n currentDepth?: number\n data: unknown\n depth: number\n field: RichTextField<SerializedEditorState, AdapterProps>\n key: number | string\n overrideAccess?: boolean\n req: PayloadRequest\n showHiddenFields: boolean\n}\n\nexport const populate = async ({\n id,\n collection,\n currentDepth,\n data,\n depth,\n key,\n overrideAccess,\n req,\n showHiddenFields,\n}: Omit<Arguments, 'field'> & {\n collection: Collection\n field: Field\n id: string\n}): Promise<void> => {\n const dataRef = data as Record<string, unknown>\n\n const doc = await req.payloadDataLoader.load(\n JSON.stringify([\n req.transactionID,\n collection.config.slug,\n id,\n depth,\n currentDepth + 1,\n req.locale,\n req.fallbackLocale,\n typeof overrideAccess === 'undefined' ? false : overrideAccess,\n showHiddenFields,\n ]),\n )\n\n if (doc) {\n dataRef[key] = doc\n } else {\n dataRef[key] = null\n }\n}\n"],"names":["populate","id","collection","currentDepth","data","depth","key","overrideAccess","req","showHiddenFields","dataRef","doc","payloadDataLoader","load","JSON","stringify","transactionID","config","slug","locale","fallbackLocale"],"rangeMappings":";;;;;;;;;;;;;;;;;;","mappings":"AAiBA,OAAO,MAAMA,WAAW,OAAO,EAC7BC,EAAE,EACFC,UAAU,EACVC,YAAY,EACZC,IAAI,EACJC,KAAK,EACLC,GAAG,EACHC,cAAc,EACdC,GAAG,EACHC,gBAAgB,EAKjB;IACC,MAAMC,UAAUN;IAEhB,MAAMO,MAAM,MAAMH,IAAII,iBAAiB,CAACC,IAAI,CAC1CC,KAAKC,SAAS,CAAC;QACbP,IAAIQ,aAAa;QACjBd,WAAWe,MAAM,CAACC,IAAI;QACtBjB;QACAI;QACAF,eAAe;QACfK,IAAIW,MAAM;QACVX,IAAIY,cAAc;QAClB,OAAOb,mBAAmB,cAAc,QAAQA;QAChDE;KACD;IAGH,IAAIE,KAAK;QACPD,OAAO,CAACJ,IAAI,GAAGK;IACjB,OAAO;QACLD,OAAO,CAACJ,IAAI,GAAG;IACjB;AACF,EAAC"}
1
+ {"version":3,"sources":["../../src/populate/populate.ts"],"sourcesContent":["import type { SerializedEditorState } from 'lexical'\nimport type { PayloadRequest } from 'payload/types'\nimport type { Collection, Field, RichTextField } from 'payload/types'\n\nimport type { AdapterProps } from '../types.js'\n\ntype Arguments = {\n currentDepth?: number\n data: unknown\n depth: number\n field: RichTextField<SerializedEditorState, AdapterProps>\n key: number | string\n overrideAccess?: boolean\n req: PayloadRequest\n showHiddenFields: boolean\n}\n\nexport const populate = async ({\n id,\n collection,\n currentDepth,\n data,\n depth,\n key,\n overrideAccess,\n req,\n showHiddenFields,\n}: Omit<Arguments, 'field'> & {\n collection: Collection\n field: Field\n id: number | string\n}): Promise<void> => {\n const dataRef = data as Record<string, unknown>\n\n const doc = await req.payloadDataLoader.load(\n JSON.stringify([\n req.transactionID,\n collection.config.slug,\n id,\n depth,\n currentDepth + 1,\n req.locale,\n req.fallbackLocale,\n typeof overrideAccess === 'undefined' ? false : overrideAccess,\n showHiddenFields,\n ]),\n )\n\n if (doc) {\n dataRef[key] = doc\n } else {\n dataRef[key] = null\n }\n}\n"],"names":["populate","id","collection","currentDepth","data","depth","key","overrideAccess","req","showHiddenFields","dataRef","doc","payloadDataLoader","load","JSON","stringify","transactionID","config","slug","locale","fallbackLocale"],"rangeMappings":";;;;;;;;;;;;;;;;;;","mappings":"AAiBA,OAAO,MAAMA,WAAW,OAAO,EAC7BC,EAAE,EACFC,UAAU,EACVC,YAAY,EACZC,IAAI,EACJC,KAAK,EACLC,GAAG,EACHC,cAAc,EACdC,GAAG,EACHC,gBAAgB,EAKjB;IACC,MAAMC,UAAUN;IAEhB,MAAMO,MAAM,MAAMH,IAAII,iBAAiB,CAACC,IAAI,CAC1CC,KAAKC,SAAS,CAAC;QACbP,IAAIQ,aAAa;QACjBd,WAAWe,MAAM,CAACC,IAAI;QACtBjB;QACAI;QACAF,eAAe;QACfK,IAAIW,MAAM;QACVX,IAAIY,cAAc;QAClB,OAAOb,mBAAmB,cAAc,QAAQA;QAChDE;KACD;IAGH,IAAIE,KAAK;QACPD,OAAO,CAACJ,IAAI,GAAGK;IACjB,OAAO;QACLD,OAAO,CAACJ,IAAI,GAAG;IACjB;AACF,EAAC"}
@@ -0,0 +1,12 @@
1
+ import type { SerializedEditorState } from 'lexical';
2
+ import type { RichTextAdapter } from 'payload/types';
3
+ import type { PopulationPromise } from '../field/features/types.js';
4
+ import type { AdapterProps } from '../types.js';
5
+ export type Args = Parameters<RichTextAdapter<SerializedEditorState, AdapterProps>['populationPromises']>[0] & {
6
+ editorPopulationPromises: Map<string, Array<PopulationPromise>>;
7
+ };
8
+ /**
9
+ * Appends all new populationPromises to the populationPromises prop
10
+ */
11
+ export declare const populateLexicalPopulationPromises: ({ context, currentDepth, depth, editorPopulationPromises, field, fieldPromises, findMany, flattenLocales, overrideAccess, populationPromises, req, showHiddenFields, siblingDoc, }: Args) => void;
12
+ //# sourceMappingURL=populateLexicalPopulationPromises.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"populateLexicalPopulationPromises.d.ts","sourceRoot":"","sources":["../../src/populate/populateLexicalPopulationPromises.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAEpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAI/C,MAAM,MAAM,IAAI,GAAG,UAAU,CAC3B,eAAe,CAAC,qBAAqB,EAAE,YAAY,CAAC,CAAC,oBAAoB,CAAC,CAC3E,CAAC,CAAC,CAAC,GAAG;IACL,wBAAwB,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAA;CAChE,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,iCAAiC,uLAc3C,IAAI,SA8BN,CAAA"}