@payloadcms/richtext-lexical 3.0.0-beta.14 → 3.0.0-beta.18

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 +51 -27
  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 +3 -3
  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 +7 -4
  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
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/field/features/horizontalrule/feature.server.ts"],"sourcesContent":["import type { HTMLConverter } from '../converters/html/converter/types.js'\nimport type { FeatureProviderProviderServer } from '../types.js'\nimport type { SerializedHorizontalRuleNode } from './nodes/HorizontalRuleNode.js'\n\nimport { HorizontalRuleFeatureClientComponent } from './feature.client.js'\nimport { MarkdownTransformer } from './markdownTransformer.js'\nimport { HorizontalRuleNode } from './nodes/HorizontalRuleNode.js'\n\nexport const HorizontalRuleFeature: FeatureProviderProviderServer<undefined, undefined> = (\n props,\n) => {\n return {\n feature: () => {\n return {\n ClientComponent: HorizontalRuleFeatureClientComponent,\n clientFeatureProps: null,\n markdownTransformers: [MarkdownTransformer],\n nodes: [\n {\n converters: {\n html: {\n converter: () => {\n return `<hr/>`\n },\n nodeTypes: [HorizontalRuleNode.getType()],\n } as HTMLConverter<SerializedHorizontalRuleNode>,\n },\n node: HorizontalRuleNode,\n },\n ],\n serverFeatureProps: props,\n }\n },\n key: 'horizontalrule',\n serverFeatureProps: props,\n }\n}\n"],"names":["HorizontalRuleFeatureClientComponent","MarkdownTransformer","HorizontalRuleNode","HorizontalRuleFeature","props","feature","ClientComponent","clientFeatureProps","markdownTransformers","nodes","converters","html","converter","nodeTypes","getType","node","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAIA,SAASA,oCAAoC,QAAQ,sBAAqB;AAC1E,SAASC,mBAAmB,QAAQ,2BAA0B;AAC9D,SAASC,kBAAkB,QAAQ,gCAA+B;AAElE,OAAO,MAAMC,wBAA6E,CACxFC;IAEA,OAAO;QACLC,SAAS;YACP,OAAO;gBACLC,iBAAiBN;gBACjBO,oBAAoB;gBACpBC,sBAAsB;oBAACP;iBAAoB;gBAC3CQ,OAAO;oBACL;wBACEC,YAAY;4BACVC,MAAM;gCACJC,WAAW;oCACT,OAAO,CAAC,KAAK,CAAC;gCAChB;gCACAC,WAAW;oCAACX,mBAAmBY,OAAO;iCAAG;4BAC3C;wBACF;wBACAC,MAAMb;oBACR;iBACD;gBACDc,oBAAoBZ;YACtB;QACF;QACAa,KAAK;QACLD,oBAAoBZ;IACtB;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../../src/field/features/horizontalrule/feature.server.ts"],"sourcesContent":["import type { FeatureProviderProviderServer } from '../types.js'\n\nimport { createNode } from '../typeUtilities.js'\nimport { HorizontalRuleFeatureClientComponent } from './feature.client.js'\nimport { MarkdownTransformer } from './markdownTransformer.js'\nimport { HorizontalRuleNode } from './nodes/HorizontalRuleNode.js'\n\nexport const HorizontalRuleFeature: FeatureProviderProviderServer<undefined, undefined> = (\n props,\n) => {\n return {\n feature: () => {\n return {\n ClientComponent: HorizontalRuleFeatureClientComponent,\n clientFeatureProps: null,\n markdownTransformers: [MarkdownTransformer],\n nodes: [\n createNode({\n converters: {\n html: {\n converter: () => {\n return `<hr/>`\n },\n nodeTypes: [HorizontalRuleNode.getType()],\n },\n },\n node: HorizontalRuleNode,\n }),\n ],\n serverFeatureProps: props,\n }\n },\n key: 'horizontalrule',\n serverFeatureProps: props,\n }\n}\n"],"names":["createNode","HorizontalRuleFeatureClientComponent","MarkdownTransformer","HorizontalRuleNode","HorizontalRuleFeature","props","feature","ClientComponent","clientFeatureProps","markdownTransformers","nodes","converters","html","converter","nodeTypes","getType","node","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,SAASA,UAAU,QAAQ,sBAAqB;AAChD,SAASC,oCAAoC,QAAQ,sBAAqB;AAC1E,SAASC,mBAAmB,QAAQ,2BAA0B;AAC9D,SAASC,kBAAkB,QAAQ,gCAA+B;AAElE,OAAO,MAAMC,wBAA6E,CACxFC;IAEA,OAAO;QACLC,SAAS;YACP,OAAO;gBACLC,iBAAiBN;gBACjBO,oBAAoB;gBACpBC,sBAAsB;oBAACP;iBAAoB;gBAC3CQ,OAAO;oBACLV,WAAW;wBACTW,YAAY;4BACVC,MAAM;gCACJC,WAAW;oCACT,OAAO,CAAC,KAAK,CAAC;gCAChB;gCACAC,WAAW;oCAACX,mBAAmBY,OAAO;iCAAG;4BAC3C;wBACF;wBACAC,MAAMb;oBACR;iBACD;gBACDc,oBAAoBZ;YACtB;QACF;QACAa,KAAK;QACLD,oBAAoBZ;IACtB;AACF,EAAC"}
@@ -57,7 +57,7 @@ export const getBaseFields = (config, enabledCollections, disabledCollections)=>
57
57
  label: ({ t })=>t('fields:enterURL'),
58
58
  required: true,
59
59
  validate: (value)=>{
60
- if (value && !validateUrl(value)) {
60
+ if (!validateUrl(value)) {
61
61
  return 'Invalid URL';
62
62
  }
63
63
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/field/features/link/drawer/baseFields.ts"],"sourcesContent":["import type { User } from 'payload/auth'\nimport type { Config } from 'payload/config'\nimport type { Field, RadioField, TextField } from 'payload/types'\n\nimport { validateUrl } from '../../../lexical/utils/url.js'\n\nexport const getBaseFields = (\n config: Config,\n enabledCollections: false | string[],\n disabledCollections: false | string[],\n): Field[] => {\n let enabledRelations: string[]\n\n /**\n * Figure out which relations should be enabled (enabledRelations) based on a collection's admin.enableRichTextLink property,\n * or the Link Feature's enabledCollections and disabledCollections properties which override it.\n */\n if (enabledCollections) {\n enabledRelations = enabledCollections\n } else if (disabledCollections) {\n enabledRelations = config.collections\n .filter(({ slug }) => !disabledCollections.includes(slug))\n .map(({ slug }) => slug)\n } else {\n enabledRelations = config.collections\n .filter(({ admin: { enableRichTextLink, hidden } }) => {\n if (typeof hidden !== 'function' && hidden) {\n return false\n }\n return enableRichTextLink\n })\n .map(({ slug }) => slug)\n }\n\n const baseFields = [\n {\n name: 'text',\n type: 'text',\n label: ({ t }) => t('fields:textToDisplay'),\n required: true,\n },\n {\n name: 'fields',\n type: 'group',\n admin: {\n style: {\n borderBottom: 0,\n borderTop: 0,\n margin: 0,\n padding: 0,\n },\n },\n fields: [\n {\n name: 'linkType',\n type: 'radio',\n admin: {\n description: ({ t }) => t('fields:chooseBetweenCustomTextOrDocument'),\n },\n defaultValue: 'custom',\n label: ({ t }) => t('fields:linkType'),\n options: [\n {\n label: ({ t }) => t('fields:customURL'),\n value: 'custom',\n },\n ],\n required: true,\n },\n {\n name: 'url',\n type: 'text',\n label: ({ t }) => t('fields:enterURL'),\n required: true,\n validate: (value: string) => {\n if (value && !validateUrl(value)) {\n return 'Invalid URL'\n }\n },\n },\n ] as Field[],\n },\n ]\n\n // Only display internal link-specific fields / options / conditions if there are enabled relations\n if (enabledRelations?.length) {\n ;(baseFields[1].fields[0] as RadioField).options.push({\n label: ({ t }) => t('fields:internalLink'),\n value: 'internal',\n })\n ;(baseFields[1].fields[1] as TextField).admin = {\n condition: ({ fields }) => fields?.linkType !== 'internal',\n }\n\n baseFields[1].fields.push({\n name: 'doc',\n admin: {\n condition: ({ fields }) => {\n return fields?.linkType === 'internal'\n },\n },\n // when admin.hidden is a function we need to dynamically call hidden with the user to know if the collection should be shown\n type: 'relationship',\n filterOptions:\n !enabledCollections && !disabledCollections\n ? ({ relationTo, user }) => {\n const hidden = config.collections.find(({ slug }) => slug === relationTo).admin.hidden\n if (typeof hidden === 'function' && hidden({ user } as { user: User })) {\n return false\n }\n }\n : null,\n label: ({ t }) => t('fields:chooseDocumentToLink'),\n relationTo: enabledRelations,\n required: true,\n })\n }\n\n baseFields[1].fields.push({\n name: 'newTab',\n type: 'checkbox',\n label: ({ t }) => t('fields:openInNewTab'),\n })\n\n return baseFields as Field[]\n}\n"],"names":["validateUrl","getBaseFields","config","enabledCollections","disabledCollections","enabledRelations","collections","filter","slug","includes","map","admin","enableRichTextLink","hidden","baseFields","name","type","label","t","required","style","borderBottom","borderTop","margin","padding","fields","description","defaultValue","options","value","validate","length","push","condition","linkType","filterOptions","relationTo","user","find"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"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"}
1
+ {"version":3,"sources":["../../../../../src/field/features/link/drawer/baseFields.ts"],"sourcesContent":["import type { User } from 'payload/auth'\nimport type { Config } from 'payload/config'\nimport type { Field, RadioField, TextField } from 'payload/types'\n\nimport { validateUrl } from '../../../lexical/utils/url.js'\n\nexport const getBaseFields = (\n config: Config,\n enabledCollections: false | string[],\n disabledCollections: false | string[],\n): Field[] => {\n let enabledRelations: string[]\n\n /**\n * Figure out which relations should be enabled (enabledRelations) based on a collection's admin.enableRichTextLink property,\n * or the Link Feature's enabledCollections and disabledCollections properties which override it.\n */\n if (enabledCollections) {\n enabledRelations = enabledCollections\n } else if (disabledCollections) {\n enabledRelations = config.collections\n .filter(({ slug }) => !disabledCollections.includes(slug))\n .map(({ slug }) => slug)\n } else {\n enabledRelations = config.collections\n .filter(({ admin: { enableRichTextLink, hidden } }) => {\n if (typeof hidden !== 'function' && hidden) {\n return false\n }\n return enableRichTextLink\n })\n .map(({ slug }) => slug)\n }\n\n const baseFields = [\n {\n name: 'text',\n type: 'text',\n label: ({ t }) => t('fields:textToDisplay'),\n required: true,\n },\n {\n name: 'fields',\n type: 'group',\n admin: {\n style: {\n borderBottom: 0,\n borderTop: 0,\n margin: 0,\n padding: 0,\n },\n },\n fields: [\n {\n name: 'linkType',\n type: 'radio',\n admin: {\n description: ({ t }) => t('fields:chooseBetweenCustomTextOrDocument'),\n },\n defaultValue: 'custom',\n label: ({ t }) => t('fields:linkType'),\n options: [\n {\n label: ({ t }) => t('fields:customURL'),\n value: 'custom',\n },\n ],\n required: true,\n },\n {\n name: 'url',\n type: 'text',\n label: ({ t }) => t('fields:enterURL'),\n required: true,\n validate: (value: string) => {\n if (!validateUrl(value)) {\n return 'Invalid URL'\n }\n },\n },\n ] as Field[],\n },\n ]\n\n // Only display internal link-specific fields / options / conditions if there are enabled relations\n if (enabledRelations?.length) {\n ;(baseFields[1].fields[0] as RadioField).options.push({\n label: ({ t }) => t('fields:internalLink'),\n value: 'internal',\n })\n ;(baseFields[1].fields[1] as TextField).admin = {\n condition: ({ fields }) => fields?.linkType !== 'internal',\n }\n\n baseFields[1].fields.push({\n name: 'doc',\n admin: {\n condition: ({ fields }) => {\n return fields?.linkType === 'internal'\n },\n },\n // when admin.hidden is a function we need to dynamically call hidden with the user to know if the collection should be shown\n type: 'relationship',\n filterOptions:\n !enabledCollections && !disabledCollections\n ? ({ relationTo, user }) => {\n const hidden = config.collections.find(({ slug }) => slug === relationTo).admin.hidden\n if (typeof hidden === 'function' && hidden({ user } as { user: User })) {\n return false\n }\n }\n : null,\n label: ({ t }) => t('fields:chooseDocumentToLink'),\n relationTo: enabledRelations,\n required: true,\n })\n }\n\n baseFields[1].fields.push({\n name: 'newTab',\n type: 'checkbox',\n label: ({ t }) => t('fields:openInNewTab'),\n })\n\n return baseFields as Field[]\n}\n"],"names":["validateUrl","getBaseFields","config","enabledCollections","disabledCollections","enabledRelations","collections","filter","slug","includes","map","admin","enableRichTextLink","hidden","baseFields","name","type","label","t","required","style","borderBottom","borderTop","margin","padding","fields","description","defaultValue","options","value","validate","length","push","condition","linkType","filterOptions","relationTo","user","find"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"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"}
@@ -1 +1 @@
1
- {"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../src/field/features/link/feature.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,KAAK,EAAS,+BAA+B,EAAE,MAAM,eAAe,CAAA;AAK3E,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAA;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAUtD,MAAM,MAAM,6BAA6B,GACrC;IACE;;;QAGI;IACJ,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAA;IAG9B,kBAAkB,CAAC,EAAE,KAAK,CAAA;CAC3B,GACD;IAEE,mBAAmB,CAAC,EAAE,KAAK,CAAA;IAE3B;;;QAGI;IACJ,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;CAC9B,CAAA;AAEL,MAAM,MAAM,sBAAsB,GAAG,6BAA6B,GAAG;IACnE;;;OAGG;IACH,MAAM,CAAC,EACH,CAAC,CAAC,IAAI,EAAE;QACN,MAAM,EAAE,eAAe,CAAA;QACvB,aAAa,EAAE,+BAA+B,EAAE,CAAA;QAChD,IAAI,EAAE,IAAI,CAAA;KACX,KAAK,+BAA+B,EAAE,CAAC,GACxC,+BAA+B,EAAE,CAAA;CACtC,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,6BAA6B,CAAC,sBAAsB,EAAE,WAAW,CAgH1F,CAAA"}
1
+ {"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../src/field/features/link/feature.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,KAAK,EAAS,+BAA+B,EAAE,MAAM,eAAe,CAAA;AAK3E,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAA;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAUtD,MAAM,MAAM,6BAA6B,GACrC;IACE;;;QAGI;IACJ,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAA;IAG9B,kBAAkB,CAAC,EAAE,KAAK,CAAA;CAC3B,GACD;IAEE,mBAAmB,CAAC,EAAE,KAAK,CAAA;IAE3B;;;QAGI;IACJ,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;CAC9B,CAAA;AAEL,MAAM,MAAM,sBAAsB,GAAG,6BAA6B,GAAG;IACnE;;;OAGG;IACH,MAAM,CAAC,EACH,CAAC,CAAC,IAAI,EAAE;QACN,MAAM,EAAE,eAAe,CAAA;QACvB,aAAa,EAAE,+BAA+B,EAAE,CAAA;QAChD,IAAI,EAAE,IAAI,CAAA;KACX,KAAK,+BAA+B,EAAE,CAAC,GACxC,+BAA+B,EAAE,CAAA;CACtC,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,6BAA6B,CAAC,sBAAsB,EAAE,WAAW,CA4H1F,CAAA"}
@@ -1,5 +1,7 @@
1
1
  import { traverseFields } from '@payloadcms/next/utilities';
2
+ import { deepCopyObject } from 'payload/utilities';
2
3
  import { convertLexicalNodesToHTML } from '../converters/html/converter/index.js';
4
+ import { createNode } from '../typeUtilities.js';
3
5
  import { LinkFeatureClientComponent } from './feature.client.js';
4
6
  import { AutoLinkNode } from './nodes/AutoLinkNode.js';
5
7
  import { LinkNode } from './nodes/LinkNode.js';
@@ -18,12 +20,12 @@ export const LinkFeature = (props)=>{
18
20
  enabledCollections: props.enabledCollections
19
21
  },
20
22
  generateSchemaMap: ({ config, i18n, props })=>{
21
- if (!props?.fields || !Array.isArray(props.fields) || props.fields.length === 0) {
23
+ const transformedFields = transformExtraFields(deepCopyObject(props.fields), config, i18n, props.enabledCollections, props.disabledCollections);
24
+ if (!transformedFields || !Array.isArray(transformedFields) || transformedFields.length === 0) {
22
25
  return null;
23
26
  }
24
27
  const schemaMap = new Map();
25
28
  const validRelationships = config.collections.map((c)=>c.slug) || [];
26
- const transformedFields = transformExtraFields(props.fields, config, i18n, props.enabledCollections, props.disabledCollections);
27
29
  schemaMap.set('fields', transformedFields);
28
30
  traverseFields({
29
31
  config,
@@ -36,7 +38,7 @@ export const LinkFeature = (props)=>{
36
38
  return schemaMap;
37
39
  },
38
40
  nodes: [
39
- {
41
+ createNode({
40
42
  converters: {
41
43
  html: {
42
44
  converter: async ({ converters, node, parent, payload })=>{
@@ -61,12 +63,19 @@ export const LinkFeature = (props)=>{
61
63
  ]
62
64
  }
63
65
  },
66
+ hooks: {
67
+ afterRead: [
68
+ ({ node })=>{
69
+ return node;
70
+ }
71
+ ]
72
+ },
64
73
  node: AutoLinkNode,
65
74
  populationPromises: [
66
75
  linkPopulationPromiseHOC(props)
67
76
  ]
68
- },
69
- {
77
+ }),
78
+ createNode({
70
79
  converters: {
71
80
  html: {
72
81
  converter: async ({ converters, node, parent, payload })=>{
@@ -92,7 +101,7 @@ export const LinkFeature = (props)=>{
92
101
  populationPromises: [
93
102
  linkPopulationPromiseHOC(props)
94
103
  ]
95
- }
104
+ })
96
105
  ],
97
106
  serverFeatureProps: props
98
107
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/field/features/link/feature.server.ts"],"sourcesContent":["import type { I18n } from '@payloadcms/translations'\nimport type { SanitizedConfig } from 'payload/config'\nimport type { Field, FieldWithRichTextRequiredEditor } from 'payload/types'\n\nimport { traverseFields } from '@payloadcms/next/utilities'\n\nimport type { HTMLConverter } from '../converters/html/converter/types.js'\nimport type { FeatureProviderProviderServer } from '../types.js'\nimport type { ClientProps } from './feature.client.js'\nimport type { SerializedAutoLinkNode, SerializedLinkNode } from './nodes/types.js'\n\nimport { convertLexicalNodesToHTML } from '../converters/html/converter/index.js'\nimport { LinkFeatureClientComponent } from './feature.client.js'\nimport { AutoLinkNode } from './nodes/AutoLinkNode.js'\nimport { LinkNode } from './nodes/LinkNode.js'\nimport { transformExtraFields } from './plugins/floatingLinkEditor/utilities.js'\nimport { linkPopulationPromiseHOC } from './populationPromise.js'\n\nexport type ExclusiveLinkCollectionsProps =\n | {\n /**\n * The collections that should be disabled for internal linking. Overrides the `enableRichTextLink` property in the collection config.\n * When this property is set, `enabledCollections` will not be available.\n **/\n disabledCollections?: string[]\n\n // Ensures that enabledCollections is not available when disabledCollections is set\n enabledCollections?: never\n }\n | {\n // Ensures that disabledCollections is not available when enabledCollections is set\n disabledCollections?: never\n\n /**\n * The collections that should be enabled for internal linking. Overrides the `enableRichTextLink` property in the collection config\n * When this property is set, `disabledCollections` will not be available.\n **/\n enabledCollections?: string[]\n }\n\nexport type LinkFeatureServerProps = ExclusiveLinkCollectionsProps & {\n /**\n * A function or array defining additional fields for the link feature. These will be\n * displayed in the link editor drawer.\n */\n fields?:\n | ((args: {\n config: SanitizedConfig\n defaultFields: FieldWithRichTextRequiredEditor[]\n i18n: I18n\n }) => FieldWithRichTextRequiredEditor[])\n | FieldWithRichTextRequiredEditor[]\n}\n\nexport const LinkFeature: FeatureProviderProviderServer<LinkFeatureServerProps, ClientProps> = (\n props,\n) => {\n if (!props) {\n props = {}\n }\n return {\n feature: () => {\n return {\n ClientComponent: LinkFeatureClientComponent,\n clientFeatureProps: {\n disabledCollections: props.disabledCollections,\n enabledCollections: props.enabledCollections,\n } as ExclusiveLinkCollectionsProps,\n generateSchemaMap: ({ config, i18n, props }) => {\n if (!props?.fields || !Array.isArray(props.fields) || props.fields.length === 0) {\n return null\n }\n const schemaMap = new Map<string, Field[]>()\n\n const validRelationships = config.collections.map((c) => c.slug) || []\n\n const transformedFields = transformExtraFields(\n props.fields,\n config,\n i18n,\n props.enabledCollections,\n props.disabledCollections,\n )\n\n schemaMap.set('fields', transformedFields)\n\n traverseFields({\n config,\n fields: transformedFields,\n i18n,\n schemaMap,\n schemaPath: 'fields',\n validRelationships,\n })\n\n return schemaMap\n },\n nodes: [\n {\n converters: {\n html: {\n converter: async ({ converters, node, parent, payload }) => {\n const childrenText = await convertLexicalNodesToHTML({\n converters,\n lexicalNodes: node.children,\n parent: {\n ...node,\n parent,\n },\n payload,\n })\n\n const rel: string = node.fields.newTab ? ' rel=\"noopener noreferrer\"' : ''\n\n let href: string = node.fields.url\n if (node.fields.linkType === 'internal') {\n href =\n typeof node.fields.doc?.value === 'string'\n ? node.fields.doc?.value\n : node.fields.doc?.value?.id\n }\n\n return `<a href=\"${href}\"${rel}>${childrenText}</a>`\n },\n nodeTypes: [AutoLinkNode.getType()],\n } as HTMLConverter<SerializedAutoLinkNode>,\n },\n node: AutoLinkNode,\n populationPromises: [linkPopulationPromiseHOC(props)],\n },\n {\n converters: {\n html: {\n converter: async ({ converters, node, parent, payload }) => {\n const childrenText = await convertLexicalNodesToHTML({\n converters,\n lexicalNodes: node.children,\n parent: {\n ...node,\n parent,\n },\n payload,\n })\n\n const rel: string = node.fields.newTab ? ' rel=\"noopener noreferrer\"' : ''\n\n const href: string =\n node.fields.linkType === 'custom'\n ? node.fields.url\n : (node.fields.doc?.value as string)\n\n return `<a href=\"${href}\"${rel}>${childrenText}</a>`\n },\n nodeTypes: [LinkNode.getType()],\n } as HTMLConverter<SerializedLinkNode>,\n },\n node: LinkNode,\n populationPromises: [linkPopulationPromiseHOC(props)],\n },\n ],\n serverFeatureProps: props,\n }\n },\n key: 'link',\n serverFeatureProps: props,\n }\n}\n"],"names":["traverseFields","convertLexicalNodesToHTML","LinkFeatureClientComponent","AutoLinkNode","LinkNode","transformExtraFields","linkPopulationPromiseHOC","LinkFeature","props","feature","ClientComponent","clientFeatureProps","disabledCollections","enabledCollections","generateSchemaMap","config","i18n","fields","Array","isArray","length","schemaMap","Map","validRelationships","collections","map","c","slug","transformedFields","set","schemaPath","nodes","converters","html","converter","node","parent","payload","childrenText","lexicalNodes","children","rel","newTab","href","url","linkType","doc","value","id","nodeTypes","getType","populationPromises","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"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"}
1
+ {"version":3,"sources":["../../../../src/field/features/link/feature.server.ts"],"sourcesContent":["import type { I18n } from '@payloadcms/translations'\nimport type { SanitizedConfig } from 'payload/config'\nimport type { Field, FieldWithRichTextRequiredEditor } from 'payload/types'\n\nimport { traverseFields } from '@payloadcms/next/utilities'\nimport { deepCopyObject } from 'payload/utilities'\n\nimport type { FeatureProviderProviderServer } from '../types.js'\nimport type { ClientProps } from './feature.client.js'\n\nimport { convertLexicalNodesToHTML } from '../converters/html/converter/index.js'\nimport { createNode } from '../typeUtilities.js'\nimport { LinkFeatureClientComponent } from './feature.client.js'\nimport { AutoLinkNode } from './nodes/AutoLinkNode.js'\nimport { LinkNode } from './nodes/LinkNode.js'\nimport { transformExtraFields } from './plugins/floatingLinkEditor/utilities.js'\nimport { linkPopulationPromiseHOC } from './populationPromise.js'\n\nexport type ExclusiveLinkCollectionsProps =\n | {\n /**\n * The collections that should be disabled for internal linking. Overrides the `enableRichTextLink` property in the collection config.\n * When this property is set, `enabledCollections` will not be available.\n **/\n disabledCollections?: string[]\n\n // Ensures that enabledCollections is not available when disabledCollections is set\n enabledCollections?: never\n }\n | {\n // Ensures that disabledCollections is not available when enabledCollections is set\n disabledCollections?: never\n\n /**\n * The collections that should be enabled for internal linking. Overrides the `enableRichTextLink` property in the collection config\n * When this property is set, `disabledCollections` will not be available.\n **/\n enabledCollections?: string[]\n }\n\nexport type LinkFeatureServerProps = ExclusiveLinkCollectionsProps & {\n /**\n * A function or array defining additional fields for the link feature. These will be\n * displayed in the link editor drawer.\n */\n fields?:\n | ((args: {\n config: SanitizedConfig\n defaultFields: FieldWithRichTextRequiredEditor[]\n i18n: I18n\n }) => FieldWithRichTextRequiredEditor[])\n | FieldWithRichTextRequiredEditor[]\n}\n\nexport const LinkFeature: FeatureProviderProviderServer<LinkFeatureServerProps, ClientProps> = (\n props,\n) => {\n if (!props) {\n props = {}\n }\n return {\n feature: () => {\n return {\n ClientComponent: LinkFeatureClientComponent,\n clientFeatureProps: {\n disabledCollections: props.disabledCollections,\n enabledCollections: props.enabledCollections,\n } as ExclusiveLinkCollectionsProps,\n generateSchemaMap: ({ config, i18n, props }) => {\n const transformedFields = transformExtraFields(\n deepCopyObject(props.fields),\n config,\n i18n,\n props.enabledCollections,\n props.disabledCollections,\n )\n\n if (\n !transformedFields ||\n !Array.isArray(transformedFields) ||\n transformedFields.length === 0\n ) {\n return null\n }\n\n const schemaMap = new Map<string, Field[]>()\n\n const validRelationships = config.collections.map((c) => c.slug) || []\n\n schemaMap.set('fields', transformedFields)\n\n traverseFields({\n config,\n fields: transformedFields,\n i18n,\n schemaMap,\n schemaPath: 'fields',\n validRelationships,\n })\n\n return schemaMap\n },\n nodes: [\n createNode({\n converters: {\n html: {\n converter: async ({ converters, node, parent, payload }) => {\n const childrenText = await convertLexicalNodesToHTML({\n converters,\n lexicalNodes: node.children,\n parent: {\n ...node,\n parent,\n },\n payload,\n })\n\n const rel: string = node.fields.newTab ? ' rel=\"noopener noreferrer\"' : ''\n\n let href: string = node.fields.url\n if (node.fields.linkType === 'internal') {\n href =\n typeof node.fields.doc?.value === 'string'\n ? node.fields.doc?.value\n : node.fields.doc?.value?.id\n }\n\n return `<a href=\"${href}\"${rel}>${childrenText}</a>`\n },\n nodeTypes: [AutoLinkNode.getType()],\n },\n },\n hooks: {\n afterRead: [\n ({ node }) => {\n return node\n },\n ],\n },\n node: AutoLinkNode,\n populationPromises: [linkPopulationPromiseHOC(props)],\n }),\n createNode({\n converters: {\n html: {\n converter: async ({ converters, node, parent, payload }) => {\n const childrenText = await convertLexicalNodesToHTML({\n converters,\n lexicalNodes: node.children,\n parent: {\n ...node,\n parent,\n },\n payload,\n })\n\n const rel: string = node.fields.newTab ? ' rel=\"noopener noreferrer\"' : ''\n\n const href: string =\n node.fields.linkType === 'custom'\n ? node.fields.url\n : (node.fields.doc?.value as string)\n\n return `<a href=\"${href}\"${rel}>${childrenText}</a>`\n },\n nodeTypes: [LinkNode.getType()],\n },\n },\n node: LinkNode,\n populationPromises: [linkPopulationPromiseHOC(props)],\n }),\n ],\n serverFeatureProps: props,\n }\n },\n key: 'link',\n serverFeatureProps: props,\n }\n}\n"],"names":["traverseFields","deepCopyObject","convertLexicalNodesToHTML","createNode","LinkFeatureClientComponent","AutoLinkNode","LinkNode","transformExtraFields","linkPopulationPromiseHOC","LinkFeature","props","feature","ClientComponent","clientFeatureProps","disabledCollections","enabledCollections","generateSchemaMap","config","i18n","transformedFields","fields","Array","isArray","length","schemaMap","Map","validRelationships","collections","map","c","slug","set","schemaPath","nodes","converters","html","converter","node","parent","payload","childrenText","lexicalNodes","children","rel","newTab","href","url","linkType","doc","value","id","nodeTypes","getType","hooks","afterRead","populationPromises","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"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"}
@@ -1 +1 @@
1
- {"version":3,"file":"populationPromise.d.ts","sourceRoot":"","sources":["../../../../src/field/features/link/populationPromise.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AACjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAK1D,eAAO,MAAM,wBAAwB,UAC5B,sBAAsB,KAC5B,kBAAkB,kBAAkB,CA+DtC,CAAA"}
1
+ {"version":3,"file":"populationPromise.d.ts","sourceRoot":"","sources":["../../../../src/field/features/link/populationPromise.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AACjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAK1D,eAAO,MAAM,wBAAwB,UAC5B,sBAAsB,KAC5B,kBAAkB,kBAAkB,CAiEtC,CAAA"}
@@ -1,46 +1,48 @@
1
- import { populate } from '../../../populate/populate.js';
1
+ import { sanitizeFields } from 'payload/config';
2
+ import { deepCopyObject } from 'payload/utilities';
2
3
  import { recurseNestedFields } from '../../../populate/recurseNestedFields.js';
4
+ import { transformExtraFields } from './plugins/floatingLinkEditor/utilities.js';
3
5
  export const linkPopulationPromiseHOC = (props)=>{
4
- const linkPopulationPromise = ({ context, currentDepth, depth, editorPopulationPromises, field, findMany, flattenLocales, node, overrideAccess, populationPromises, req, showHiddenFields, siblingDoc })=>{
5
- const promises = [];
6
- if (node?.fields?.doc?.value && node?.fields?.doc?.relationTo) {
7
- const collection = req.payload.collections[node?.fields?.doc?.relationTo];
8
- if (collection) {
9
- promises.push(populate({
10
- id: typeof node?.fields?.doc?.value === 'object' ? node?.fields?.doc?.value?.id : node?.fields?.doc?.value,
11
- collection,
12
- currentDepth,
13
- data: node?.fields?.doc,
14
- depth,
15
- field,
16
- key: 'value',
17
- overrideAccess,
18
- req,
19
- showHiddenFields
20
- }));
21
- }
6
+ return ({ context, currentDepth, depth, editorPopulationPromises, fieldPromises, findMany, flattenLocales, node, overrideAccess, populationPromises, req, showHiddenFields })=>{
7
+ // Sanitize link's fields here. This is done here and not in the feature, because the payload config is available here
8
+ const payloadConfig = req.payload.config;
9
+ const validRelationships = payloadConfig.collections.map((c)=>c.slug) || [];
10
+ const transformedFields = transformExtraFields(deepCopyObject(props.fields), payloadConfig, req.i18n, props.enabledCollections, props.disabledCollections);
11
+ // TODO: Sanitize & transform ahead of time! On startup!
12
+ const sanitizedFields = sanitizeFields({
13
+ config: payloadConfig,
14
+ fields: transformedFields,
15
+ requireFieldLevelRichTextEditor: true,
16
+ validRelationships
17
+ });
18
+ if (!sanitizedFields?.length) {
19
+ return;
22
20
  }
23
- if (Array.isArray(props.fields)) {
21
+ /**
22
+ * Should populate all fields, including the doc field (for internal links), as it's treated like a normal field
23
+ */ if (Array.isArray(sanitizedFields)) {
24
24
  recurseNestedFields({
25
25
  context,
26
26
  currentDepth,
27
- data: node.fields || {},
27
+ data: {
28
+ fields: node.fields
29
+ },
28
30
  depth,
29
31
  editorPopulationPromises,
30
- fields: props.fields,
32
+ fieldPromises,
33
+ fields: sanitizedFields,
31
34
  findMany,
32
35
  flattenLocales,
33
36
  overrideAccess,
34
37
  populationPromises,
35
- promises,
36
38
  req,
37
39
  showHiddenFields,
38
- siblingDoc: node.fields || {}
40
+ siblingDoc: {
41
+ fields: node.fields
42
+ }
39
43
  });
40
44
  }
41
- return promises;
42
45
  };
43
- return linkPopulationPromise;
44
46
  };
45
47
 
46
48
  //# sourceMappingURL=populationPromise.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/field/features/link/populationPromise.ts"],"sourcesContent":["import type { PopulationPromise } from '../types.js'\nimport type { LinkFeatureServerProps } from './feature.server.js'\nimport type { SerializedLinkNode } from './nodes/types.js'\n\nimport { populate } from '../../../populate/populate.js'\nimport { recurseNestedFields } from '../../../populate/recurseNestedFields.js'\n\nexport const linkPopulationPromiseHOC = (\n props: LinkFeatureServerProps,\n): PopulationPromise<SerializedLinkNode> => {\n const linkPopulationPromise: PopulationPromise<SerializedLinkNode> = ({\n context,\n currentDepth,\n depth,\n editorPopulationPromises,\n field,\n findMany,\n flattenLocales,\n node,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc,\n }) => {\n const promises: Promise<void>[] = []\n\n if (node?.fields?.doc?.value && node?.fields?.doc?.relationTo) {\n const collection = req.payload.collections[node?.fields?.doc?.relationTo]\n\n if (collection) {\n promises.push(\n populate({\n id:\n typeof node?.fields?.doc?.value === 'object'\n ? node?.fields?.doc?.value?.id\n : node?.fields?.doc?.value,\n collection,\n currentDepth,\n data: node?.fields?.doc,\n depth,\n field,\n key: 'value',\n overrideAccess,\n req,\n showHiddenFields,\n }),\n )\n }\n }\n if (Array.isArray(props.fields)) {\n recurseNestedFields({\n context,\n currentDepth,\n data: node.fields || {},\n depth,\n editorPopulationPromises,\n fields: props.fields,\n findMany,\n flattenLocales,\n overrideAccess,\n populationPromises,\n promises,\n req,\n showHiddenFields,\n siblingDoc: node.fields || {},\n })\n }\n return promises\n }\n\n return linkPopulationPromise\n}\n"],"names":["populate","recurseNestedFields","linkPopulationPromiseHOC","props","linkPopulationPromise","context","currentDepth","depth","editorPopulationPromises","field","findMany","flattenLocales","node","overrideAccess","populationPromises","req","showHiddenFields","siblingDoc","promises","fields","doc","value","relationTo","collection","payload","collections","push","id","data","key","Array","isArray"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAIA,SAASA,QAAQ,QAAQ,gCAA+B;AACxD,SAASC,mBAAmB,QAAQ,2CAA0C;AAE9E,OAAO,MAAMC,2BAA2B,CACtCC;IAEA,MAAMC,wBAA+D,CAAC,EACpEC,OAAO,EACPC,YAAY,EACZC,KAAK,EACLC,wBAAwB,EACxBC,KAAK,EACLC,QAAQ,EACRC,cAAc,EACdC,IAAI,EACJC,cAAc,EACdC,kBAAkB,EAClBC,GAAG,EACHC,gBAAgB,EAChBC,UAAU,EACX;QACC,MAAMC,WAA4B,EAAE;QAEpC,IAAIN,MAAMO,QAAQC,KAAKC,SAAST,MAAMO,QAAQC,KAAKE,YAAY;YAC7D,MAAMC,aAAaR,IAAIS,OAAO,CAACC,WAAW,CAACb,MAAMO,QAAQC,KAAKE,WAAW;YAEzE,IAAIC,YAAY;gBACdL,SAASQ,IAAI,CACX1B,SAAS;oBACP2B,IACE,OAAOf,MAAMO,QAAQC,KAAKC,UAAU,WAChCT,MAAMO,QAAQC,KAAKC,OAAOM,KAC1Bf,MAAMO,QAAQC,KAAKC;oBACzBE;oBACAjB;oBACAsB,MAAMhB,MAAMO,QAAQC;oBACpBb;oBACAE;oBACAoB,KAAK;oBACLhB;oBACAE;oBACAC;gBACF;YAEJ;QACF;QACA,IAAIc,MAAMC,OAAO,CAAC5B,MAAMgB,MAAM,GAAG;YAC/BlB,oBAAoB;gBAClBI;gBACAC;gBACAsB,MAAMhB,KAAKO,MAAM,IAAI,CAAC;gBACtBZ;gBACAC;gBACAW,QAAQhB,MAAMgB,MAAM;gBACpBT;gBACAC;gBACAE;gBACAC;gBACAI;gBACAH;gBACAC;gBACAC,YAAYL,KAAKO,MAAM,IAAI,CAAC;YAC9B;QACF;QACA,OAAOD;IACT;IAEA,OAAOd;AACT,EAAC"}
1
+ {"version":3,"sources":["../../../../src/field/features/link/populationPromise.ts"],"sourcesContent":["import { sanitizeFields } from 'payload/config'\nimport { deepCopyObject } from 'payload/utilities'\n\nimport type { PopulationPromise } from '../types.js'\nimport type { LinkFeatureServerProps } from './feature.server.js'\nimport type { SerializedLinkNode } from './nodes/types.js'\n\nimport { recurseNestedFields } from '../../../populate/recurseNestedFields.js'\nimport { transformExtraFields } from './plugins/floatingLinkEditor/utilities.js'\n\nexport const linkPopulationPromiseHOC = (\n props: LinkFeatureServerProps,\n): PopulationPromise<SerializedLinkNode> => {\n return ({\n context,\n currentDepth,\n depth,\n editorPopulationPromises,\n fieldPromises,\n findMany,\n flattenLocales,\n node,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n }) => {\n // Sanitize link's fields here. This is done here and not in the feature, because the payload config is available here\n const payloadConfig = req.payload.config\n const validRelationships = payloadConfig.collections.map((c) => c.slug) || []\n\n const transformedFields = transformExtraFields(\n deepCopyObject(props.fields),\n payloadConfig,\n req.i18n,\n props.enabledCollections,\n props.disabledCollections,\n )\n\n // TODO: Sanitize & transform ahead of time! On startup!\n const sanitizedFields = sanitizeFields({\n config: payloadConfig,\n fields: transformedFields,\n requireFieldLevelRichTextEditor: true,\n validRelationships,\n })\n\n if (!sanitizedFields?.length) {\n return\n }\n\n /**\n * Should populate all fields, including the doc field (for internal links), as it's treated like a normal field\n */\n if (Array.isArray(sanitizedFields)) {\n recurseNestedFields({\n context,\n currentDepth,\n data: {\n fields: node.fields,\n },\n depth,\n editorPopulationPromises,\n fieldPromises,\n fields: sanitizedFields,\n findMany,\n flattenLocales,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc: {\n fields: node.fields,\n },\n })\n }\n }\n}\n"],"names":["sanitizeFields","deepCopyObject","recurseNestedFields","transformExtraFields","linkPopulationPromiseHOC","props","context","currentDepth","depth","editorPopulationPromises","fieldPromises","findMany","flattenLocales","node","overrideAccess","populationPromises","req","showHiddenFields","payloadConfig","payload","config","validRelationships","collections","map","c","slug","transformedFields","fields","i18n","enabledCollections","disabledCollections","sanitizedFields","requireFieldLevelRichTextEditor","length","Array","isArray","data","siblingDoc"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,cAAc,QAAQ,iBAAgB;AAC/C,SAASC,cAAc,QAAQ,oBAAmB;AAMlD,SAASC,mBAAmB,QAAQ,2CAA0C;AAC9E,SAASC,oBAAoB,QAAQ,4CAA2C;AAEhF,OAAO,MAAMC,2BAA2B,CACtCC;IAEA,OAAO,CAAC,EACNC,OAAO,EACPC,YAAY,EACZC,KAAK,EACLC,wBAAwB,EACxBC,aAAa,EACbC,QAAQ,EACRC,cAAc,EACdC,IAAI,EACJC,cAAc,EACdC,kBAAkB,EAClBC,GAAG,EACHC,gBAAgB,EACjB;QACC,sHAAsH;QACtH,MAAMC,gBAAgBF,IAAIG,OAAO,CAACC,MAAM;QACxC,MAAMC,qBAAqBH,cAAcI,WAAW,CAACC,GAAG,CAAC,CAACC,IAAMA,EAAEC,IAAI,KAAK,EAAE;QAE7E,MAAMC,oBAAoBvB,qBACxBF,eAAeI,MAAMsB,MAAM,GAC3BT,eACAF,IAAIY,IAAI,EACRvB,MAAMwB,kBAAkB,EACxBxB,MAAMyB,mBAAmB;QAG3B,wDAAwD;QACxD,MAAMC,kBAAkB/B,eAAe;YACrCoB,QAAQF;YACRS,QAAQD;YACRM,iCAAiC;YACjCX;QACF;QAEA,IAAI,CAACU,iBAAiBE,QAAQ;YAC5B;QACF;QAEA;;KAEC,GACD,IAAIC,MAAMC,OAAO,CAACJ,kBAAkB;YAClC7B,oBAAoB;gBAClBI;gBACAC;gBACA6B,MAAM;oBACJT,QAAQd,KAAKc,MAAM;gBACrB;gBACAnB;gBACAC;gBACAC;gBACAiB,QAAQI;gBACRpB;gBACAC;gBACAE;gBACAC;gBACAC;gBACAC;gBACAoB,YAAY;oBACVV,QAAQd,KAAKc,MAAM;gBACrB;YACF;QACF;IACF;AACF,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/lists/checklist/feature.server.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAA;AAMnE,eAAO,MAAM,gBAAgB,EAAE,6BAA6B,CAAC,SAAS,EAAE,SAAS,CA6BhF,CAAA"}
1
+ {"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/lists/checklist/feature.server.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAA;AAOnE,eAAO,MAAM,gBAAgB,EAAE,6BAA6B,CAAC,SAAS,EAAE,SAAS,CA6BhF,CAAA"}
@@ -1,5 +1,6 @@
1
1
  import lexicalListImport from '@lexical/list';
2
2
  const { ListItemNode, ListNode } = lexicalListImport;
3
+ import { createNode } from '../../typeUtilities.js';
3
4
  import { ListHTMLConverter, ListItemHTMLConverter } from '../htmlConverter.js';
4
5
  import { CheckListFeatureClientComponent } from './feature.client.js';
5
6
  import { CHECK_LIST } from './markdownTransformers.js';
@@ -12,18 +13,18 @@ export const CheckListFeature = (props)=>{
12
13
  CHECK_LIST
13
14
  ],
14
15
  nodes: featureProviderMap.has('unorderedlist') || featureProviderMap.has('orderedlist') ? [] : [
15
- {
16
+ createNode({
16
17
  converters: {
17
18
  html: ListHTMLConverter
18
19
  },
19
20
  node: ListNode
20
- },
21
- {
21
+ }),
22
+ createNode({
22
23
  converters: {
23
24
  html: ListItemHTMLConverter
24
25
  },
25
26
  node: ListItemNode
26
- }
27
+ })
27
28
  ],
28
29
  serverFeatureProps: props
29
30
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/field/features/lists/checklist/feature.server.ts"],"sourcesContent":["import lexicalListImport from '@lexical/list'\nconst { ListItemNode, ListNode } = lexicalListImport\n\nimport type { FeatureProviderProviderServer } from '../../types.js'\n\nimport { ListHTMLConverter, ListItemHTMLConverter } from '../htmlConverter.js'\nimport { CheckListFeatureClientComponent } from './feature.client.js'\nimport { CHECK_LIST } from './markdownTransformers.js'\n\nexport const CheckListFeature: FeatureProviderProviderServer<undefined, undefined> = (props) => {\n return {\n feature: ({ featureProviderMap }) => {\n return {\n ClientComponent: CheckListFeatureClientComponent,\n markdownTransformers: [CHECK_LIST],\n nodes:\n featureProviderMap.has('unorderedlist') || featureProviderMap.has('orderedlist')\n ? []\n : [\n {\n converters: {\n html: ListHTMLConverter,\n },\n node: ListNode,\n },\n {\n converters: {\n html: ListItemHTMLConverter,\n },\n node: ListItemNode,\n },\n ],\n serverFeatureProps: props,\n }\n },\n key: 'checklist',\n serverFeatureProps: props,\n }\n}\n"],"names":["lexicalListImport","ListItemNode","ListNode","ListHTMLConverter","ListItemHTMLConverter","CheckListFeatureClientComponent","CHECK_LIST","CheckListFeature","props","feature","featureProviderMap","ClientComponent","markdownTransformers","nodes","has","converters","html","node","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,OAAOA,uBAAuB,gBAAe;AAC7C,MAAM,EAAEC,YAAY,EAAEC,QAAQ,EAAE,GAAGF;AAInC,SAASG,iBAAiB,EAAEC,qBAAqB,QAAQ,sBAAqB;AAC9E,SAASC,+BAA+B,QAAQ,sBAAqB;AACrE,SAASC,UAAU,QAAQ,4BAA2B;AAEtD,OAAO,MAAMC,mBAAwE,CAACC;IACpF,OAAO;QACLC,SAAS,CAAC,EAAEC,kBAAkB,EAAE;YAC9B,OAAO;gBACLC,iBAAiBN;gBACjBO,sBAAsB;oBAACN;iBAAW;gBAClCO,OACEH,mBAAmBI,GAAG,CAAC,oBAAoBJ,mBAAmBI,GAAG,CAAC,iBAC9D,EAAE,GACF;oBACE;wBACEC,YAAY;4BACVC,MAAMb;wBACR;wBACAc,MAAMf;oBACR;oBACA;wBACEa,YAAY;4BACVC,MAAMZ;wBACR;wBACAa,MAAMhB;oBACR;iBACD;gBACPiB,oBAAoBV;YACtB;QACF;QACAW,KAAK;QACLD,oBAAoBV;IACtB;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../../../src/field/features/lists/checklist/feature.server.ts"],"sourcesContent":["import lexicalListImport from '@lexical/list'\nconst { ListItemNode, ListNode } = lexicalListImport\n\nimport type { FeatureProviderProviderServer } from '../../types.js'\n\nimport { createNode } from '../../typeUtilities.js'\nimport { ListHTMLConverter, ListItemHTMLConverter } from '../htmlConverter.js'\nimport { CheckListFeatureClientComponent } from './feature.client.js'\nimport { CHECK_LIST } from './markdownTransformers.js'\n\nexport const CheckListFeature: FeatureProviderProviderServer<undefined, undefined> = (props) => {\n return {\n feature: ({ featureProviderMap }) => {\n return {\n ClientComponent: CheckListFeatureClientComponent,\n markdownTransformers: [CHECK_LIST],\n nodes:\n featureProviderMap.has('unorderedlist') || featureProviderMap.has('orderedlist')\n ? []\n : [\n createNode({\n converters: {\n html: ListHTMLConverter,\n },\n node: ListNode,\n }),\n createNode({\n converters: {\n html: ListItemHTMLConverter,\n },\n node: ListItemNode,\n }),\n ],\n serverFeatureProps: props,\n }\n },\n key: 'checklist',\n serverFeatureProps: props,\n }\n}\n"],"names":["lexicalListImport","ListItemNode","ListNode","createNode","ListHTMLConverter","ListItemHTMLConverter","CheckListFeatureClientComponent","CHECK_LIST","CheckListFeature","props","feature","featureProviderMap","ClientComponent","markdownTransformers","nodes","has","converters","html","node","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,OAAOA,uBAAuB,gBAAe;AAC7C,MAAM,EAAEC,YAAY,EAAEC,QAAQ,EAAE,GAAGF;AAInC,SAASG,UAAU,QAAQ,yBAAwB;AACnD,SAASC,iBAAiB,EAAEC,qBAAqB,QAAQ,sBAAqB;AAC9E,SAASC,+BAA+B,QAAQ,sBAAqB;AACrE,SAASC,UAAU,QAAQ,4BAA2B;AAEtD,OAAO,MAAMC,mBAAwE,CAACC;IACpF,OAAO;QACLC,SAAS,CAAC,EAAEC,kBAAkB,EAAE;YAC9B,OAAO;gBACLC,iBAAiBN;gBACjBO,sBAAsB;oBAACN;iBAAW;gBAClCO,OACEH,mBAAmBI,GAAG,CAAC,oBAAoBJ,mBAAmBI,GAAG,CAAC,iBAC9D,EAAE,GACF;oBACEZ,WAAW;wBACTa,YAAY;4BACVC,MAAMb;wBACR;wBACAc,MAAMhB;oBACR;oBACAC,WAAW;wBACTa,YAAY;4BACVC,MAAMZ;wBACR;wBACAa,MAAMjB;oBACR;iBACD;gBACPkB,oBAAoBV;YACtB;QACF;QACAW,KAAK;QACLD,oBAAoBV;IACtB;AACF,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/lists/orderedlist/feature.server.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAA;AAMnE,eAAO,MAAM,kBAAkB,EAAE,6BAA6B,CAAC,SAAS,EAAE,SAAS,CA4BlF,CAAA"}
1
+ {"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/lists/orderedlist/feature.server.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAA;AAOnE,eAAO,MAAM,kBAAkB,EAAE,6BAA6B,CAAC,SAAS,EAAE,SAAS,CA4BlF,CAAA"}
@@ -1,5 +1,6 @@
1
1
  import lexicalListImport from '@lexical/list';
2
2
  const { ListItemNode, ListNode } = lexicalListImport;
3
+ import { createNode } from '../../typeUtilities.js';
3
4
  import { ListHTMLConverter, ListItemHTMLConverter } from '../htmlConverter.js';
4
5
  import { OrderedListFeatureClientComponent } from './feature.client.js';
5
6
  import { ORDERED_LIST } from './markdownTransformer.js';
@@ -12,18 +13,18 @@ export const OrderedListFeature = (props)=>{
12
13
  ORDERED_LIST
13
14
  ],
14
15
  nodes: featureProviderMap.has('unorderedlist') ? [] : [
15
- {
16
+ createNode({
16
17
  converters: {
17
18
  html: ListHTMLConverter
18
19
  },
19
20
  node: ListNode
20
- },
21
- {
21
+ }),
22
+ createNode({
22
23
  converters: {
23
24
  html: ListItemHTMLConverter
24
25
  },
25
26
  node: ListItemNode
26
- }
27
+ })
27
28
  ],
28
29
  serverFeatureProps: props
29
30
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/field/features/lists/orderedlist/feature.server.ts"],"sourcesContent":["import lexicalListImport from '@lexical/list'\nconst { ListItemNode, ListNode } = lexicalListImport\n\nimport type { FeatureProviderProviderServer } from '../../types.js'\n\nimport { ListHTMLConverter, ListItemHTMLConverter } from '../htmlConverter.js'\nimport { OrderedListFeatureClientComponent } from './feature.client.js'\nimport { ORDERED_LIST } from './markdownTransformer.js'\n\nexport const OrderedListFeature: FeatureProviderProviderServer<undefined, undefined> = (props) => {\n return {\n feature: ({ featureProviderMap }) => {\n return {\n ClientComponent: OrderedListFeatureClientComponent,\n markdownTransformers: [ORDERED_LIST],\n nodes: featureProviderMap.has('unorderedlist')\n ? []\n : [\n {\n converters: {\n html: ListHTMLConverter,\n },\n node: ListNode,\n },\n {\n converters: {\n html: ListItemHTMLConverter,\n },\n node: ListItemNode,\n },\n ],\n serverFeatureProps: props,\n }\n },\n key: 'orderedlist',\n serverFeatureProps: props,\n }\n}\n"],"names":["lexicalListImport","ListItemNode","ListNode","ListHTMLConverter","ListItemHTMLConverter","OrderedListFeatureClientComponent","ORDERED_LIST","OrderedListFeature","props","feature","featureProviderMap","ClientComponent","markdownTransformers","nodes","has","converters","html","node","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,OAAOA,uBAAuB,gBAAe;AAC7C,MAAM,EAAEC,YAAY,EAAEC,QAAQ,EAAE,GAAGF;AAInC,SAASG,iBAAiB,EAAEC,qBAAqB,QAAQ,sBAAqB;AAC9E,SAASC,iCAAiC,QAAQ,sBAAqB;AACvE,SAASC,YAAY,QAAQ,2BAA0B;AAEvD,OAAO,MAAMC,qBAA0E,CAACC;IACtF,OAAO;QACLC,SAAS,CAAC,EAAEC,kBAAkB,EAAE;YAC9B,OAAO;gBACLC,iBAAiBN;gBACjBO,sBAAsB;oBAACN;iBAAa;gBACpCO,OAAOH,mBAAmBI,GAAG,CAAC,mBAC1B,EAAE,GACF;oBACE;wBACEC,YAAY;4BACVC,MAAMb;wBACR;wBACAc,MAAMf;oBACR;oBACA;wBACEa,YAAY;4BACVC,MAAMZ;wBACR;wBACAa,MAAMhB;oBACR;iBACD;gBACLiB,oBAAoBV;YACtB;QACF;QACAW,KAAK;QACLD,oBAAoBV;IACtB;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../../../src/field/features/lists/orderedlist/feature.server.ts"],"sourcesContent":["import lexicalListImport from '@lexical/list'\nconst { ListItemNode, ListNode } = lexicalListImport\n\nimport type { FeatureProviderProviderServer } from '../../types.js'\n\nimport { createNode } from '../../typeUtilities.js'\nimport { ListHTMLConverter, ListItemHTMLConverter } from '../htmlConverter.js'\nimport { OrderedListFeatureClientComponent } from './feature.client.js'\nimport { ORDERED_LIST } from './markdownTransformer.js'\n\nexport const OrderedListFeature: FeatureProviderProviderServer<undefined, undefined> = (props) => {\n return {\n feature: ({ featureProviderMap }) => {\n return {\n ClientComponent: OrderedListFeatureClientComponent,\n markdownTransformers: [ORDERED_LIST],\n nodes: featureProviderMap.has('unorderedlist')\n ? []\n : [\n createNode({\n converters: {\n html: ListHTMLConverter,\n },\n node: ListNode,\n }),\n createNode({\n converters: {\n html: ListItemHTMLConverter,\n },\n node: ListItemNode,\n }),\n ],\n serverFeatureProps: props,\n }\n },\n key: 'orderedlist',\n serverFeatureProps: props,\n }\n}\n"],"names":["lexicalListImport","ListItemNode","ListNode","createNode","ListHTMLConverter","ListItemHTMLConverter","OrderedListFeatureClientComponent","ORDERED_LIST","OrderedListFeature","props","feature","featureProviderMap","ClientComponent","markdownTransformers","nodes","has","converters","html","node","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,OAAOA,uBAAuB,gBAAe;AAC7C,MAAM,EAAEC,YAAY,EAAEC,QAAQ,EAAE,GAAGF;AAInC,SAASG,UAAU,QAAQ,yBAAwB;AACnD,SAASC,iBAAiB,EAAEC,qBAAqB,QAAQ,sBAAqB;AAC9E,SAASC,iCAAiC,QAAQ,sBAAqB;AACvE,SAASC,YAAY,QAAQ,2BAA0B;AAEvD,OAAO,MAAMC,qBAA0E,CAACC;IACtF,OAAO;QACLC,SAAS,CAAC,EAAEC,kBAAkB,EAAE;YAC9B,OAAO;gBACLC,iBAAiBN;gBACjBO,sBAAsB;oBAACN;iBAAa;gBACpCO,OAAOH,mBAAmBI,GAAG,CAAC,mBAC1B,EAAE,GACF;oBACEZ,WAAW;wBACTa,YAAY;4BACVC,MAAMb;wBACR;wBACAc,MAAMhB;oBACR;oBACAC,WAAW;wBACTa,YAAY;4BACVC,MAAMZ;wBACR;wBACAa,MAAMjB;oBACR;iBACD;gBACLkB,oBAAoBV;YACtB;QACF;QACAW,KAAK;QACLD,oBAAoBV;IACtB;AACF,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/lists/unorderedlist/feature.server.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAA;AAMnE,eAAO,MAAM,oBAAoB,EAAE,6BAA6B,CAAC,SAAS,EAAE,SAAS,CA4BpF,CAAA"}
1
+ {"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/lists/unorderedlist/feature.server.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAA;AAOnE,eAAO,MAAM,oBAAoB,EAAE,6BAA6B,CAAC,SAAS,EAAE,SAAS,CA4BpF,CAAA"}
@@ -1,5 +1,6 @@
1
1
  import lexicalListImport from '@lexical/list';
2
2
  const { ListItemNode, ListNode } = lexicalListImport;
3
+ import { createNode } from '../../typeUtilities.js';
3
4
  import { ListHTMLConverter, ListItemHTMLConverter } from '../htmlConverter.js';
4
5
  import { UnorderedListFeatureClientComponent } from './feature.client.js';
5
6
  import { UNORDERED_LIST } from './markdownTransformer.js';
@@ -12,18 +13,18 @@ export const UnorderedListFeature = (props)=>{
12
13
  UNORDERED_LIST
13
14
  ],
14
15
  nodes: [
15
- {
16
+ createNode({
16
17
  converters: {
17
18
  html: ListHTMLConverter
18
19
  },
19
20
  node: ListNode
20
- },
21
- {
21
+ }),
22
+ createNode({
22
23
  converters: {
23
24
  html: ListItemHTMLConverter
24
25
  },
25
26
  node: ListItemNode
26
- }
27
+ })
27
28
  ],
28
29
  serverFeatureProps: props
29
30
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/field/features/lists/unorderedlist/feature.server.ts"],"sourcesContent":["import lexicalListImport from '@lexical/list'\nconst { ListItemNode, ListNode } = lexicalListImport\n\nimport type { FeatureProviderProviderServer } from '../../types.js'\n\nimport { ListHTMLConverter, ListItemHTMLConverter } from '../htmlConverter.js'\nimport { UnorderedListFeatureClientComponent } from './feature.client.js'\nimport { UNORDERED_LIST } from './markdownTransformer.js'\n\nexport const UnorderedListFeature: FeatureProviderProviderServer<undefined, undefined> = (\n props,\n) => {\n return {\n feature: () => {\n return {\n ClientComponent: UnorderedListFeatureClientComponent,\n markdownTransformers: [UNORDERED_LIST],\n nodes: [\n {\n converters: {\n html: ListHTMLConverter,\n },\n node: ListNode,\n },\n {\n converters: {\n html: ListItemHTMLConverter,\n },\n node: ListItemNode,\n },\n ],\n serverFeatureProps: props,\n }\n },\n key: 'unorderedlist',\n serverFeatureProps: props,\n }\n}\n"],"names":["lexicalListImport","ListItemNode","ListNode","ListHTMLConverter","ListItemHTMLConverter","UnorderedListFeatureClientComponent","UNORDERED_LIST","UnorderedListFeature","props","feature","ClientComponent","markdownTransformers","nodes","converters","html","node","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,OAAOA,uBAAuB,gBAAe;AAC7C,MAAM,EAAEC,YAAY,EAAEC,QAAQ,EAAE,GAAGF;AAInC,SAASG,iBAAiB,EAAEC,qBAAqB,QAAQ,sBAAqB;AAC9E,SAASC,mCAAmC,QAAQ,sBAAqB;AACzE,SAASC,cAAc,QAAQ,2BAA0B;AAEzD,OAAO,MAAMC,uBAA4E,CACvFC;IAEA,OAAO;QACLC,SAAS;YACP,OAAO;gBACLC,iBAAiBL;gBACjBM,sBAAsB;oBAACL;iBAAe;gBACtCM,OAAO;oBACL;wBACEC,YAAY;4BACVC,MAAMX;wBACR;wBACAY,MAAMb;oBACR;oBACA;wBACEW,YAAY;4BACVC,MAAMV;wBACR;wBACAW,MAAMd;oBACR;iBACD;gBACDe,oBAAoBR;YACtB;QACF;QACAS,KAAK;QACLD,oBAAoBR;IACtB;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../../../src/field/features/lists/unorderedlist/feature.server.ts"],"sourcesContent":["import lexicalListImport from '@lexical/list'\nconst { ListItemNode, ListNode } = lexicalListImport\n\nimport type { FeatureProviderProviderServer } from '../../types.js'\n\nimport { createNode } from '../../typeUtilities.js'\nimport { ListHTMLConverter, ListItemHTMLConverter } from '../htmlConverter.js'\nimport { UnorderedListFeatureClientComponent } from './feature.client.js'\nimport { UNORDERED_LIST } from './markdownTransformer.js'\n\nexport const UnorderedListFeature: FeatureProviderProviderServer<undefined, undefined> = (\n props,\n) => {\n return {\n feature: () => {\n return {\n ClientComponent: UnorderedListFeatureClientComponent,\n markdownTransformers: [UNORDERED_LIST],\n nodes: [\n createNode({\n converters: {\n html: ListHTMLConverter,\n },\n node: ListNode,\n }),\n createNode({\n converters: {\n html: ListItemHTMLConverter,\n },\n node: ListItemNode,\n }),\n ],\n serverFeatureProps: props,\n }\n },\n key: 'unorderedlist',\n serverFeatureProps: props,\n }\n}\n"],"names":["lexicalListImport","ListItemNode","ListNode","createNode","ListHTMLConverter","ListItemHTMLConverter","UnorderedListFeatureClientComponent","UNORDERED_LIST","UnorderedListFeature","props","feature","ClientComponent","markdownTransformers","nodes","converters","html","node","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,OAAOA,uBAAuB,gBAAe;AAC7C,MAAM,EAAEC,YAAY,EAAEC,QAAQ,EAAE,GAAGF;AAInC,SAASG,UAAU,QAAQ,yBAAwB;AACnD,SAASC,iBAAiB,EAAEC,qBAAqB,QAAQ,sBAAqB;AAC9E,SAASC,mCAAmC,QAAQ,sBAAqB;AACzE,SAASC,cAAc,QAAQ,2BAA0B;AAEzD,OAAO,MAAMC,uBAA4E,CACvFC;IAEA,OAAO;QACLC,SAAS;YACP,OAAO;gBACLC,iBAAiBL;gBACjBM,sBAAsB;oBAACL;iBAAe;gBACtCM,OAAO;oBACLV,WAAW;wBACTW,YAAY;4BACVC,MAAMX;wBACR;wBACAY,MAAMd;oBACR;oBACAC,WAAW;wBACTW,YAAY;4BACVC,MAAMV;wBACR;wBACAW,MAAMf;oBACR;iBACD;gBACDgB,oBAAoBR;YACtB;QACF;QACAS,KAAK;QACLD,oBAAoBR;IACtB;AACF,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"converter.d.ts","sourceRoot":"","sources":["../../../../../../../../src/field/features/migrations/lexicalPluginToLexical/converter/converters/upload/converter.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAA;AAEhE,eAAO,MAAM,gBAAgB,EAAE,0BAoB9B,CAAA"}
1
+ {"version":3,"file":"converter.d.ts","sourceRoot":"","sources":["../../../../../../../../src/field/features/migrations/lexicalPluginToLexical/converter/converters/upload/converter.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAA;AAEhE,eAAO,MAAM,gBAAgB,EAAE,0BAkB9B,CAAA"}
@@ -11,10 +11,8 @@
11
11
  fields,
12
12
  format: lexicalPluginNode?.format || '',
13
13
  relationTo: lexicalPluginNode?.rawImagePayload?.relationTo,
14
- value: {
15
- id: lexicalPluginNode?.rawImagePayload?.value?.id || ''
16
- },
17
- version: 1
14
+ value: lexicalPluginNode?.rawImagePayload?.value?.id || '',
15
+ version: 2
18
16
  };
19
17
  },
20
18
  nodeTypes: [
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../src/field/features/migrations/lexicalPluginToLexical/converter/converters/upload/converter.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport type { SerializedUploadNode } from '../../../../../upload/nodes/UploadNode.js'\nimport type { LexicalPluginNodeConverter } from '../../types.js'\n\nexport const _UploadConverter: LexicalPluginNodeConverter = {\n converter({ lexicalPluginNode }) {\n let fields = {}\n if ((lexicalPluginNode as any)?.caption?.editorState) {\n fields = {\n caption: (lexicalPluginNode as any)?.caption,\n }\n }\n return {\n type: 'upload',\n fields,\n format: (lexicalPluginNode as any)?.format || '',\n relationTo: (lexicalPluginNode as any)?.rawImagePayload?.relationTo,\n value: {\n id: (lexicalPluginNode as any)?.rawImagePayload?.value?.id || '',\n },\n version: 1,\n } as const as SerializedUploadNode\n },\n nodeTypes: ['upload'],\n}\n"],"names":["_UploadConverter","converter","lexicalPluginNode","fields","caption","editorState","type","format","relationTo","rawImagePayload","value","id","version","nodeTypes"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,qDAAqD,GAKrD,OAAO,MAAMA,mBAA+C;IAC1DC,WAAU,EAAEC,iBAAiB,EAAE;QAC7B,IAAIC,SAAS,CAAC;QACd,IAAKD,mBAA2BE,SAASC,aAAa;YACpDF,SAAS;gBACPC,SAAUF,mBAA2BE;YACvC;QACF;QACA,OAAO;YACLE,MAAM;YACNH;YACAI,QAAQ,AAACL,mBAA2BK,UAAU;YAC9CC,YAAaN,mBAA2BO,iBAAiBD;YACzDE,OAAO;gBACLC,IAAI,AAACT,mBAA2BO,iBAAiBC,OAAOC,MAAM;YAChE;YACAC,SAAS;QACX;IACF;IACAC,WAAW;QAAC;KAAS;AACvB,EAAC"}
1
+ {"version":3,"sources":["../../../../../../../../src/field/features/migrations/lexicalPluginToLexical/converter/converters/upload/converter.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport type { SerializedUploadNode } from '../../../../../upload/nodes/UploadNode.js'\nimport type { LexicalPluginNodeConverter } from '../../types.js'\n\nexport const _UploadConverter: LexicalPluginNodeConverter = {\n converter({ lexicalPluginNode }) {\n let fields = {}\n if ((lexicalPluginNode as any)?.caption?.editorState) {\n fields = {\n caption: (lexicalPluginNode as any)?.caption,\n }\n }\n return {\n type: 'upload',\n fields,\n format: (lexicalPluginNode as any)?.format || '',\n relationTo: (lexicalPluginNode as any)?.rawImagePayload?.relationTo,\n value: (lexicalPluginNode as any)?.rawImagePayload?.value?.id || '',\n version: 2,\n } as const as SerializedUploadNode\n },\n nodeTypes: ['upload'],\n}\n"],"names":["_UploadConverter","converter","lexicalPluginNode","fields","caption","editorState","type","format","relationTo","rawImagePayload","value","id","version","nodeTypes"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,qDAAqD,GAKrD,OAAO,MAAMA,mBAA+C;IAC1DC,WAAU,EAAEC,iBAAiB,EAAE;QAC7B,IAAIC,SAAS,CAAC;QACd,IAAKD,mBAA2BE,SAASC,aAAa;YACpDF,SAAS;gBACPC,SAAUF,mBAA2BE;YACvC;QACF;QACA,OAAO;YACLE,MAAM;YACNH;YACAI,QAAQ,AAACL,mBAA2BK,UAAU;YAC9CC,YAAaN,mBAA2BO,iBAAiBD;YACzDE,OAAO,AAACR,mBAA2BO,iBAAiBC,OAAOC,MAAM;YACjEC,SAAS;QACX;IACF;IACAC,WAAW;QAAC;KAAS;AACvB,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"converter.d.ts","sourceRoot":"","sources":["../../../../../../../../src/field/features/migrations/slateToLexical/converter/converters/relationship/converter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAExD,eAAO,MAAM,2BAA2B,EAAE,kBAazC,CAAA"}
1
+ {"version":3,"file":"converter.d.ts","sourceRoot":"","sources":["../../../../../../../../src/field/features/migrations/slateToLexical/converter/converters/relationship/converter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAExD,eAAO,MAAM,2BAA2B,EAAE,kBAWzC,CAAA"}
@@ -4,10 +4,8 @@ export const _SlateRelationshipConverter = {
4
4
  type: 'relationship',
5
5
  format: '',
6
6
  relationTo: slateNode.relationTo,
7
- value: {
8
- id: slateNode?.value?.id || ''
9
- },
10
- version: 1
7
+ value: slateNode?.value?.id || '',
8
+ version: 2
11
9
  };
12
10
  },
13
11
  nodeTypes: [
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../src/field/features/migrations/slateToLexical/converter/converters/relationship/converter.ts"],"sourcesContent":["import type { SerializedRelationshipNode } from '../../../../../relationship/nodes/RelationshipNode.js'\nimport type { SlateNodeConverter } from '../../types.js'\n\nexport const _SlateRelationshipConverter: SlateNodeConverter = {\n converter({ slateNode }) {\n return {\n type: 'relationship',\n format: '',\n relationTo: slateNode.relationTo,\n value: {\n id: slateNode?.value?.id || '',\n },\n version: 1,\n } as const as SerializedRelationshipNode\n },\n nodeTypes: ['relationship'],\n}\n"],"names":["_SlateRelationshipConverter","converter","slateNode","type","format","relationTo","value","id","version","nodeTypes"],"rangeMappings":";;;;;;;;;;;;;;;","mappings":"AAGA,OAAO,MAAMA,8BAAkD;IAC7DC,WAAU,EAAEC,SAAS,EAAE;QACrB,OAAO;YACLC,MAAM;YACNC,QAAQ;YACRC,YAAYH,UAAUG,UAAU;YAChCC,OAAO;gBACLC,IAAIL,WAAWI,OAAOC,MAAM;YAC9B;YACAC,SAAS;QACX;IACF;IACAC,WAAW;QAAC;KAAe;AAC7B,EAAC"}
1
+ {"version":3,"sources":["../../../../../../../../src/field/features/migrations/slateToLexical/converter/converters/relationship/converter.ts"],"sourcesContent":["import type { SerializedRelationshipNode } from '../../../../../relationship/nodes/RelationshipNode.js'\nimport type { SlateNodeConverter } from '../../types.js'\n\nexport const _SlateRelationshipConverter: SlateNodeConverter = {\n converter({ slateNode }) {\n return {\n type: 'relationship',\n format: '',\n relationTo: slateNode.relationTo,\n value: slateNode?.value?.id || '',\n version: 2,\n } as const as SerializedRelationshipNode\n },\n nodeTypes: ['relationship'],\n}\n"],"names":["_SlateRelationshipConverter","converter","slateNode","type","format","relationTo","value","id","version","nodeTypes"],"rangeMappings":";;;;;;;;;;;;;","mappings":"AAGA,OAAO,MAAMA,8BAAkD;IAC7DC,WAAU,EAAEC,SAAS,EAAE;QACrB,OAAO;YACLC,MAAM;YACNC,QAAQ;YACRC,YAAYH,UAAUG,UAAU;YAChCC,OAAOJ,WAAWI,OAAOC,MAAM;YAC/BC,SAAS;QACX;IACF;IACAC,WAAW;QAAC;KAAe;AAC7B,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"converter.d.ts","sourceRoot":"","sources":["../../../../../../../../src/field/features/migrations/slateToLexical/converter/converters/upload/converter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAExD,eAAO,MAAM,qBAAqB,EAAE,kBAgBnC,CAAA"}
1
+ {"version":3,"file":"converter.d.ts","sourceRoot":"","sources":["../../../../../../../../src/field/features/migrations/slateToLexical/converter/converters/upload/converter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAExD,eAAO,MAAM,qBAAqB,EAAE,kBAcnC,CAAA"}
@@ -7,10 +7,8 @@ export const _SlateUploadConverter = {
7
7
  },
8
8
  format: '',
9
9
  relationTo: slateNode.relationTo,
10
- value: {
11
- id: slateNode.value?.id || ''
12
- },
13
- version: 1
10
+ value: slateNode.value?.id || '',
11
+ version: 2
14
12
  };
15
13
  },
16
14
  nodeTypes: [
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../src/field/features/migrations/slateToLexical/converter/converters/upload/converter.ts"],"sourcesContent":["import type { SerializedUploadNode } from '../../../../../upload/nodes/UploadNode.js'\nimport type { SlateNodeConverter } from '../../types.js'\n\nexport const _SlateUploadConverter: SlateNodeConverter = {\n converter({ slateNode }) {\n return {\n type: 'upload',\n fields: {\n ...slateNode.fields,\n },\n format: '',\n relationTo: slateNode.relationTo,\n value: {\n id: slateNode.value?.id || '',\n },\n version: 1,\n } as const as SerializedUploadNode\n },\n nodeTypes: ['upload'],\n}\n"],"names":["_SlateUploadConverter","converter","slateNode","type","fields","format","relationTo","value","id","version","nodeTypes"],"rangeMappings":";;;;;;;;;;;;;;;;;;","mappings":"AAGA,OAAO,MAAMA,wBAA4C;IACvDC,WAAU,EAAEC,SAAS,EAAE;QACrB,OAAO;YACLC,MAAM;YACNC,QAAQ;gBACN,GAAGF,UAAUE,MAAM;YACrB;YACAC,QAAQ;YACRC,YAAYJ,UAAUI,UAAU;YAChCC,OAAO;gBACLC,IAAIN,UAAUK,KAAK,EAAEC,MAAM;YAC7B;YACAC,SAAS;QACX;IACF;IACAC,WAAW;QAAC;KAAS;AACvB,EAAC"}
1
+ {"version":3,"sources":["../../../../../../../../src/field/features/migrations/slateToLexical/converter/converters/upload/converter.ts"],"sourcesContent":["import type { SerializedUploadNode } from '../../../../../upload/nodes/UploadNode.js'\nimport type { SlateNodeConverter } from '../../types.js'\n\nexport const _SlateUploadConverter: SlateNodeConverter = {\n converter({ slateNode }) {\n return {\n type: 'upload',\n fields: {\n ...slateNode.fields,\n },\n format: '',\n relationTo: slateNode.relationTo,\n value: slateNode.value?.id || '',\n version: 2,\n } as const as SerializedUploadNode\n },\n nodeTypes: ['upload'],\n}\n"],"names":["_SlateUploadConverter","converter","slateNode","type","fields","format","relationTo","value","id","version","nodeTypes"],"rangeMappings":";;;;;;;;;;;;;;;;","mappings":"AAGA,OAAO,MAAMA,wBAA4C;IACvDC,WAAU,EAAEC,SAAS,EAAE;QACrB,OAAO;YACLC,MAAM;YACNC,QAAQ;gBACN,GAAGF,UAAUE,MAAM;YACrB;YACAC,QAAQ;YACRC,YAAYJ,UAAUI,UAAU;YAChCC,OAAOL,UAAUK,KAAK,EAAEC,MAAM;YAC9BC,SAAS;QACX;IACF;IACAC,WAAW;QAAC;KAAS;AACvB,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/relationship/drawer/index.tsx"],"names":[],"mappings":"AASA,OAAO,KAA2C,MAAM,OAAO,CAAA;AAmC/D,KAAK,KAAK,GAAG;IACX,sBAAsB,EAAE,IAAI,GAAG,MAAM,EAAE,CAAA;CACxC,CAAA;AAkDD,eAAO,MAAM,kBAAkB,UAAW,KAAK,KAAG,MAAM,SAQvD,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/relationship/drawer/index.tsx"],"names":[],"mappings":"AASA,OAAO,KAA2C,MAAM,OAAO,CAAA;AAiC/D,KAAK,KAAK,GAAG;IACX,sBAAsB,EAAE,IAAI,GAAG,MAAM,EAAE,CAAA;CACxC,CAAA;AAkDD,eAAO,MAAM,kBAAkB,UAAW,KAAK,KAAG,MAAM,SAQvD,CAAA"}
@@ -9,13 +9,11 @@ import { $createRelationshipNode } from '../nodes/RelationshipNode.js';
9
9
  import { INSERT_RELATIONSHIP_COMMAND } from '../plugins/index.js';
10
10
  import { EnabledRelationshipsCondition } from '../utils/EnabledRelationshipsCondition.js';
11
11
  import { INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND } from './commands.js';
12
- const insertRelationship = ({ id, editor, relationTo, replaceNodeKey })=>{
12
+ const insertRelationship = ({ editor, relationTo, replaceNodeKey, value })=>{
13
13
  if (!replaceNodeKey) {
14
14
  editor.dispatchCommand(INSERT_RELATIONSHIP_COMMAND, {
15
15
  relationTo,
16
- value: {
17
- id
18
- }
16
+ value
19
17
  });
20
18
  } else {
21
19
  editor.update(()=>{
@@ -23,9 +21,7 @@ const insertRelationship = ({ id, editor, relationTo, replaceNodeKey })=>{
23
21
  if (node) {
24
22
  node.replace($createRelationshipNode({
25
23
  relationTo,
26
- value: {
27
- id
28
- }
24
+ value
29
25
  }));
30
26
  }
31
27
  });
@@ -51,10 +47,10 @@ const RelationshipDrawerComponent = ({ enabledCollectionSlugs })=>{
51
47
  ]);
52
48
  const onSelect = useCallback(({ collectionSlug, docID })=>{
53
49
  insertRelationship({
54
- id: docID,
55
50
  editor,
56
51
  relationTo: collectionSlug,
57
- replaceNodeKey
52
+ replaceNodeKey,
53
+ value: docID
58
54
  });
59
55
  closeDrawer();
60
56
  }, [