@payloadcms/richtext-lexical 3.60.0-internal.8e20fed → 3.60.0-internal.c277fd4

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 (102) hide show
  1. package/dist/exports/client/Field-YHS7VMOE.js +2 -0
  2. package/dist/exports/client/Field-YHS7VMOE.js.map +7 -0
  3. package/dist/exports/client/bundled.css +1 -1
  4. package/dist/exports/client/{chunk-IBFFIWII.js → chunk-ADWHGDDR.js} +2 -2
  5. package/dist/exports/client/{chunk-IBFFIWII.js.map → chunk-ADWHGDDR.js.map} +2 -2
  6. package/dist/exports/client/componentInline-MIPTDFRK.js +2 -0
  7. package/dist/exports/client/index.js +12 -12
  8. package/dist/exports/client/index.js.map +4 -4
  9. package/dist/features/blockquote/server/index.d.ts +3 -4
  10. package/dist/features/blockquote/server/index.d.ts.map +1 -1
  11. package/dist/features/blockquote/server/index.js.map +1 -1
  12. package/dist/features/blocks/premade/CodeBlock/index.d.ts +3 -1
  13. package/dist/features/blocks/premade/CodeBlock/index.d.ts.map +1 -1
  14. package/dist/features/blocks/premade/CodeBlock/index.js +7 -2
  15. package/dist/features/blocks/premade/CodeBlock/index.js.map +1 -1
  16. package/dist/features/blocks/server/nodes/BlocksNode.d.ts +4 -4
  17. package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
  18. package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
  19. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts +4 -4
  20. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts.map +1 -1
  21. package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
  22. package/dist/features/converters/lexicalToHtml_deprecated/converter/index.d.ts +10 -1
  23. package/dist/features/converters/lexicalToHtml_deprecated/converter/index.d.ts.map +1 -1
  24. package/dist/features/converters/lexicalToHtml_deprecated/converter/index.js +10 -1
  25. package/dist/features/converters/lexicalToHtml_deprecated/converter/index.js.map +1 -1
  26. package/dist/features/converters/lexicalToHtml_deprecated/field/index.d.ts.map +1 -1
  27. package/dist/features/converters/lexicalToHtml_deprecated/field/index.js.map +1 -1
  28. package/dist/features/converters/lexicalToHtml_deprecated/index.d.ts +2 -1
  29. package/dist/features/converters/lexicalToHtml_deprecated/index.d.ts.map +1 -1
  30. package/dist/features/converters/lexicalToHtml_deprecated/index.js +2 -1
  31. package/dist/features/converters/lexicalToHtml_deprecated/index.js.map +1 -1
  32. package/dist/features/experimental_table/server/index.d.ts +5 -10
  33. package/dist/features/experimental_table/server/index.d.ts.map +1 -1
  34. package/dist/features/experimental_table/server/index.js.map +1 -1
  35. package/dist/features/heading/server/index.d.ts +3 -4
  36. package/dist/features/heading/server/index.d.ts.map +1 -1
  37. package/dist/features/heading/server/index.js.map +1 -1
  38. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts +3 -4
  39. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts.map +1 -1
  40. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js.map +1 -1
  41. package/dist/features/link/nodes/types.d.ts +6 -6
  42. package/dist/features/link/nodes/types.d.ts.map +1 -1
  43. package/dist/features/link/nodes/types.js.map +1 -1
  44. package/dist/features/lists/checklist/client/index.d.ts.map +1 -1
  45. package/dist/features/lists/checklist/client/index.js +4 -2
  46. package/dist/features/lists/checklist/client/index.js.map +1 -1
  47. package/dist/features/lists/checklist/server/index.d.ts.map +1 -1
  48. package/dist/features/lists/checklist/server/index.js +3 -2
  49. package/dist/features/lists/checklist/server/index.js.map +1 -1
  50. package/dist/features/lists/orderedList/client/index.d.ts.map +1 -1
  51. package/dist/features/lists/orderedList/client/index.js +5 -3
  52. package/dist/features/lists/orderedList/client/index.js.map +1 -1
  53. package/dist/features/lists/orderedList/server/index.d.ts.map +1 -1
  54. package/dist/features/lists/orderedList/server/index.js +3 -2
  55. package/dist/features/lists/orderedList/server/index.js.map +1 -1
  56. package/dist/features/lists/plugin/index.d.ts +6 -7
  57. package/dist/features/lists/plugin/index.d.ts.map +1 -1
  58. package/dist/features/lists/plugin/index.js.map +1 -1
  59. package/dist/features/lists/shared/shouldRegisterListBaseNodes.d.ts +2 -0
  60. package/dist/features/lists/shared/shouldRegisterListBaseNodes.d.ts.map +1 -0
  61. package/dist/features/lists/shared/shouldRegisterListBaseNodes.js +14 -0
  62. package/dist/features/lists/shared/shouldRegisterListBaseNodes.js.map +1 -0
  63. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts +3 -4
  64. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
  65. package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
  66. package/dist/features/textState/feature.client.js +9 -7
  67. package/dist/features/textState/feature.client.js.map +1 -1
  68. package/dist/features/textState/textState.d.ts +11 -5
  69. package/dist/features/textState/textState.d.ts.map +1 -1
  70. package/dist/features/textState/textState.js +6 -3
  71. package/dist/features/textState/textState.js.map +1 -1
  72. package/dist/features/typesServer.d.ts +5 -5
  73. package/dist/features/typesServer.d.ts.map +1 -1
  74. package/dist/features/typesServer.js.map +1 -1
  75. package/dist/features/upload/server/nodes/UploadNode.d.ts +3 -4
  76. package/dist/features/upload/server/nodes/UploadNode.d.ts.map +1 -1
  77. package/dist/features/upload/server/nodes/UploadNode.js.map +1 -1
  78. package/dist/field/RenderLexical/index.d.ts +2 -1
  79. package/dist/field/RenderLexical/index.d.ts.map +1 -1
  80. package/dist/field/RenderLexical/index.js.map +1 -1
  81. package/dist/field/bundled.css +1 -1
  82. package/dist/lexical/LexicalEditor.d.ts.map +1 -1
  83. package/dist/lexical/LexicalEditor.js +2 -1
  84. package/dist/lexical/LexicalEditor.js.map +1 -1
  85. package/dist/lexical/plugins/ClipboardPlugin/index.d.ts +2 -0
  86. package/dist/lexical/plugins/ClipboardPlugin/index.d.ts.map +1 -0
  87. package/dist/lexical/plugins/ClipboardPlugin/index.js +64 -0
  88. package/dist/lexical/plugins/ClipboardPlugin/index.js.map +1 -0
  89. package/dist/nodeTypes.d.ts +31 -14
  90. package/dist/nodeTypes.d.ts.map +1 -1
  91. package/dist/nodeTypes.js.map +1 -1
  92. package/dist/types.d.ts +2 -1
  93. package/dist/types.d.ts.map +1 -1
  94. package/dist/types.js.map +1 -1
  95. package/dist/utilities/buildEditorState.d.ts.map +1 -1
  96. package/dist/utilities/buildEditorState.js +1 -0
  97. package/dist/utilities/buildEditorState.js.map +1 -1
  98. package/package.json +8 -7
  99. package/dist/exports/client/Field-CJFETHA3.js +0 -2
  100. package/dist/exports/client/Field-CJFETHA3.js.map +0 -7
  101. package/dist/exports/client/componentInline-ZHQ2OTFH.js +0 -2
  102. /package/dist/exports/client/{componentInline-ZHQ2OTFH.js.map → componentInline-MIPTDFRK.js.map} +0 -0
@@ -1,7 +1,6 @@
1
1
  import type { SerializedQuoteNode as _SerializedQuoteNode } from '@lexical/rich-text';
2
- import type { Spread } from 'lexical';
3
- export type SerializedQuoteNode = Spread<{
4
- type: 'quote';
5
- }, _SerializedQuoteNode>;
2
+ import type { SerializedLexicalNode } from 'lexical';
3
+ import type { StronglyTypedElementNode } from '../../../nodeTypes.js';
4
+ export type SerializedQuoteNode<T extends SerializedLexicalNode = SerializedLexicalNode> = StronglyTypedElementNode<_SerializedQuoteNode, 'quote', T>;
6
5
  export declare const BlockquoteFeature: import("../../typesServer.js").FeatureProviderProviderServer<undefined, undefined, null>;
7
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/blockquote/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,IAAI,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AACrF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAUrC,MAAM,MAAM,mBAAmB,GAAG,MAAM,CACtC;IACE,IAAI,EAAE,OAAO,CAAA;CACd,EACD,oBAAoB,CACrB,CAAA;AAED,eAAO,MAAM,iBAAiB,0FAwD5B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/blockquote/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,IAAI,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AACrF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAIpD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAA;AAQrE,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,qBAAqB,GAAG,qBAAqB,IACrF,wBAAwB,CAAC,oBAAoB,EAAE,OAAO,EAAE,CAAC,CAAC,CAAA;AAE5D,eAAO,MAAM,iBAAiB,0FAwD5B,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["QuoteNode","createServerFeature","convertLexicalNodesToHTML","createNode","MarkdownTransformer","i18n","BlockquoteFeature","feature","ClientFeature","clientFeatureProps","markdownTransformers","nodes","converters","html","converter","currentDepth","depth","draft","node","overrideAccess","parent","req","showHiddenFields","childrenText","lexicalNodes","children","style","format","indent","filter","Boolean","join","nodeTypes","getType","key"],"sources":["../../../../src/features/blockquote/server/index.ts"],"sourcesContent":["import type { SerializedQuoteNode as _SerializedQuoteNode } from '@lexical/rich-text'\nimport type { Spread } from 'lexical'\n\nimport { QuoteNode } from '@lexical/rich-text'\n\nimport { createServerFeature } from '../../../utilities/createServerFeature.js'\nimport { convertLexicalNodesToHTML } from '../../converters/lexicalToHtml_deprecated/converter/index.js'\nimport { createNode } from '../../typeUtilities.js'\nimport { MarkdownTransformer } from '../markdownTransformer.js'\nimport { i18n } from './i18n.js'\n\nexport type SerializedQuoteNode = Spread<\n {\n type: 'quote'\n },\n _SerializedQuoteNode\n>\n\nexport const BlockquoteFeature = createServerFeature({\n feature: {\n ClientFeature: '@payloadcms/richtext-lexical/client#BlockquoteFeatureClient',\n clientFeatureProps: null,\n i18n,\n markdownTransformers: [MarkdownTransformer],\n nodes: [\n createNode({\n converters: {\n html: {\n converter: async ({\n converters,\n currentDepth,\n depth,\n draft,\n node,\n overrideAccess,\n parent,\n req,\n showHiddenFields,\n }) => {\n const childrenText = await convertLexicalNodesToHTML({\n converters,\n currentDepth,\n depth,\n draft,\n lexicalNodes: node.children,\n overrideAccess,\n parent: {\n ...node,\n parent,\n },\n req,\n showHiddenFields,\n })\n const style = [\n node.format ? `text-align: ${node.format};` : '',\n // the unit should be px. Do not change it to rem, em, or something else.\n // The quantity should be 40px. Do not change it either.\n // See rationale in\n // https://github.com/payloadcms/payload/issues/13130#issuecomment-3058348085\n node.indent > 0 ? `padding-inline-start: ${node.indent * 40}px;` : '',\n ]\n .filter(Boolean)\n .join(' ')\n\n return `<blockquote${style ? ` style='${style}'` : ''}>${childrenText}</blockquote>`\n },\n nodeTypes: [QuoteNode.getType()],\n },\n },\n node: QuoteNode,\n }),\n ],\n },\n key: 'blockquote',\n})\n"],"mappings":"AAGA,SAASA,SAAS,QAAQ;AAE1B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,UAAU,QAAQ;AAC3B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,IAAI,QAAQ;AASrB,OAAO,MAAMC,iBAAA,GAAoBL,mBAAA,CAAoB;EACnDM,OAAA,EAAS;IACPC,aAAA,EAAe;IACfC,kBAAA,EAAoB;IACpBJ,IAAA;IACAK,oBAAA,EAAsB,CAACN,mBAAA,CAAoB;IAC3CO,KAAA,EAAO,CACLR,UAAA,CAAW;MACTS,UAAA,EAAY;QACVC,IAAA,EAAM;UACJC,SAAA,EAAW,MAAAA,CAAO;YAChBF,UAAU;YACVG,YAAY;YACZC,KAAK;YACLC,KAAK;YACLC,IAAI;YACJC,cAAc;YACdC,MAAM;YACNC,GAAG;YACHC;UAAgB,CACjB;YACC,MAAMC,YAAA,GAAe,MAAMrB,yBAAA,CAA0B;cACnDU,UAAA;cACAG,YAAA;cACAC,KAAA;cACAC,KAAA;cACAO,YAAA,EAAcN,IAAA,CAAKO,QAAQ;cAC3BN,cAAA;cACAC,MAAA,EAAQ;gBACN,GAAGF,IAAI;gBACPE;cACF;cACAC,GAAA;cACAC;YACF;YACA,MAAMI,KAAA,GAAQ,CACZR,IAAA,CAAKS,MAAM,GAAG,eAAeT,IAAA,CAAKS,MAAM,GAAG,GAAG;YAC9C;YACA;YACA;YACA;YACAT,IAAA,CAAKU,MAAM,GAAG,IAAI,yBAAyBV,IAAA,CAAKU,MAAM,GAAG,OAAO,GAAG,GACpE,CACEC,MAAM,CAACC,OAAA,EACPC,IAAI,CAAC;YAER,OAAO,cAAcL,KAAA,GAAQ,WAAWA,KAAA,GAAQ,GAAG,MAAMH,YAAA,eAA2B;UACtF;UACAS,SAAA,EAAW,CAAChC,SAAA,CAAUiC,OAAO;QAC/B;MACF;MACAf,IAAA,EAAMlB;IACR;EAEJ;EACAkC,GAAA,EAAK;AACP","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["QuoteNode","createServerFeature","convertLexicalNodesToHTML","createNode","MarkdownTransformer","i18n","BlockquoteFeature","feature","ClientFeature","clientFeatureProps","markdownTransformers","nodes","converters","html","converter","currentDepth","depth","draft","node","overrideAccess","parent","req","showHiddenFields","childrenText","lexicalNodes","children","style","format","indent","filter","Boolean","join","nodeTypes","getType","key"],"sources":["../../../../src/features/blockquote/server/index.ts"],"sourcesContent":["import type { SerializedQuoteNode as _SerializedQuoteNode } from '@lexical/rich-text'\nimport type { SerializedLexicalNode } from 'lexical'\n\nimport { QuoteNode } from '@lexical/rich-text'\n\nimport type { StronglyTypedElementNode } from '../../../nodeTypes.js'\n\nimport { createServerFeature } from '../../../utilities/createServerFeature.js'\nimport { convertLexicalNodesToHTML } from '../../converters/lexicalToHtml_deprecated/converter/index.js'\nimport { createNode } from '../../typeUtilities.js'\nimport { MarkdownTransformer } from '../markdownTransformer.js'\nimport { i18n } from './i18n.js'\n\nexport type SerializedQuoteNode<T extends SerializedLexicalNode = SerializedLexicalNode> =\n StronglyTypedElementNode<_SerializedQuoteNode, 'quote', T>\n\nexport const BlockquoteFeature = createServerFeature({\n feature: {\n ClientFeature: '@payloadcms/richtext-lexical/client#BlockquoteFeatureClient',\n clientFeatureProps: null,\n i18n,\n markdownTransformers: [MarkdownTransformer],\n nodes: [\n createNode({\n converters: {\n html: {\n converter: async ({\n converters,\n currentDepth,\n depth,\n draft,\n node,\n overrideAccess,\n parent,\n req,\n showHiddenFields,\n }) => {\n const childrenText = await convertLexicalNodesToHTML({\n converters,\n currentDepth,\n depth,\n draft,\n lexicalNodes: node.children,\n overrideAccess,\n parent: {\n ...node,\n parent,\n },\n req,\n showHiddenFields,\n })\n const style = [\n node.format ? `text-align: ${node.format};` : '',\n // the unit should be px. Do not change it to rem, em, or something else.\n // The quantity should be 40px. Do not change it either.\n // See rationale in\n // https://github.com/payloadcms/payload/issues/13130#issuecomment-3058348085\n node.indent > 0 ? `padding-inline-start: ${node.indent * 40}px;` : '',\n ]\n .filter(Boolean)\n .join(' ')\n\n return `<blockquote${style ? ` style='${style}'` : ''}>${childrenText}</blockquote>`\n },\n nodeTypes: [QuoteNode.getType()],\n },\n },\n node: QuoteNode,\n }),\n ],\n },\n key: 'blockquote',\n})\n"],"mappings":"AAGA,SAASA,SAAS,QAAQ;AAI1B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,UAAU,QAAQ;AAC3B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,IAAI,QAAQ;AAKrB,OAAO,MAAMC,iBAAA,GAAoBL,mBAAA,CAAoB;EACnDM,OAAA,EAAS;IACPC,aAAA,EAAe;IACfC,kBAAA,EAAoB;IACpBJ,IAAA;IACAK,oBAAA,EAAsB,CAACN,mBAAA,CAAoB;IAC3CO,KAAA,EAAO,CACLR,UAAA,CAAW;MACTS,UAAA,EAAY;QACVC,IAAA,EAAM;UACJC,SAAA,EAAW,MAAAA,CAAO;YAChBF,UAAU;YACVG,YAAY;YACZC,KAAK;YACLC,KAAK;YACLC,IAAI;YACJC,cAAc;YACdC,MAAM;YACNC,GAAG;YACHC;UAAgB,CACjB;YACC,MAAMC,YAAA,GAAe,MAAMrB,yBAAA,CAA0B;cACnDU,UAAA;cACAG,YAAA;cACAC,KAAA;cACAC,KAAA;cACAO,YAAA,EAAcN,IAAA,CAAKO,QAAQ;cAC3BN,cAAA;cACAC,MAAA,EAAQ;gBACN,GAAGF,IAAI;gBACPE;cACF;cACAC,GAAA;cACAC;YACF;YACA,MAAMI,KAAA,GAAQ,CACZR,IAAA,CAAKS,MAAM,GAAG,eAAeT,IAAA,CAAKS,MAAM,GAAG,GAAG;YAC9C;YACA;YACA;YACA;YACAT,IAAA,CAAKU,MAAM,GAAG,IAAI,yBAAyBV,IAAA,CAAKU,MAAM,GAAG,OAAO,GAAG,GACpE,CACEC,MAAM,CAACC,OAAA,EACPC,IAAI,CAAC;YAER,OAAO,cAAcL,KAAA,GAAQ,WAAWA,KAAA,GAAQ,GAAG,MAAMH,YAAA,eAA2B;UACtF;UACAS,SAAA,EAAW,CAAChC,SAAA,CAAUiC,OAAO;QAC/B;MACF;MACAf,IAAA,EAAMlB;IACR;EAEJ;EACAkC,GAAA,EAAK;AACP","ignoreList":[]}
@@ -3,5 +3,7 @@ import type { AdditionalCodeComponentProps } from './Component/Code.js';
3
3
  /**
4
4
  * @experimental - this API may change in future, minor releases
5
5
  */
6
- export declare const CodeBlock: (args?: AdditionalCodeComponentProps) => Block;
6
+ export declare const CodeBlock: (args?: {
7
+ fieldOverrides?: Partial<Block>;
8
+ } & AdditionalCodeComponentProps) => Block;
7
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/blocks/premade/CodeBlock/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAEpC,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAA;AAKvE;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,CAAC,IAAI,CAAC,EAAE,4BAA4B,KAAK,KA+ChE,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/blocks/premade/CodeBlock/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAEpC,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAA;AAKvE;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,CACtB,IAAI,CAAC,EAAE;IACL,cAAc,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAA;CAChC,GAAG,4BAA4B,KAC7B,KAiDJ,CAAA"}
@@ -3,7 +3,11 @@ import { codeConverter } from './converter.js';
3
3
  /**
4
4
  * @experimental - this API may change in future, minor releases
5
5
  */
6
- export const CodeBlock = args => {
6
+ export const CodeBlock = _args => {
7
+ const {
8
+ fieldOverrides,
9
+ ...args
10
+ } = _args || {};
7
11
  const languages = args?.languages || defaultLanguages;
8
12
  return {
9
13
  slug: args?.slug || 'Code',
@@ -44,7 +48,8 @@ export const CodeBlock = args => {
44
48
  },
45
49
  label: ''
46
50
  }],
47
- jsx: codeConverter
51
+ jsx: codeConverter,
52
+ ...(fieldOverrides || {})
48
53
  };
49
54
  };
50
55
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["defaultLanguages","codeConverter","CodeBlock","args","languages","slug","admin","components","Block","clientProps","path","jsx","fields","name","type","hidden","defaultValue","defaultLanguage","Object","keys","options","entries","map","key","value","label","Field"],"sources":["../../../../../src/features/blocks/premade/CodeBlock/index.ts"],"sourcesContent":["import type { Block } from 'payload'\n\nimport type { AdditionalCodeComponentProps } from './Component/Code.js'\n\nimport { defaultLanguages } from './Component/defaultLanguages.js'\nimport { codeConverter } from './converter.js'\n\n/**\n * @experimental - this API may change in future, minor releases\n */\nexport const CodeBlock: (args?: AdditionalCodeComponentProps) => Block = (args) => {\n const languages = args?.languages || defaultLanguages\n\n return {\n slug: args?.slug || 'Code',\n admin: {\n components: {\n Block: {\n clientProps: {\n // If default languages are used, return undefined (=> do not pass `languages` variable) in order to reduce data sent to the client\n languages: args?.languages,\n },\n path: '@payloadcms/richtext-lexical/client#CodeBlockBlockComponent',\n },\n },\n jsx: '@payloadcms/richtext-lexical/client#codeConverterClient',\n },\n fields: [\n {\n name: 'language',\n type: 'select',\n admin: {\n // We'll manually render this field into the block component header\n hidden: true,\n },\n defaultValue: args?.defaultLanguage || Object.keys(languages)[0],\n options: Object.entries(languages).map(([key, value]) => ({\n label: value,\n value: key,\n })),\n },\n {\n name: 'code',\n type: 'code',\n admin: {\n components: {\n Field: {\n clientProps: args,\n path: '@payloadcms/richtext-lexical/client#CodeComponent',\n },\n },\n },\n label: '',\n },\n ],\n jsx: codeConverter,\n }\n}\n"],"mappings":"AAIA,SAASA,gBAAgB,QAAQ;AACjC,SAASC,aAAa,QAAQ;AAE9B;;;AAGA,OAAO,MAAMC,SAAA,GAA6DC,IAAA;EACxE,MAAMC,SAAA,GAAYD,IAAA,EAAMC,SAAA,IAAaJ,gBAAA;EAErC,OAAO;IACLK,IAAA,EAAMF,IAAA,EAAME,IAAA,IAAQ;IACpBC,KAAA,EAAO;MACLC,UAAA,EAAY;QACVC,KAAA,EAAO;UACLC,WAAA,EAAa;YACX;YACAL,SAAA,EAAWD,IAAA,EAAMC;UACnB;UACAM,IAAA,EAAM;QACR;MACF;MACAC,GAAA,EAAK;IACP;IACAC,MAAA,EAAQ,CACN;MACEC,IAAA,EAAM;MACNC,IAAA,EAAM;MACNR,KAAA,EAAO;QACL;QACAS,MAAA,EAAQ;MACV;MACAC,YAAA,EAAcb,IAAA,EAAMc,eAAA,IAAmBC,MAAA,CAAOC,IAAI,CAACf,SAAA,CAAU,CAAC,EAAE;MAChEgB,OAAA,EAASF,MAAA,CAAOG,OAAO,CAACjB,SAAA,EAAWkB,GAAG,CAAC,CAAC,CAACC,GAAA,EAAKC,KAAA,CAAM,MAAM;QACxDC,KAAA,EAAOD,KAAA;QACPA,KAAA,EAAOD;MACT;IACF,GACA;MACEV,IAAA,EAAM;MACNC,IAAA,EAAM;MACNR,KAAA,EAAO;QACLC,UAAA,EAAY;UACVmB,KAAA,EAAO;YACLjB,WAAA,EAAaN,IAAA;YACbO,IAAA,EAAM;UACR;QACF;MACF;MACAe,KAAA,EAAO;IACT,EACD;IACDd,GAAA,EAAKV;EACP;AACF","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["defaultLanguages","codeConverter","CodeBlock","_args","fieldOverrides","args","languages","slug","admin","components","Block","clientProps","path","jsx","fields","name","type","hidden","defaultValue","defaultLanguage","Object","keys","options","entries","map","key","value","label","Field"],"sources":["../../../../../src/features/blocks/premade/CodeBlock/index.ts"],"sourcesContent":["import type { Block } from 'payload'\n\nimport type { AdditionalCodeComponentProps } from './Component/Code.js'\n\nimport { defaultLanguages } from './Component/defaultLanguages.js'\nimport { codeConverter } from './converter.js'\n\n/**\n * @experimental - this API may change in future, minor releases\n */\nexport const CodeBlock: (\n args?: {\n fieldOverrides?: Partial<Block>\n } & AdditionalCodeComponentProps,\n) => Block = (_args) => {\n const { fieldOverrides, ...args } = _args || {}\n const languages = args?.languages || defaultLanguages\n\n return {\n slug: args?.slug || 'Code',\n admin: {\n components: {\n Block: {\n clientProps: {\n // If default languages are used, return undefined (=> do not pass `languages` variable) in order to reduce data sent to the client\n languages: args?.languages,\n },\n path: '@payloadcms/richtext-lexical/client#CodeBlockBlockComponent',\n },\n },\n jsx: '@payloadcms/richtext-lexical/client#codeConverterClient',\n },\n fields: [\n {\n name: 'language',\n type: 'select',\n admin: {\n // We'll manually render this field into the block component header\n hidden: true,\n },\n defaultValue: args?.defaultLanguage || Object.keys(languages)[0],\n options: Object.entries(languages).map(([key, value]) => ({\n label: value,\n value: key,\n })),\n },\n {\n name: 'code',\n type: 'code',\n admin: {\n components: {\n Field: {\n clientProps: args,\n path: '@payloadcms/richtext-lexical/client#CodeComponent',\n },\n },\n },\n label: '',\n },\n ],\n jsx: codeConverter,\n ...(fieldOverrides || {}),\n }\n}\n"],"mappings":"AAIA,SAASA,gBAAgB,QAAQ;AACjC,SAASC,aAAa,QAAQ;AAE9B;;;AAGA,OAAO,MAAMC,SAAA,GAICC,KAAA;EACZ,MAAM;IAAEC,cAAc;IAAE,GAAGC;EAAA,CAAM,GAAGF,KAAA,IAAS,CAAC;EAC9C,MAAMG,SAAA,GAAYD,IAAA,EAAMC,SAAA,IAAaN,gBAAA;EAErC,OAAO;IACLO,IAAA,EAAMF,IAAA,EAAME,IAAA,IAAQ;IACpBC,KAAA,EAAO;MACLC,UAAA,EAAY;QACVC,KAAA,EAAO;UACLC,WAAA,EAAa;YACX;YACAL,SAAA,EAAWD,IAAA,EAAMC;UACnB;UACAM,IAAA,EAAM;QACR;MACF;MACAC,GAAA,EAAK;IACP;IACAC,MAAA,EAAQ,CACN;MACEC,IAAA,EAAM;MACNC,IAAA,EAAM;MACNR,KAAA,EAAO;QACL;QACAS,MAAA,EAAQ;MACV;MACAC,YAAA,EAAcb,IAAA,EAAMc,eAAA,IAAmBC,MAAA,CAAOC,IAAI,CAACf,SAAA,CAAU,CAAC,EAAE;MAChEgB,OAAA,EAASF,MAAA,CAAOG,OAAO,CAACjB,SAAA,EAAWkB,GAAG,CAAC,CAAC,CAACC,GAAA,EAAKC,KAAA,CAAM,MAAM;QACxDC,KAAA,EAAOD,KAAA;QACPA,KAAA,EAAOD;MACT;IACF,GACA;MACEV,IAAA,EAAM;MACNC,IAAA,EAAM;MACNR,KAAA,EAAO;QACLC,UAAA,EAAY;UACVmB,KAAA,EAAO;YACLjB,WAAA,EAAaN,IAAA;YACbO,IAAA,EAAM;UACR;QACF;MACF;MACAe,KAAA,EAAO;IACT,EACD;IACDd,GAAA,EAAKZ,aAAA;IACL,IAAIG,cAAA,IAAkB,CAAC,CAAC;EAC1B;AACF","ignoreList":[]}
@@ -1,8 +1,9 @@
1
1
  import type { SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js';
2
- import type { DOMConversionMap, DOMExportOutput, EditorConfig, ElementFormatType, LexicalEditor, LexicalNode, NodeKey, Spread } from 'lexical';
2
+ import type { DOMConversionMap, DOMExportOutput, EditorConfig, ElementFormatType, LexicalEditor, LexicalNode, NodeKey } from 'lexical';
3
3
  import type { JsonObject } from 'payload';
4
4
  import type { JSX } from 'react';
5
5
  import { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js';
6
+ import type { StronglyTypedLeafNode } from '../../../../nodeTypes.js';
6
7
  type BaseBlockFields<TBlockFields extends JsonObject = JsonObject> = {
7
8
  /** Block form data */
8
9
  blockName: string;
@@ -14,10 +15,9 @@ export type BlockFields<TBlockFields extends JsonObject = JsonObject> = {
14
15
  export type BlockFieldsOptionalID<TBlockFields extends JsonObject = JsonObject> = {
15
16
  id?: string;
16
17
  } & BaseBlockFields<TBlockFields>;
17
- export type SerializedBlockNode<TBlockFields extends JsonObject = JsonObject> = Omit<Spread<{
18
+ export type SerializedBlockNode<TBlockFields extends JsonObject = JsonObject> = {
18
19
  fields: BlockFields<TBlockFields>;
19
- type: 'block';
20
- }, Omit<SerializedDecoratorBlockNode, 'type'>>, 'children'>;
20
+ } & StronglyTypedLeafNode<SerializedDecoratorBlockNode, 'block'>;
21
21
  export declare class ServerBlockNode extends DecoratorBlockNode {
22
22
  __cacheBuster: number;
23
23
  __fields: BlockFields;
@@ -1 +1 @@
1
- {"version":3,"file":"BlocksNode.d.ts","sourceRoot":"","sources":["../../../../../src/features/blocks/server/nodes/BlocksNode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAA;AAC/F,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,OAAO,EACP,MAAM,E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Ac,IAAI,MAAM;IAIxB,SAAS,IAAI,WAAW;IAIf,cAAc,IAAI,MAAM;IAIjC,SAAS,CAAC,MAAM,EAAE,WAAW,EAAE,sBAAsB,CAAC,EAAE,OAAO,GAAG,IAAI;CAOvE;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,qBAAqB,GAAG,eAAe,CAOrF;AAED,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,eAAe,GAAG,SAAS,GACrD,IAAI,IAAI,eAAe,CAEzB"}
@@ -1 +1 @@
1
- {"version":3,"file":"BlocksNode.js","names":["DecoratorBlockNode","ObjectID","ServerBlockNode","__cacheBuster","__fields","constructor","cacheBuster","fields","format","key","clone","node","__format","__key","getType","importDOM","importJSON","serializedNode","version","data","$createServerBlockNode","setFormat","isInline","decorate","editor","config","exportDOM","element","document","createElement","text","createTextNode","getTextContent","append","exportJSON","type","getFields","getCacheBuster","getLatest","setFields","preventFormStateUpdate","writable","getWritable","id","default","toHexString","$isServerBlockNode"],"sources":["../../../../../src/features/blocks/server/nodes/BlocksNode.tsx"],"sourcesContent":["import type { SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport type {\n DOMConversionMap,\n DOMExportOutput,\n EditorConfig,\n ElementFormatType,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n Spread,\n} from 'lexical'\nimport type { JsonObject } from 'payload'\nimport type { JSX } from 'react'\n\nimport { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport ObjectID from 'bson-objectid'\n\ntype BaseBlockFields<TBlockFields extends JsonObject = JsonObject> = {\n /** Block form data */\n blockName: string\n blockType: string\n} & TBlockFields\n\nexport type BlockFields<TBlockFields extends JsonObject = JsonObject> = {\n id: string\n} & BaseBlockFields<TBlockFields>\n\nexport type BlockFieldsOptionalID<TBlockFields extends JsonObject = JsonObject> = {\n id?: string\n} & BaseBlockFields<TBlockFields>\n\nexport type SerializedBlockNode<TBlockFields extends JsonObject = JsonObject> = Omit<\n Spread<\n {\n fields: BlockFields<TBlockFields>\n type: 'block'\n },\n Omit<SerializedDecoratorBlockNode, 'type'>\n >,\n 'children'\n>\n\nexport class ServerBlockNode extends DecoratorBlockNode {\n __cacheBuster: number\n __fields: BlockFields\n\n constructor({\n cacheBuster,\n fields,\n format,\n key,\n }: {\n cacheBuster?: number\n fields: BlockFields\n format?: ElementFormatType\n key?: NodeKey\n }) {\n super(format, key)\n this.__fields = fields\n this.__cacheBuster = cacheBuster || 0\n }\n\n static override clone(node: ServerBlockNode): ServerBlockNode {\n return new this({\n cacheBuster: node.__cacheBuster,\n fields: node.__fields,\n format: node.__format,\n key: node.__key,\n })\n }\n\n static override getType(): string {\n return 'block'\n }\n\n static override importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {}\n }\n\n static override importJSON(serializedNode: SerializedBlockNode): ServerBlockNode {\n if (serializedNode.version === 1) {\n // Convert (version 1 had the fields wrapped in another, unnecessary data property)\n serializedNode = {\n ...serializedNode,\n fields: {\n ...(serializedNode as any).fields.data,\n },\n version: 2,\n }\n }\n const node = $createServerBlockNode(serializedNode.fields)\n node.setFormat(serializedNode.format)\n return node\n }\n\n static isInline(): false {\n return false\n }\n\n override decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element {\n return null as unknown as JSX.Element\n }\n\n override exportDOM(): DOMExportOutput {\n const element = document.createElement('div')\n\n const text = document.createTextNode(this.getTextContent())\n element.append(text)\n return { element }\n }\n\n override exportJSON(): SerializedBlockNode {\n return {\n ...super.exportJSON(),\n type: 'block',\n fields: this.getFields(),\n version: 2,\n }\n }\n\n getCacheBuster(): number {\n return this.getLatest().__cacheBuster\n }\n\n getFields(): BlockFields {\n return this.getLatest().__fields\n }\n\n override getTextContent(): string {\n return `Block Field`\n }\n\n setFields(fields: BlockFields, preventFormStateUpdate?: boolean): void {\n const writable = this.getWritable()\n writable.__fields = fields\n if (!preventFormStateUpdate) {\n writable.__cacheBuster++\n }\n }\n}\n\nexport function $createServerBlockNode(fields: BlockFieldsOptionalID): ServerBlockNode {\n return new ServerBlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\n },\n })\n}\n\nexport function $isServerBlockNode(\n node: LexicalNode | null | ServerBlockNode | undefined,\n): node is ServerBlockNode {\n return node instanceof ServerBlockNode\n}\n"],"mappings":"AAcA,SAASA,kBAAkB,QAAQ;AACnC,OAAOC,QAAA,MAAc;AA2BrB,OAAO,MAAMC,eAAA,SAAwBF,kBAAA;EACnCG,aAAA;EACAC,QAAA;EAEAC,YAAY;IACVC,WAAW;IACXC,MAAM;IACNC,MAAM;IACNC;EAAG,CAMJ,EAAE;IACD,KAAK,CAACD,MAAA,EAAQC,GAAA;IACd,IAAI,CAACL,QAAQ,GAAGG,MAAA;IAChB,IAAI,CAACJ,aAAa,GAAGG,WAAA,IAAe;EACtC;EAEA,OAAgBI,MAAMC,IAAqB,EAAmB;IAC5D,OAAO,IAAI,IAAI,CAAC;MACdL,WAAA,EAAaK,IAAA,CAAKR,aAAa;MAC/BI,MAAA,EAAQI,IAAA,CAAKP,QAAQ;MACrBI,MAAA,EAAQG,IAAA,CAAKC,QAAQ;MACrBH,GAAA,EAAKE,IAAA,CAAKE;IACZ;EACF;EAEA,OAAgBC,QAAA,EAAkB;IAChC,OAAO;EACT;EAEA,OAAgBC,UAAA,EAAqD;IACnE,OAAO,CAAC;EACV;EAEA,OAAgBC,WAAWC,cAAmC,EAAmB;IAC/E,IAAIA,cAAA,CAAeC,OAAO,KAAK,GAAG;MAChC;MACAD,cAAA,GAAiB;QACf,GAAGA,cAAc;QACjBV,MAAA,EAAQ;UACN,GAAGU,cAAC,CAAuBV,MAAM,CAACY;QACpC;QACAD,OAAA,EAAS;MACX;IACF;IACA,MAAMP,IAAA,GAAOS,sBAAA,CAAuBH,cAAA,CAAeV,MAAM;IACzDI,IAAA,CAAKU,SAAS,CAACJ,cAAA,CAAeT,MAAM;IACpC,OAAOG,IAAA;EACT;EAEA,OAAOW,SAAA,EAAkB;IACvB,OAAO;EACT;EAESC,SAASC,MAAqB,EAAEC,MAAoB,EAAe;IAC1E,OAAO;EACT;EAESC,UAAA,EAA6B;IACpC,MAAMC,OAAA,GAAUC,QAAA,CAASC,aAAa,CAAC;IAEvC,MAAMC,IAAA,GAAOF,QAAA,CAASG,cAAc,CAAC,IAAI,CAACC,cAAc;IACxDL,OAAA,CAAQM,MAAM,CAACH,IAAA;IACf,OAAO;MAAEH;IAAQ;EACnB;EAESO,WAAA,EAAkC;IACzC,OAAO;MACL,GAAG,KAAK,CAACA,UAAA,EAAY;MACrBC,IAAA,EAAM;MACN5B,MAAA,EAAQ,IAAI,CAAC6B,SAAS;MACtBlB,OAAA,EAAS;IACX;EACF;EAEAmB,eAAA,EAAyB;IACvB,OAAO,IAAI,CAACC,SAAS,GAAGnC,aAAa;EACvC;EAEAiC,UAAA,EAAyB;IACvB,OAAO,IAAI,CAACE,SAAS,GAAGlC,QAAQ;EAClC;EAES4B,eAAA,EAAyB;IAChC,OAAO,aAAa;EACtB;EAEAO,UAAUhC,MAAmB,EAAEiC,sBAAgC,EAAQ;IACrE,MAAMC,QAAA,GAAW,IAAI,CAACC,WAAW;IACjCD,QAAA,CAASrC,QAAQ,GAAGG,MAAA;IACpB,IAAI,CAACiC,sBAAA,EAAwB;MAC3BC,QAAA,CAAStC,aAAa;IACxB;EACF;AACF;AAEA,OAAO,SAASiB,uBAAuBb,MAA6B;EAClE,OAAO,IAAIL,eAAA,CAAgB;IACzBK,MAAA,EAAQ;MACN,GAAGA,MAAM;MACToC,EAAA,EAAIpC,MAAA,EAAQoC,EAAA,IAAM,IAAI1C,QAAA,CAAS2C,OAAO,GAAGC,WAAW;IACtD;EACF;AACF;AAEA,OAAO,SAASC,mBACdnC,IAAsD;EAEtD,OAAOA,IAAA,YAAgBT,eAAA;AACzB","ignoreList":[]}
1
+ {"version":3,"file":"BlocksNode.js","names":["DecoratorBlockNode","ObjectID","ServerBlockNode","__cacheBuster","__fields","constructor","cacheBuster","fields","format","key","clone","node","__format","__key","getType","importDOM","importJSON","serializedNode","version","data","$createServerBlockNode","setFormat","isInline","decorate","editor","config","exportDOM","element","document","createElement","text","createTextNode","getTextContent","append","exportJSON","type","getFields","getCacheBuster","getLatest","setFields","preventFormStateUpdate","writable","getWritable","id","default","toHexString","$isServerBlockNode"],"sources":["../../../../../src/features/blocks/server/nodes/BlocksNode.tsx"],"sourcesContent":["import type { SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport type {\n DOMConversionMap,\n DOMExportOutput,\n EditorConfig,\n ElementFormatType,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n} from 'lexical'\nimport type { JsonObject } from 'payload'\nimport type { JSX } from 'react'\n\nimport { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport ObjectID from 'bson-objectid'\n\nimport type { StronglyTypedLeafNode } from '../../../../nodeTypes.js'\n\ntype BaseBlockFields<TBlockFields extends JsonObject = JsonObject> = {\n /** Block form data */\n blockName: string\n blockType: string\n} & TBlockFields\n\nexport type BlockFields<TBlockFields extends JsonObject = JsonObject> = {\n id: string\n} & BaseBlockFields<TBlockFields>\n\nexport type BlockFieldsOptionalID<TBlockFields extends JsonObject = JsonObject> = {\n id?: string\n} & BaseBlockFields<TBlockFields>\n\nexport type SerializedBlockNode<TBlockFields extends JsonObject = JsonObject> = {\n fields: BlockFields<TBlockFields>\n} & StronglyTypedLeafNode<SerializedDecoratorBlockNode, 'block'>\n\nexport class ServerBlockNode extends DecoratorBlockNode {\n __cacheBuster: number\n __fields: BlockFields\n\n constructor({\n cacheBuster,\n fields,\n format,\n key,\n }: {\n cacheBuster?: number\n fields: BlockFields\n format?: ElementFormatType\n key?: NodeKey\n }) {\n super(format, key)\n this.__fields = fields\n this.__cacheBuster = cacheBuster || 0\n }\n\n static override clone(node: ServerBlockNode): ServerBlockNode {\n return new this({\n cacheBuster: node.__cacheBuster,\n fields: node.__fields,\n format: node.__format,\n key: node.__key,\n })\n }\n\n static override getType(): string {\n return 'block'\n }\n\n static override importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {}\n }\n\n static override importJSON(serializedNode: SerializedBlockNode): ServerBlockNode {\n if (serializedNode.version === 1) {\n // Convert (version 1 had the fields wrapped in another, unnecessary data property)\n serializedNode = {\n ...serializedNode,\n fields: {\n ...(serializedNode as any).fields.data,\n },\n version: 2,\n }\n }\n const node = $createServerBlockNode(serializedNode.fields)\n node.setFormat(serializedNode.format)\n return node\n }\n\n static isInline(): false {\n return false\n }\n\n override decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element {\n return null as unknown as JSX.Element\n }\n\n override exportDOM(): DOMExportOutput {\n const element = document.createElement('div')\n\n const text = document.createTextNode(this.getTextContent())\n element.append(text)\n return { element }\n }\n\n override exportJSON(): SerializedBlockNode {\n return {\n ...super.exportJSON(),\n type: 'block',\n fields: this.getFields(),\n version: 2,\n }\n }\n\n getCacheBuster(): number {\n return this.getLatest().__cacheBuster\n }\n\n getFields(): BlockFields {\n return this.getLatest().__fields\n }\n\n override getTextContent(): string {\n return `Block Field`\n }\n\n setFields(fields: BlockFields, preventFormStateUpdate?: boolean): void {\n const writable = this.getWritable()\n writable.__fields = fields\n if (!preventFormStateUpdate) {\n writable.__cacheBuster++\n }\n }\n}\n\nexport function $createServerBlockNode(fields: BlockFieldsOptionalID): ServerBlockNode {\n return new ServerBlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\n },\n })\n}\n\nexport function $isServerBlockNode(\n node: LexicalNode | null | ServerBlockNode | undefined,\n): node is ServerBlockNode {\n return node instanceof ServerBlockNode\n}\n"],"mappings":"AAaA,SAASA,kBAAkB,QAAQ;AACnC,OAAOC,QAAA,MAAc;AAsBrB,OAAO,MAAMC,eAAA,SAAwBF,kBAAA;EACnCG,aAAA;EACAC,QAAA;EAEAC,YAAY;IACVC,WAAW;IACXC,MAAM;IACNC,MAAM;IACNC;EAAG,C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Q,IAAI,CAAC6B,SAAS;MACtBlB,OAAA,EAAS;IACX;EACF;EAEAmB,eAAA,EAAyB;IACvB,OAAO,IAAI,CAACC,SAAS,GAAGnC,aAAa;EACvC;EAEAiC,UAAA,EAAyB;IACvB,OAAO,IAAI,CAACE,SAAS,GAAGlC,QAAQ;EAClC;EAES4B,eAAA,EAAyB;IAChC,OAAO,aAAa;EACtB;EAEAO,UAAUhC,MAAmB,EAAEiC,sBAAgC,EAAQ;IACrE,MAAMC,QAAA,GAAW,IAAI,CAACC,WAAW;IACjCD,QAAA,CAASrC,QAAQ,GAAGG,MAAA;IACpB,IAAI,CAACiC,sBAAA,EAAwB;MAC3BC,QAAA,CAAStC,aAAa;IACxB;EACF;AACF;AAEA,OAAO,SAASiB,uBAAuBb,MAA6B;EAClE,OAAO,IAAIL,eAAA,CAAgB;IACzBK,MAAA,EAAQ;MACN,GAAGA,MAAM;MACToC,EAAA,EAAIpC,MAAA,EAAQoC,EAAA,IAAM,IAAI1C,QAAA,CAAS2C,OAAO,GAAGC,WAAW;IACtD;EACF;AACF;AAEA,OAAO,SAASC,mBACdnC,IAAsD;EAEtD,OAAOA,IAAA,YAAgBT,eAAA;AACzB","ignoreList":[]}
@@ -1,16 +1,16 @@
1
- import type { DOMConversionMap, DOMExportOutput, EditorConfig, LexicalEditor, LexicalNode, NodeKey, SerializedLexicalNode, Spread } from 'lexical';
1
+ import type { DOMConversionMap, DOMExportOutput, EditorConfig, LexicalEditor, LexicalNode, NodeKey, SerializedLexicalNode } from 'lexical';
2
2
  import type { JsonObject } from 'payload';
3
3
  import type React from 'react';
4
4
  import type { JSX } from 'react';
5
5
  import { DecoratorNode } from 'lexical';
6
+ import type { StronglyTypedLeafNode } from '../../../../nodeTypes.js';
6
7
  export type InlineBlockFields<TInlineBlockFields extends JsonObject = JsonObject> = {
7
8
  blockType: string;
8
9
  id: string;
9
10
  } & TInlineBlockFields;
10
- export type SerializedInlineBlockNode<TBlockFields extends JsonObject = JsonObject> = Omit<Spread<{
11
+ export type SerializedInlineBlockNode<TBlockFields extends JsonObject = JsonObject> = {
11
12
  fields: InlineBlockFields<TBlockFields>;
12
- type: 'inlineBlock';
13
- }, Omit<SerializedLexicalNode, 'type'>>, 'children'>;
13
+ } & StronglyTypedLeafNode<SerializedLexicalNode, 'inlineBlock'>;
14
14
  export declare class ServerInlineBlockNode extends DecoratorNode<null | React.ReactElement> {
15
15
  __cacheBuster: number;
16
16
  __fields: InlineBlockFields;
@@ -1 +1 @@
1
- {"version":3,"file":"InlineBlocksNode.d.ts","sourceRoot":"","sources":["../../../../../src/features/blocks/server/nodes/InlineBlocksNode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,aAAa,EACb,WAAW,EACX,OAAO,EACP,qBAAqB,EACrB,MAAM,EACP,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACzC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAGhC,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAEvC,MAAM,MAAM,iBAAiB,CAAC,kBAAkB,SAAS,UAAU,GAAG,UAAU,IAAI;IAClF,SAAS,EAAE,MAAM,CAAA;IACjB,EAAE,EAAE,MAAM,CAAA;CACX,GAAG,kBAAkB,CAAA;AAEtB,MAAM,MAAM,yBAAyB,CAAC,YAAY,SAAS,UAAU,GAAG,UAAU,IAAI,IAAI,CACxF,MAAM,CACJ;IACE,MAAM,EAAE,iBAAiB,CAAC,YAAY,CAAC,CAAA;IACvC,IAAI,EAAE,aAAa,CAAA;CACpB,EACD,IAAI,CAAC,qBAAqB,EAAE,MAAM,CAAC,CACpC,EACD,UAAU,CACX,CAAA;AAED,qBAAa,qBAAsB,SAAQ,aAAa,CAAC,IAAI,GAAG,KAAK,CAAC,YAAY,CAAC;IAC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,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,GAAG,GAAG,CAAC,OAAO,GAAG,IAAI;IAIzE,SAAS,IAAI,eAAe;IAS5B,UAAU,IAAI,yBAAyB;IAQhD,cAAc,IAAI,MAAM;IAIxB,SAAS,IAAI,iBAAiB;IAIrB,cAAc,IAAI,MAAM;IAIxB,QAAQ;IAIjB,SAAS,CAAC,MAAM,EAAE,iBAAiB,EAAE,sBAAsB,CAAC,EAAE,OAAO,GAAG,IAAI;IAQnE,SAAS,IAAI,OAAO;CAG9B;AAED,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,OAAO,CAAC,iBAAiB,EAAE,IAAI,CAAC,GACvC,qBAAqB,CAOvB;AAED,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,qBAAqB,GAAG,SAAS,GAC3D,IAAI,IAAI,qBAAqB,CAE/B"}
@@ -1 +1 @@
1
- {"version":3,"file":"InlineBlocksNode.js","names":["ObjectID","DecoratorNode","ServerInlineBlockNode","__cacheBuster","__fields","constructor","cacheBuster","fields","key","clone","node","__key","getType","importDOM","importJSON","serializedNode","$createServerInlineBlockNode","isInline","canIndent","createDOM","element","document","createElement","classList","add","decorate","editor","config","exportDOM","text","createTextNode","getTextContent","append","exportJSON","type","getFields","version","getCacheBuster","getLatest","setFields","preventFormStateUpdate","writable","getWritable","updateDOM","id","default","toHexString","$isServerInlineBlockNode"],"sources":["../../../../../src/features/blocks/server/nodes/InlineBlocksNode.tsx"],"sourcesContent":["import type {\n DOMConversionMap,\n DOMExportOutput,\n EditorConfig,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n SerializedLexicalNode,\n Spread,\n} from 'lexical'\nimport type { JsonObject } from 'payload'\nimport type React from 'react'\nimport type { JSX } from 'react'\n\nimport ObjectID from 'bson-objectid'\nimport { DecoratorNode } from 'lexical'\n\nexport type InlineBlockFields<TInlineBlockFields extends JsonObject = JsonObject> = {\n blockType: string\n id: string\n} & TInlineBlockFields\n\nexport type SerializedInlineBlockNode<TBlockFields extends JsonObject = JsonObject> = Omit<\n Spread<\n {\n fields: InlineBlockFields<TBlockFields>\n type: 'inlineBlock'\n },\n Omit<SerializedLexicalNode, 'type'>\n >,\n 'children'\n>\n\nexport class ServerInlineBlockNode extends DecoratorNode<null | React.ReactElement> {\n __cacheBuster: number\n __fields: InlineBlockFields\n\n constructor({\n cacheBuster,\n fields,\n key,\n }: {\n cacheBuster?: number\n fields: InlineBlockFields\n key?: NodeKey\n }) {\n super(key)\n this.__fields = fields\n this.__cacheBuster = cacheBuster || 0\n }\n\n static override clone(node: ServerInlineBlockNode): ServerInlineBlockNode {\n return new this({\n cacheBuster: node.__cacheBuster,\n fields: node.__fields,\n key: node.__key,\n })\n }\n\n static override getType(): string {\n return 'inlineBlock'\n }\n\n static override importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {}\n }\n\n static override importJSON(serializedNode: SerializedInlineBlockNode): ServerInlineBlockNode {\n const node = $createServerInlineBlockNode(serializedNode.fields)\n return node\n }\n\n static isInline(): false {\n return false\n }\n\n canIndent() {\n return true\n }\n override createDOM() {\n const element = document.createElement('span')\n element.classList.add('inline-block-container')\n\n return element\n }\n\n override decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element | null {\n return null\n }\n\n override exportDOM(): DOMExportOutput {\n const element = document.createElement('span')\n element.classList.add('inline-block-container')\n\n const text = document.createTextNode(this.getTextContent())\n element.append(text)\n return { element }\n }\n\n override exportJSON(): SerializedInlineBlockNode {\n return {\n type: 'inlineBlock',\n fields: this.getFields(),\n version: 1,\n }\n }\n\n getCacheBuster(): number {\n return this.getLatest().__cacheBuster\n }\n\n getFields(): InlineBlockFields {\n return this.getLatest().__fields\n }\n\n override getTextContent(): string {\n return `Block Field`\n }\n\n override isInline() {\n return true\n }\n\n setFields(fields: InlineBlockFields, preventFormStateUpdate?: boolean): void {\n const writable = this.getWritable()\n writable.__fields = fields\n if (!preventFormStateUpdate) {\n writable.__cacheBuster++\n }\n }\n\n override updateDOM(): boolean {\n return false\n }\n}\n\nexport function $createServerInlineBlockNode(\n fields: Exclude<InlineBlockFields, 'id'>,\n): ServerInlineBlockNode {\n return new ServerInlineBlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\n },\n })\n}\n\nexport function $isServerInlineBlockNode(\n node: LexicalNode | null | ServerInlineBlockNode | undefined,\n): node is ServerInlineBlockNode {\n return node instanceof ServerInlineBlockNode\n}\n"],"mappings":"AAcA,OAAOA,QAAA,MAAc;AACrB,SAASC,aAAa,QAAQ;AAkB9B,OAAO,MAAMC,qBAAA,SAA8BD,aAAA;EACzCE,aAAA;EACAC,QAAA;EAEAC,YAAY;IACVC,WAAW;IACXC,MAAM;IACNC;EAAG,CAKJ,EAAE;IACD,KAAK,CAACA,GAAA;IACN,IAAI,CAACJ,QAAQ,GAAGG,MAAA;IAChB,IAAI,CAACJ,aAAa,GAAGG,WAAA,IAAe;EACtC;EAEA,OAAgBG,MAAMC,IAA2B,EAAyB;IACxE,OAAO,IAAI,IAAI,CAAC;MACdJ,WAAA,EAAaI,IAAA,CAAKP,aAAa;MAC/BI,MAAA,EAAQG,IAAA,CAAKN,QAAQ;MACrBI,GAAA,EAAKE,IAAA,CAAKC;IACZ;EACF;EAEA,OAAgBC,QAAA,EAAkB;IAChC,OAAO;EACT;EAEA,OAAgBC,UAAA,EAAqD;IACnE,OAAO,CAAC;EACV;EAEA,OAAgBC,WAAWC,cAAyC,EAAyB;IAC3F,MAAML,IAAA,GAAOM,4BAAA,CAA6BD,cAAA,CAAeR,MAAM;IAC/D,OAAOG,IAAA;EACT;EAEA,OAAOO,SAAA,EAAkB;IACvB,OAAO;EACT;EAEAC,UAAA,EAAY;IACV,OAAO;EACT;EACSC,UAAA,EAAY;IACnB,MAAMC,OAAA,GAAUC,QAAA,CAASC,aAAa,CAAC;IACvCF,OAAA,CAAQG,SAAS,CAACC,GAAG,CAAC;IAEtB,OAAOJ,OAAA;EACT;EAESK,SAASC,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jectID","DecoratorNode","ServerInlineBlockNode","__cacheBuster","__fields","constructor","cacheBuster","fields","key","clone","node","__key","getType","importDOM","importJSON","serializedNode","$createServerInlineBlockNode","isInline","canIndent","createDOM","element","document","createElement","classList","add","decorate","editor","config","exportDOM","text","createTextNode","getTextContent","append","exportJSON","type","getFields","version","getCacheBuster","getLatest","setFields","preventFormStateUpdate","writable","getWritable","updateDOM","id","default","toHexString","$isServerInlineBlockNode"],"sources":["../../../../../src/features/blocks/server/nodes/InlineBlocksNode.tsx"],"sourcesContent":["import type {\n DOMConversionMap,\n DOMExportOutput,\n EditorConfig,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n SerializedLexicalNode,\n} from 'lexical'\nimport type { JsonObject } from 'payload'\nimport type React from 'react'\nimport type { JSX } from 'react'\n\nimport ObjectID from 'bson-objectid'\nimport { DecoratorNode } from 'lexical'\n\nimport type { StronglyTypedLeafNode } from '../../../../nodeTypes.js'\n\nexport type InlineBlockFields<TInlineBlockFields extends JsonObject = JsonObject> = {\n blockType: string\n id: string\n} & TInlineBlockFields\n\nexport type SerializedInlineBlockNode<TBlockFields extends JsonObject = JsonObject> = {\n fields: InlineBlockFields<TBlockFields>\n} & StronglyTypedLeafNode<SerializedLexicalNode, 'inlineBlock'>\n\nexport class ServerInlineBlockNode extends DecoratorNode<null | React.ReactElement> {\n __cacheBuster: number\n __fields: InlineBlockFields\n\n constructor({\n cacheBuster,\n fields,\n key,\n }: {\n cacheBuster?: number\n fields: InlineBlockFields\n key?: NodeKey\n }) {\n super(key)\n this.__fields = fields\n this.__cacheBuster = cacheBuster || 0\n }\n\n static override clone(node: ServerInlineBlockNode): ServerInlineBlockNode {\n return new this({\n cacheBuster: node.__cacheBuster,\n fields: node.__fields,\n key: node.__key,\n })\n }\n\n static override getType(): string {\n return 'inlineBlock'\n }\n\n static override importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {}\n }\n\n static override importJSON(serializedNode: SerializedInlineBlockNode): ServerInlineBlockNode {\n const node = $createServerInlineBlockNode(serializedNode.fields)\n return node\n }\n\n static isInline(): false {\n return false\n }\n\n canIndent() {\n return true\n }\n override createDOM() {\n const element = document.createElement('span')\n element.classList.add('inline-block-container')\n\n return element\n }\n\n override decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element | null {\n return null\n }\n\n override exportDOM(): DOMExportOutput {\n const element = document.createElement('span')\n element.classList.add('inline-block-container')\n\n const text = document.createTextNode(this.getTextContent())\n element.append(text)\n return { element }\n }\n\n override exportJSON(): SerializedInlineBlockNode {\n return {\n type: 'inlineBlock',\n fields: this.getFields(),\n version: 1,\n }\n }\n\n getCacheBuster(): number {\n return this.getLatest().__cacheBuster\n }\n\n getFields(): InlineBlockFields {\n return this.getLatest().__fields\n }\n\n override getTextContent(): string {\n return `Block Field`\n }\n\n override isInline() {\n return true\n }\n\n setFields(fields: InlineBlockFields, preventFormStateUpdate?: boolean): void {\n const writable = this.getWritable()\n writable.__fields = fields\n if (!preventFormStateUpdate) {\n writable.__cacheBuster++\n }\n }\n\n override updateDOM(): boolean {\n return false\n }\n}\n\nexport function $createServerInlineBlockNode(\n fields: Exclude<InlineBlockFields, 'id'>,\n): ServerInlineBlockNode {\n return new ServerInlineBlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\n },\n })\n}\n\nexport function $isServerInlineBlockNode(\n node: LexicalNode | null | ServerInlineBlockNode | undefined,\n): node is ServerInlineBlockNode {\n return node instanceof ServerInlineBlockNode\n}\n"],"mappings":"AAaA,OAAOA,QAAA,MAAc;AACrB,SAASC,aAAa,QAAQ;AAa9B,OAAO,MAAMC,qBAAA,SAA8BD,aAAA;EACzCE,aAAA;EACAC,QAAA;EAEAC,YAAY;IACVC,WAAW;IACXC,MAAM;IACNC;EAAG,CAKJ,EAAE;IACD,KAAK,CAACA,GAAA;IACN,IAAI,CAACJ,QAAQ,GAAGG,MAAA;IAChB,IAAI,CAACJ,aAAa,GAAGG,WAAA,IAAe;EACtC;EAEA,OAAgB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ACtB;EAESd,SAAA,EAAW;IAClB,OAAO;EACT;EAEAsB,UAAUhC,MAAyB,EAAEiC,sBAAgC,EAAQ;IAC3E,MAAMC,QAAA,GAAW,IAAI,CAACC,WAAW;IACjCD,QAAA,CAASrC,QAAQ,GAAGG,MAAA;IACpB,IAAI,CAACiC,sBAAA,EAAwB;MAC3BC,QAAA,CAAStC,aAAa;IACxB;EACF;EAESwC,UAAA,EAAqB;IAC5B,OAAO;EACT;AACF;AAEA,OAAO,SAAS3B,6BACdT,MAAwC;EAExC,OAAO,IAAIL,qBAAA,CAAsB;IAC/BK,MAAA,EAAQ;MACN,GAAGA,MAAM;MACTqC,EAAA,EAAIrC,MAAA,EAAQqC,EAAA,IAAM,IAAI5C,QAAA,CAAS6C,OAAO,GAAGC,WAAW;IACtD;EACF;AACF;AAEA,OAAO,SAASC,yBACdrC,IAA4D;EAE5D,OAAOA,IAAA,YAAgBR,qBAAA;AACzB","ignoreList":[]}
@@ -38,7 +38,16 @@ export type ConvertLexicalToHTMLArgs = {
38
38
  req?: null | undefined;
39
39
  });
40
40
  /**
41
- * @deprecated - will be removed in 4.0
41
+ * @deprecated - will be removed in 4.0. Use the function exported from `@payloadcms/richtext-lexical/html` instead.
42
+ * @example
43
+ * ```ts
44
+ * // old (deprecated)
45
+ * import { convertLexicalToHTML } from '@payloadcms/richtext-lexical'
46
+ * // new (recommended)
47
+ * import { convertLexicalToHTML } from '@payloadcms/richtext-lexical/html'
48
+ * ```
49
+ * For more details, you can refer to https://payloadcms.com/docs/rich-text/converting-html to see all the
50
+ * ways to convert lexical to HTML.
42
51
  */
43
52
  export declare function convertLexicalToHTML({ converters, currentDepth, data, depth, draft, overrideAccess, payload, req, showHiddenFields, }: ConvertLexicalToHTMLArgs): Promise<string>;
44
53
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/converters/lexicalToHtml_deprecated/converter/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA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qBAAqB,EAAE,CAAA;IACrC,cAAc,EAAE,OAAO,CAAA;IACvB,MAAM,EAAE,+BAA+B,CAAA;IACvC;;OAEG;IACH,GAAG,EAAE,IAAI,GAAG,cAAc,CAAA;IAC1B,gBAAgB,EAAE,OAAO,CAAA;CAC1B,GAAG,OAAO,CAAC,MAAM,CAAC,CA8ClB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/converters/lexicalToHtml_deprecated/converter/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAC3E,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAItD,OAAO,KAAK,EAAE,aAAa,EAAE,+BAA+B,EAAE,MAAM,YAAY,CAAA;AAIhF;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC,UAAU,EAAE,aAAa,EAAE,CAAA;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,IAAI,EAAE,qBAAqB,CAAA;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAC3B,GAAG,CACA;IACE;;OAEG;IACH,OAAO,CAAC,EAAE,KAAK,CAAA;IACf;;;;;OAKG;IACH,GAAG,EAAE,cAAc,CAAA;CACpB,GACD;IACE;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;;;;OAKG;IACH,GAAG,CAAC,EAAE,IAAI,GAAG,SAAS,CAAA;CACvB,CACJ,CAAA;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,oBAAoB,CAAC,EACzC,UAAU,EACV,YAAY,EACZ,IAAI,EACJ,KAAK,EACL,KAAK,EACL,cAAc,EACd,OAAO,EACP,GAAG,EACH,gBAAgB,GACjB,EAAE,wBAAwB,GAAG,OAAO,CAAC,MAAM,CAAC,CA2B5C;AAED;;GAEG;AACH,wBAAsB,yBAAyB,CAAC,EAC9C,UAAU,EACV,YAAY,EACZ,KAAK,EACL,KAAK,EACL,YAAY,EACZ,cAAc,EACd,MAAM,EACN,GAAG,EACH,gBAAgB,GACjB,EAAE;IACD,UAAU,EAAE,aAAa,EAAE,CAAA;IAC3B,YAAY,EAAE,MAAM,CAAA;IACpB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,OAAO,CAAA;IACd,YAAY,EAAE,qBAAqB,EAAE,CAAA;IACrC,cAAc,EAAE,OAAO,CAAA;IACvB,MAAM,EAAE,+BAA+B,CAAA;IACvC;;OAEG;IACH,GAAG,EAAE,IAAI,GAAG,cAAc,CAAA;IAC1B,gBAAgB,EAAE,OAAO,CAAA;CAC1B,GAAG,OAAO,CAAC,MAAM,CAAC,CA8ClB"}
@@ -1,7 +1,16 @@
1
1
  import { createLocalReq } from 'payload';
2
2
  import { hasText } from '../../../../validate/hasText.js';
3
3
  /**
4
- * @deprecated - will be removed in 4.0
4
+ * @deprecated - will be removed in 4.0. Use the function exported from `@payloadcms/richtext-lexical/html` instead.
5
+ * @example
6
+ * ```ts
7
+ * // old (deprecated)
8
+ * import { convertLexicalToHTML } from '@payloadcms/richtext-lexical'
9
+ * // new (recommended)
10
+ * import { convertLexicalToHTML } from '@payloadcms/richtext-lexical/html'
11
+ * ```
12
+ * For more details, you can refer to https://payloadcms.com/docs/rich-text/converting-html to see all the
13
+ * ways to convert lexical to HTML.
5
14
  */
6
15
  export async function convertLexicalToHTML({
7
16
  converters,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["createLocalReq","hasText","convertLexicalToHTML","converters","currentDepth","data","depth","draft","overrideAccess","payload","req","showHiddenFields","undefined","config","defaultDepth","convertLexicalNodesToHTML","lexicalNodes","root","children","parent","unknownConverter","find","converter","nodeTypes","includes","htmlArray","Promise","all","map","node","i","converterForNode","type","childIndex","error","console","join"],"sources":["../../../../../src/features/converters/lexicalToHtml_deprecated/converter/index.ts"],"sourcesContent":["import type { SerializedEditorState, SerializedLexicalNode } from 'lexical'\nimport type { Payload, PayloadRequest } from 'payload'\n\nimport { createLocalReq } from 'payload'\n\nimport type { HTMLConverter, SerializedLexicalNodeWithParent } from './types.js'\n\nimport { hasText } from '../../../../validate/hasText.js'\n\n/**\n * @deprecated - will be removed in 4.0\n */\nexport type ConvertLexicalToHTMLArgs = {\n converters: HTMLConverter[]\n currentDepth?: number\n data: SerializedEditorState\n depth?: number\n draft?: boolean // default false\n overrideAccess?: boolean // default false\n showHiddenFields?: boolean // default false\n} & (\n | {\n /**\n * This payload property will only be used if req is undefined.\n */\n payload?: never\n /**\n * When the converter is called, req CAN be passed in depending on where it's run.\n * If this is undefined and config is passed through, lexical will create a new req object for you. If this is null or\n * config is undefined, lexical will not create a new req object for you and local API / server-side-only\n * functionality will be disabled.\n */\n req: PayloadRequest\n }\n | {\n /**\n * This payload property will only be used if req is undefined.\n */\n payload?: Payload\n /**\n * When the converter is called, req CAN be passed in depending on where it's run.\n * If this is undefined and config is passed through, lexical will create a new req object for you. If this is null or\n * config is undefined, lexical will not create a new req object for you and local API / server-side-only\n * functionality will be disabled.\n */\n req?: null | undefined\n }\n)\n\n/**\n * @deprecated - will be removed in 4.0\n */\nexport async function convertLexicalToHTML({\n converters,\n currentDepth,\n data,\n depth,\n draft,\n overrideAccess,\n payload,\n req,\n showHiddenFields,\n}: ConvertLexicalToHTMLArgs): Promise<string> {\n if (hasText(data)) {\n if (req === undefined && payload) {\n req = await createLocalReq({}, payload)\n }\n\n if (!currentDepth) {\n currentDepth = 0\n }\n\n if (!depth) {\n depth = req?.payload?.config?.defaultDepth\n }\n\n return await convertLexicalNodesToHTML({\n converters,\n currentDepth,\n depth: depth!,\n draft: draft === undefined ? false : draft,\n lexicalNodes: data?.root?.children,\n overrideAccess: overrideAccess === undefined ? false : overrideAccess,\n parent: data?.root,\n req: req!,\n showHiddenFields: showHiddenFields === undefined ? false : showHiddenFields,\n })\n }\n return ''\n}\n\n/**\n * @deprecated - will be removed in 4.0\n */\nexport async function convertLexicalNodesToHTML({\n converters,\n currentDepth,\n depth,\n draft,\n lexicalNodes,\n overrideAccess,\n parent,\n req,\n showHiddenFields,\n}: {\n converters: HTMLConverter[]\n currentDepth: number\n depth: number\n draft: boolean\n lexicalNodes: SerializedLexicalNode[]\n overrideAccess: boolean\n parent: SerializedLexicalNodeWithParent\n /**\n * When the converter is called, req CAN be passed in depending on where it's run.\n */\n req: null | PayloadRequest\n showHiddenFields: boolean\n}): Promise<string> {\n const unknownConverter = converters.find((converter) => converter.nodeTypes.includes('unknown'))\n\n const htmlArray = await Promise.all(\n lexicalNodes.map(async (node, i) => {\n const converterForNode = converters.find((converter) =>\n converter.nodeTypes.includes(node.type),\n )\n try {\n if (!converterForNode) {\n if (unknownConverter) {\n return await unknownConverter.converter({\n childIndex: i,\n converters,\n currentDepth,\n depth,\n draft,\n node,\n overrideAccess,\n parent,\n req,\n showHiddenFields,\n })\n }\n return '<span>unknown node</span>'\n }\n return await converterForNode.converter({\n childIndex: i,\n converters,\n currentDepth,\n depth,\n draft,\n node,\n overrideAccess,\n parent,\n req,\n showHiddenFields,\n })\n } catch (error) {\n console.error('Error converting lexical node to HTML:', error, 'node:', node)\n return ''\n }\n }),\n )\n\n return htmlArray.join('') || ''\n}\n"],"mappings":"AAGA,SAASA,cAAc,QAAQ;AAI/B,SAASC,OAAO,QAAQ;AA0CxB;;;AAGA,OAAO,eAAeC,qBAAqB;EACzCC,UAAU;EACVC,YAAY;EACZC,IAAI;EACJC,KAAK;EACLC,KAAK;EACLC,cAAc;EACdC,OAAO;EACPC,GAAG;EACHC;AAAgB,CACS;EACzB,IAAIV,OAAA,CAAQI,IAAA,GAAO;IACjB,IAAIK,GAAA,KAAQE,SAAA,IAAaH,OAAA,EAAS;MAChCC,GAAA,GAAM,MAAMV,cAAA,CAAe,CAAC,GAAGS,OAAA;IACjC;IAEA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AA;YACAE,KAAA;YACAC,KAAA;YACAsB,IAAA;YACArB,cAAA;YACAW,MAAA;YACAT,GAAA;YACAC;UACF;QACF;QACA,OAAO;MACT;MACA,OAAO,MAAMoB,gBAAA,CAAiBT,SAAS,CAAC;QACtCW,UAAA,EAAYH,CAAA;QACZ3B,UAAA;QACAC,YAAA;QACAE,KAAA;QACAC,KAAA;QACAsB,IAAA;QACArB,cAAA;QACAW,MAAA;QACAT,GAAA;QACAC;MACF;IACF,EAAE,OAAOuB,KAAA,EAAO;MACdC,OAAA,CAAQD,KAAK,CAAC,0CAA0CA,KAAA,EAAO,SAASL,IAAA;MACxE,OAAO;IACT;EACF;EAGF,OAAOJ,SAAA,CAAUW,IAAI,CAAC,OAAO;AAC/B","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["createLocalReq","hasText","convertLexicalToHTML","converters","currentDepth","data","depth","draft","overrideAccess","payload","req","showHiddenFields","undefined","config","defaultDepth","convertLexicalNodesToHTML","lexicalNodes","root","children","parent","unknownConverter","find","converter","nodeTypes","includes","htmlArray","Promise","all","map","node","i","converterForNode","type","childIndex","error","console","join"],"sources":["../../../../../src/features/converters/lexicalToHtml_deprecated/converter/index.ts"],"sourcesContent":["import type { SerializedEditorState, SerializedLexicalNode } from 'lexical'\nimport type { Payload, PayloadRequest } from 'payload'\n\nimport { createLocalReq } from 'payload'\n\nimport type { HTMLConverter, SerializedLexicalNodeWithParent } from './types.js'\n\nimport { hasText } from '../../../../validate/hasText.js'\n\n/**\n * @deprecated - will be removed in 4.0\n */\nexport type ConvertLexicalToHTMLArgs = {\n converters: HTMLConverter[]\n currentDepth?: number\n data: SerializedEditorState\n depth?: number\n draft?: boolean // default false\n overrideAccess?: boolean // default false\n showHiddenFields?: boolean // default false\n} & (\n | {\n /**\n * This payload property will only be used if req is undefined.\n */\n payload?: never\n /**\n * When the converter is called, req CAN be passed in depending on where it's run.\n * If this is undefined and config is passed through, lexical will create a new req object for you. If this is null or\n * config is undefined, lexical will not create a new req object for you and local API / server-side-only\n * functionality will be disabled.\n */\n req: PayloadRequest\n }\n | {\n /**\n * This payload property will only be used if req is undefined.\n */\n payload?: Payload\n /**\n * When the converter is called, req CAN be passed in depending on where it's run.\n * If this is undefined and config is passed through, lexical will create a new req object for you. If this is null or\n * config is undefined, lexical will not create a new req object for you and local API / server-side-only\n * functionality will be disabled.\n */\n req?: null | undefined\n }\n)\n\n/**\n * @deprecated - will be removed in 4.0. Use the function exported from `@payloadcms/richtext-lexical/html` instead.\n * @example\n * ```ts\n * // old (deprecated)\n * import { convertLexicalToHTML } from '@payloadcms/richtext-lexical'\n * // new (recommended)\n * import { convertLexicalToHTML } from '@payloadcms/richtext-lexical/html'\n * ```\n * For more details, you can refer to https://payloadcms.com/docs/rich-text/converting-html to see all the\n * ways to convert lexical to HTML.\n */\nexport async function convertLexicalToHTML({\n converters,\n currentDepth,\n data,\n depth,\n draft,\n overrideAccess,\n payload,\n req,\n showHiddenFields,\n}: ConvertLexicalToHTMLArgs): Promise<string> {\n if (hasText(data)) {\n if (req === undefined && payload) {\n req = await createLocalReq({}, payload)\n }\n\n if (!currentDepth) {\n currentDepth = 0\n }\n\n if (!depth) {\n depth = req?.payload?.config?.defaultDepth\n }\n\n return await convertLexicalNodesToHTML({\n converters,\n currentDepth,\n depth: depth!,\n draft: draft === undefined ? false : draft,\n lexicalNodes: data?.root?.children,\n overrideAccess: overrideAccess === undefined ? false : overrideAccess,\n parent: data?.root,\n req: req!,\n showHiddenFields: showHiddenFields === undefined ? false : showHiddenFields,\n })\n }\n return ''\n}\n\n/**\n * @deprecated - will be removed in 4.0\n */\nexport async function convertLexicalNodesToHTML({\n converters,\n currentDepth,\n depth,\n draft,\n lexicalNodes,\n overrideAccess,\n parent,\n req,\n showHiddenFields,\n}: {\n converters: HTMLConverter[]\n currentDepth: number\n depth: number\n draft: boolean\n lexicalNodes: SerializedLexicalNode[]\n overrideAccess: boolean\n parent: SerializedLexicalNodeWithParent\n /**\n * When the converter is called, req CAN be passed in depending on where it's run.\n */\n req: null | PayloadRequest\n showHiddenFields: boolean\n}): Promise<string> {\n const unknownConverter = converters.find((converter) => converter.nodeTypes.includes('unknown'))\n\n const htmlArray = await Promise.all(\n lexicalNodes.map(async (node, i) => {\n const converterForNode = converters.find((converter) =>\n converter.nodeTypes.includes(node.type),\n )\n try {\n if (!converterForNode) {\n if (unknownConverter) {\n return await unknownConverter.converter({\n childIndex: i,\n converters,\n currentDepth,\n depth,\n draft,\n node,\n overrideAccess,\n parent,\n req,\n showHiddenFields,\n })\n }\n return '<span>unknown node</span>'\n }\n return await converterForNode.converter({\n childIndex: i,\n converters,\n currentDepth,\n depth,\n draft,\n node,\n overrideAccess,\n parent,\n req,\n showHiddenFields,\n })\n } catch (error) {\n console.error('Error converting lexical node to HTML:', error, 'node:', node)\n return ''\n }\n }),\n )\n\n return htmlArray.join('') || ''\n}\n"],"mappings":"AAGA,SAASA,cAAc,QAAQ;AAI/B,SAASC,OAAO,QAAQ;AA0CxB;;;;;;;;;;;;AAYA,OAAO,eAAeC,qBAAqB;EACzCC,UAAU;EACVC,YAAY;EACZC,IAAI;EACJC,KAAK;EACLC,KAAK;EACLC,cAAc;EACdC,OAAO;EACPC,GAAG;EACHC;AAAgB,CACS;EACzB,IAAIV,OAAA,CAAQI,IAAA,GAAO;IACjB,IAAIK,GAAA,KAAQE,SAAA,IAAaH,OAAA,EAAS;MAChCC,GAAA,GAAM,MAAMV,cAAA,CAAe,CAAC,GAAGS,OAAA;IACjC;IAEA,IAAI,CAACL,YAAA,EAAc;MACjBA,YAAA,GAAe;IACjB;IAEA,IAAI,CAACE,KAAA,EAAO;MACVA,KAAA,GAAQI,GAAA,EAAKD,OAAA,EAASI,MAAA,EAAQC,YAAA;IAChC;IAEA,OAAO,MAAMC,yBAAA,CAA0B;MACrCZ,UAAA;MACAC,YAAA;MACAE,KAAA,EAAOA,KAAA;MACPC,KAAA,EAAOA,KAAA,KAAUK,SAAA,GAAY,QAAQL,KAAA;MACrCS,YAAA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AOuB,KAAA,EAAO;MACdC,OAAA,CAAQD,KAAK,CAAC,0CAA0CA,KAAA,EAAO,SAASL,IAAA;MACxE,OAAO;IACT;EACF;EAGF,OAAOJ,SAAA,CAAUW,IAAI,CAAC,OAAO;AAC/B","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/converters/lexicalToHtml_deprecated/field/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAiB,MAAM,SAAS,CAAA;AAEnD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAA;AAEtF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAM1D,KAAK,IAAI,GAAG;IACV;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,sBAEnC;IACD,YAAY,EAAE,2BAA2B,CAAA;CAC1C,KAAG,aAAa,EA+ChB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE;AACxB;;;;IAII;AACJ,gBAAgB,EAAE,MAAM,EACxB,IAAI,EAAE,IAAI,KACP,KAwFJ,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/converters/lexicalToHtml_deprecated/field/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAEpC,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAA;AAEtF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAM1D,KAAK,IAAI,GAAG;IACV;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,sBAEnC;IACD,YAAY,EAAE,2BAA2B,CAAA;CAC1C,KAAG,aAAa,EA+ChB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE;AACxB;;;;IAII;AACJ,gBAAgB,EAAE,MAAM,EACxB,IAAI,EAAE,IAAI,KACP,KAuFJ,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["defaultHTMLConverters","convertLexicalToHTML","consolidateHTMLConverters","editorConfig","htmlConverterFeature","resolvedFeatureMap","get","htmlConverterFeatureProps","sanitizedServerFeatureProps","defaultConvertersWithConvertersFromFeatures","converter","features","converters","html","push","finalConverters","defaultConverters","foundNodeTypes","filteredConverters","reverse","nodeTypes","length","newConverter","filter","nodeType","includes","lexicalHTML","lexicalFieldName","args","name","hidden","storeInDB","type","admin","editorOptions","language","hooks","afterRead","currentDepth","depth","draft","field","overrideAccess","req","showHiddenFields","siblingData","siblingFields","Error","lexicalField","find","lexicalFieldData","config","editor","has","data","beforeChange","value"],"sources":["../../../../../src/features/converters/lexicalToHtml_deprecated/field/index.ts"],"sourcesContent":["import type { SerializedEditorState } from 'lexical'\nimport type { Field, RichTextField } from 'payload'\n\nimport type { SanitizedServerEditorConfig } from '../../../../lexical/config/types.js'\nimport type { AdapterProps, LexicalRichTextAdapter } from '../../../../types.js'\nimport type { HTMLConverter } from '../converter/types.js'\nimport type { HTMLConverterFeatureProps } from '../index.js'\n\nimport { defaultHTMLConverters } from '../converter/defaultConverters.js'\nimport { convertLexicalToHTML } from '../converter/index.js'\n\ntype Args = {\n /**\n * Whether the lexicalHTML field should be hidden in the admin panel\n *\n * @default true\n */\n hidden?: boolean\n name: string\n /**\n * Whether the HTML should be stored in the database\n *\n * @default false\n */\n storeInDB?: boolean\n}\n\n/**\n * Combines the default HTML converters with HTML converters found in the features, and with HTML converters configured in the htmlConverter feature.\n *\n * @deprecated - will be removed in 4.0\n * @param editorConfig\n */\nexport const consolidateHTMLConverters = ({\n editorConfig,\n}: {\n editorConfig: SanitizedServerEditorConfig\n}): HTMLConverter[] => {\n const htmlConverterFeature = editorConfig.resolvedFeatureMap.get('htmlConverter')\n const htmlConverterFeatureProps: HTMLConverterFeatureProps =\n htmlConverterFeature?.sanitizedServerFeatureProps\n\n const defaultConvertersWithConvertersFromFeatures = [...defaultHTMLConverters]\n\n for (const converter of editorConfig.features.converters.html) {\n defaultConvertersWithConvertersFromFeatures.push(converter)\n }\n\n const finalConverters =\n htmlConverterFeatureProps?.converters &&\n typeof htmlConverterFeatureProps?.converters === 'function'\n ? htmlConverterFeatureProps.converters({\n defaultConverters: defaultConvertersWithConvertersFromFeatures,\n })\n : (htmlConverterFeatureProps?.converters as HTMLConverter[]) ||\n defaultConvertersWithConvertersFromFeatures\n\n // filter converters by nodeTypes. The last converter in the list wins. If there are multiple converters for the same nodeType, the last one will be used and the node types will be removed from\n // previous converters. If previous converters do not have any nodeTypes left, they will be removed from the list.\n // This guarantees that user-added converters which are added after the default ones will always have precedence\n const foundNodeTypes: string[] = []\n const filteredConverters: HTMLConverter[] = []\n for (const converter of finalConverters.reverse()) {\n if (!converter.nodeTypes?.length) {\n continue\n }\n const newConverter: HTMLConverter = {\n converter: converter.converter,\n nodeTypes: [...converter.nodeTypes],\n }\n newConverter.nodeTypes = newConverter.nodeTypes.filter((nodeType) => {\n if (foundNodeTypes.includes(nodeType)) {\n return false\n }\n foundNodeTypes.push(nodeType)\n return true\n })\n\n if (newConverter.nodeTypes.length) {\n filteredConverters.push(newConverter)\n }\n }\n\n return filteredConverters\n}\n\n/**\n * @deprecated - will be removed in 4.0\n */\nexport const lexicalHTML: (\n /**\n * A string which matches the lexical field name you want to convert to HTML.\n *\n * This has to be a sibling field of this lexicalHTML field - otherwise, it won't be able to find the lexical field.\n **/\n lexicalFieldName: string,\n args: Args,\n) => Field = (lexicalFieldName, args) => {\n const { name = 'lexicalHTML', hidden = true, storeInDB = false } = args\n return {\n name,\n type: 'code',\n admin: {\n editorOptions: {\n language: 'html',\n },\n hidden,\n },\n hooks: {\n afterRead: [\n async ({\n currentDepth,\n depth,\n draft,\n field,\n overrideAccess,\n req,\n showHiddenFields,\n siblingData,\n siblingFields,\n }) => {\n if (!siblingFields) {\n throw new Error(\n `Could not find sibling fields of current lexicalHTML field with name ${field?.name}`,\n )\n }\n\n const lexicalField: RichTextField<SerializedEditorState, AdapterProps> =\n siblingFields.find(\n (field) => 'name' in field && field.name === lexicalFieldName,\n ) as RichTextField<SerializedEditorState, AdapterProps>\n\n const lexicalFieldData: SerializedEditorState = siblingData[lexicalFieldName]\n\n if (!lexicalFieldData) {\n return ''\n }\n\n if (!lexicalField) {\n throw new Error(\n 'You cannot use the lexicalHTML field because the referenced lexical field was not found',\n )\n }\n\n const config = (lexicalField?.editor as LexicalRichTextAdapter)?.editorConfig\n\n if (!config) {\n throw new Error(\n 'The linked lexical field does not have an editorConfig. This is needed for the lexicalHTML field.',\n )\n }\n\n if (!config?.resolvedFeatureMap?.has('htmlConverter')) {\n throw new Error(\n 'You cannot use the lexicalHTML field because the linked lexical field does not have a HTMLConverterFeature',\n )\n }\n\n const finalConverters = consolidateHTMLConverters({\n editorConfig: config,\n })\n\n return await convertLexicalToHTML({\n converters: finalConverters,\n currentDepth,\n data: lexicalFieldData,\n depth,\n draft,\n overrideAccess,\n req,\n showHiddenFields,\n })\n },\n ],\n beforeChange: [\n ({ siblingData, value }) => {\n if (storeInDB) {\n return value\n }\n delete siblingData[name]\n return null\n },\n ],\n },\n }\n}\n"],"mappings":"AAQA,SAASA,qBAAqB,QAAQ;AACtC,SAASC,oBAAoB,QAAQ;AAkBrC;;;;;;AAMA,OAAO,MAAMC,yBAAA,GAA4BA,CAAC;EACxCC;AAAY,CAGb;EACC,MAAMC,oBAAA,GAAuBD,YAAA,CAAaE,kBAAkB,CAACC,GAAG,CAAC;EACjE,MAAMC,yBAAA,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;MAAK,CAAE;QACrB,IAAIzB,SAAA,EAAW;UACb,OAAOyB,KAAA;QACT;QACA,OAAOX,WAAW,CAAChB,IAAA,CAAK;QACxB,OAAO;MACT;IAEJ;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["defaultHTMLConverters","convertLexicalToHTML","consolidateHTMLConverters","editorConfig","htmlConverterFeature","resolvedFeatureMap","get","htmlConverterFeatureProps","sanitizedServerFeatureProps","defaultConvertersWithConvertersFromFeatures","converter","features","converters","html","push","finalConverters","defaultConverters","foundNodeTypes","filteredConverters","reverse","nodeTypes","length","newConverter","filter","nodeType","includes","lexicalHTML","lexicalFieldName","args","name","hidden","storeInDB","type","admin","editorOptions","language","hooks","afterRead","currentDepth","depth","draft","field","overrideAccess","req","showHiddenFields","siblingData","siblingFields","Error","lexicalField","find","lexicalFieldData","config","editor","has","data","beforeChange","value"],"sources":["../../../../../src/features/converters/lexicalToHtml_deprecated/field/index.ts"],"sourcesContent":["import type { SerializedEditorState } from 'lexical'\nimport type { Field } from 'payload'\n\nimport type { SanitizedServerEditorConfig } from '../../../../lexical/config/types.js'\nimport type { LexicalRichTextAdapter, LexicalRichTextField } from '../../../../types.js'\nimport type { HTMLConverter } from '../converter/types.js'\nimport type { HTMLConverterFeatureProps } from '../index.js'\n\nimport { defaultHTMLConverters } from '../converter/defaultConverters.js'\nimport { convertLexicalToHTML } from '../converter/index.js'\n\ntype Args = {\n /**\n * Whether the lexicalHTML field should be hidden in the admin panel\n *\n * @default true\n */\n hidden?: boolean\n name: string\n /**\n * Whether the HTML should be stored in the database\n *\n * @default false\n */\n storeInDB?: boolean\n}\n\n/**\n * Combines the default HTML converters with HTML converters found in the features, and with HTML converters configured in the htmlConverter feature.\n *\n * @deprecated - will be removed in 4.0\n * @param editorConfig\n */\nexport const consolidateHTMLConverters = ({\n editorConfig,\n}: {\n editorConfig: SanitizedServerEditorConfig\n}): HTMLConverter[] => {\n const htmlConverterFeature = editorConfig.resolvedFeatureMap.get('htmlConverter')\n const htmlConverterFeatureProps: HTMLConverterFeatureProps =\n htmlConverterFeature?.sanitizedServerFeatureProps\n\n const defaultConvertersWithConvertersFromFeatures = [...defaultHTMLConverters]\n\n for (const converter of editorConfig.features.converters.html) {\n defaultConvertersWithConvertersFromFeatures.push(converter)\n }\n\n const finalConverters =\n htmlConverterFeatureProps?.converters &&\n typeof htmlConverterFeatureProps?.converters === 'function'\n ? htmlConverterFeatureProps.converters({\n defaultConverters: defaultConvertersWithConvertersFromFeatures,\n })\n : (htmlConverterFeatureProps?.converters as HTMLConverter[]) ||\n defaultConvertersWithConvertersFromFeatures\n\n // filter converters by nodeTypes. The last converter in the list wins. If there are multiple converters for the same nodeType, the last one will be used and the node types will be removed from\n // previous converters. If previous converters do not have any nodeTypes left, they will be removed from the list.\n // This guarantees that user-added converters which are added after the default ones will always have precedence\n const foundNodeTypes: string[] = []\n const filteredConverters: HTMLConverter[] = []\n for (const converter of finalConverters.reverse()) {\n if (!converter.nodeTypes?.length) {\n continue\n }\n const newConverter: HTMLConverter = {\n converter: converter.converter,\n nodeTypes: [...converter.nodeTypes],\n }\n newConverter.nodeTypes = newConverter.nodeTypes.filter((nodeType) => {\n if (foundNodeTypes.includes(nodeType)) {\n return false\n }\n foundNodeTypes.push(nodeType)\n return true\n })\n\n if (newConverter.nodeTypes.length) {\n filteredConverters.push(newConverter)\n }\n }\n\n return filteredConverters\n}\n\n/**\n * @deprecated - will be removed in 4.0\n */\nexport const lexicalHTML: (\n /**\n * A string which matches the lexical field name you want to convert to HTML.\n *\n * This has to be a sibling field of this lexicalHTML field - otherwise, it won't be able to find the lexical field.\n **/\n lexicalFieldName: string,\n args: Args,\n) => Field = (lexicalFieldName, args) => {\n const { name = 'lexicalHTML', hidden = true, storeInDB = false } = args\n return {\n name,\n type: 'code',\n admin: {\n editorOptions: {\n language: 'html',\n },\n hidden,\n },\n hooks: {\n afterRead: [\n async ({\n currentDepth,\n depth,\n draft,\n field,\n overrideAccess,\n req,\n showHiddenFields,\n siblingData,\n siblingFields,\n }) => {\n if (!siblingFields) {\n throw new Error(\n `Could not find sibling fields of current lexicalHTML field with name ${field?.name}`,\n )\n }\n\n const lexicalField: LexicalRichTextField = siblingFields.find(\n (field) => 'name' in field && field.name === lexicalFieldName,\n ) as LexicalRichTextField\n\n const lexicalFieldData: SerializedEditorState = siblingData[lexicalFieldName]\n\n if (!lexicalFieldData) {\n return ''\n }\n\n if (!lexicalField) {\n throw new Error(\n 'You cannot use the lexicalHTML field because the referenced lexical field was not found',\n )\n }\n\n const config = (lexicalField?.editor as LexicalRichTextAdapter)?.editorConfig\n\n if (!config) {\n throw new Error(\n 'The linked lexical field does not have an editorConfig. This is needed for the lexicalHTML field.',\n )\n }\n\n if (!config?.resolvedFeatureMap?.has('htmlConverter')) {\n throw new Error(\n 'You cannot use the lexicalHTML field because the linked lexical field does not have a HTMLConverterFeature',\n )\n }\n\n const finalConverters = consolidateHTMLConverters({\n editorConfig: config,\n })\n\n return await convertLexicalToHTML({\n converters: finalConverters,\n currentDepth,\n data: lexicalFieldData,\n depth,\n draft,\n overrideAccess,\n req,\n showHiddenFields,\n })\n },\n ],\n beforeChange: [\n ({ siblingData, value }) => {\n if (storeInDB) {\n return value\n }\n delete siblingData[name]\n return null\n },\n ],\n },\n }\n}\n"],"mappings":"AAQA,SAASA,qBAAqB,QAAQ;AACtC,SAASC,oBAAoB,QAAQ;AAkBrC;;;;;;AAMA,OAAO,MAAMC,yBAAA,GAA4BA,CAAC;EACxCC;AAAY,CAGb;EACC,MAAMC,oBAAA,GAAuBD,YAAA,CAAaE,kBAAkB,CAACC,GAAG,CAAC;EACjE,MAAMC,yBAAA,GACJH,oBAAA,EAAsBI,2BAAA;EAExB,MAAMC,2CAAA,GAA8C,C,GAAIT,qBAAA,CAAsB;EAE9E,KAAK,MAAMU,SAAA,IAAaP,YAAA,CAAaQ,QAAQ,CAACC,UAAU,CAACC,IAAI,EAAE;IAC7DJ,2CAAA,CAA4CK,IAAI,CAACJ,S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LConverter<any>[]) | HTMLConverter<any>[];
6
6
  };
7
7
  /**
8
- * @deprecated - will be removed in 4.0
8
+ * @deprecated - will be removed in 4.0. Please refer to https://payloadcms.com/docs/rich-text/converting-html
9
+ * to see all the ways to convert lexical to HTML.
9
10
  */
10
11
  export declare const HTMLConverterFeature: import("../../typesServer.js").FeatureProviderProviderServer<HTMLConverterFeatureProps, HTMLConverterFeatureProps, undefined>;
11
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/converters/lexicalToHtml_deprecated/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAIzD,MAAM,MAAM,yBAAyB,GAAG;IACtC,UAAU,CAAC,EACP,CAAC,CAAC,EAAE,iBAAiB,EAAE,EAAE;QAAE,iBAAiB,EAAE,aAAa,CAAC,GAAG,CAAC,EAAE,CAAA;KAAE,KAAK,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC,GAC9F,aAAa,CAAC,GAAG,CAAC,EAAE,CAAA;CACzB,CAAA;AAGD;;GAEG;AACH,eAAO,MAAM,oBAAoB,+HAG/B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/converters/lexicalToHtml_deprecated/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAIzD,MAAM,MAAM,yBAAyB,GAAG;IACtC,UAAU,CAAC,EACP,CAAC,CAAC,EAAE,iBAAiB,EAAE,EAAE;QAAE,iBAAiB,EAAE,aAAa,CAAC,GAAG,CAAC,EAAE,CAAA;KAAE,KAAK,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC,GAC9F,aAAa,CAAC,GAAG,CAAC,EAAE,CAAA;CACzB,CAAA;AAGD;;;GAGG;AACH,eAAO,MAAM,oBAAoB,+HAG/B,CAAA"}
@@ -1,7 +1,8 @@
1
1
  import { createServerFeature } from '../../../utilities/createServerFeature.js';
2
2
  // This is just used to save the props on the richText field
3
3
  /**
4
- * @deprecated - will be removed in 4.0
4
+ * @deprecated - will be removed in 4.0. Please refer to https://payloadcms.com/docs/rich-text/converting-html
5
+ * to see all the ways to convert lexical to HTML.
5
6
  */
6
7
  export const HTMLConverterFeature = createServerFeature({
7
8
  feature: {},
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["createServerFeature","HTMLConverterFeature","feature","key"],"sources":["../../../../src/features/converters/lexicalToHtml_deprecated/index.ts"],"sourcesContent":["import type { HTMLConverter } from './converter/types.js'\n\nimport { createServerFeature } from '../../../utilities/createServerFeature.js'\n\nexport type HTMLConverterFeatureProps = {\n converters?:\n | (({ defaultConverters }: { defaultConverters: HTMLConverter<any>[] }) => HTMLConverter<any>[])\n | HTMLConverter<any>[]\n}\n\n// This is just used to save the props on the richText field\n/**\n * @deprecated - will be removed in 4.0\n */\nexport const HTMLConverterFeature = createServerFeature<HTMLConverterFeatureProps>({\n feature: {},\n key: 'htmlConverter',\n})\n"],"mappings":"AAEA,SAASA,mBAAmB,QAAQ;AAQpC;AACA;;;AAGA,OAAO,MAAMC,oBAAA,GAAuBD,mBAAA,CAA+C;EACjFE,OAAA,EAAS,CAAC;EACVC,GAAA,EAAK;AACP","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["createServerFeature","HTMLConverterFeature","feature","key"],"sources":["../../../../src/features/converters/lexicalToHtml_deprecated/index.ts"],"sourcesContent":["import type { HTMLConverter } from './converter/types.js'\n\nimport { createServerFeature } from '../../../utilities/createServerFeature.js'\n\nexport type HTMLConverterFeatureProps = {\n converters?:\n | (({ defaultConverters }: { defaultConverters: HTMLConverter<any>[] }) => HTMLConverter<any>[])\n | HTMLConverter<any>[]\n}\n\n// This is just used to save the props on the richText field\n/**\n * @deprecated - will be removed in 4.0. Please refer to https://payloadcms.com/docs/rich-text/converting-html\n * to see all the ways to convert lexical to HTML.\n */\nexport const HTMLConverterFeature = createServerFeature<HTMLConverterFeatureProps>({\n feature: {},\n key: 'htmlConverter',\n})\n"],"mappings":"AAEA,SAASA,mBAAmB,QAAQ;AAQpC;AACA;;;;AAIA,OAAO,MAAMC,oBAAA,GAAuBD,mBAAA,CAA+C;EACjFE,OAAA,EAAS,CAAC;EACVC,GAAA,EAAK;AACP","ignoreList":[]}
@@ -1,13 +1,8 @@
1
1
  import type { SerializedTableCellNode as _SerializedTableCellNode, SerializedTableNode as _SerializedTableNode, SerializedTableRowNode as _SerializedTableRowNode } from '@lexical/table';
2
- import type { Spread } from 'lexical';
3
- export type SerializedTableCellNode = Spread<{
4
- type: 'tablecell';
5
- }, _SerializedTableCellNode>;
6
- export type SerializedTableNode = Spread<{
7
- type: 'table';
8
- }, _SerializedTableNode>;
9
- export type SerializedTableRowNode = Spread<{
10
- type: 'tablerow';
11
- }, _SerializedTableRowNode>;
2
+ import type { SerializedLexicalNode } from 'lexical';
3
+ import type { StronglyTypedElementNode } from '../../../nodeTypes.js';
4
+ export type SerializedTableCellNode<T extends SerializedLexicalNode = SerializedLexicalNode> = StronglyTypedElementNode<_SerializedTableCellNode, 'tablecell', T>;
5
+ export type SerializedTableNode<T extends SerializedLexicalNode = SerializedLexicalNode> = StronglyTypedElementNode<_SerializedTableNode, 'table', T>;
6
+ export type SerializedTableRowNode<T extends SerializedLexicalNode = SerializedLexicalNode> = StronglyTypedElementNode<_SerializedTableRowNode, 'tablerow', T>;
12
7
  export declare const EXPERIMENTAL_TableFeature: import("../../typesServer.js").FeatureProviderProviderServer<undefined, undefined, undefined>;
13
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/experimental_table/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,IAAI,wBAAwB,EACnD,mBAAmB,IAAI,oBAAoB,EAC3C,sBAAsB,IAAI,uBAAuB,EAClD,MAAM,gBAAgB,CAAA;AACvB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AA0BrC,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAC1C;IACE,IAAI,EAAE,WAAW,CAAA;CAClB,EACD,wBAAwB,CACzB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG,MAAM,CACtC;IACE,IAAI,EAAE,OAAO,CAAA;CACd,EACD,oBAAoB,CACrB,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG,MAAM,CACzC;IACE,IAAI,EAAE,UAAU,CAAA;CACjB,EACD,uBAAuB,CACxB,CAAA;AACD,eAAO,MAAM,yBAAyB,+FA8IpC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/experimental_table/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,IAAI,wBAAwB,EACnD,mBAAmB,IAAI,oBAAoB,EAC3C,sBAAsB,IAAI,uBAAuB,EAClD,MAAM,gBAAgB,CAAA;AACvB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAMpD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAA;AAsBrE,MAAM,MAAM,uBAAuB,CAAC,CAAC,SAAS,qBAAqB,GAAG,qBAAqB,IACzF,wBAAwB,CAAC,wBAAwB,EAAE,WAAW,EAAE,CAAC,CAAC,CAAA;AAEpE,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,qBAAqB,GAAG,qBAAqB,IACrF,wBAAwB,CAAC,oBAAoB,EAAE,OAAO,EAAE,CAAC,CAAC,CAAA;AAE5D,MAAM,MAAM,sBAAsB,CAAC,CAAC,SAAS,qBAAqB,GAAG,qBAAqB,IACxF,wBAAwB,CAAC,uBAAuB,EAAE,UAAU,EAAE,CAAC,CAAC,CAAA;AAClE,eAAO,MAAM,yBAAyB,+FA8IpC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["TableCellNode","TableNode","TableRowNode","sanitizeFields","createServerFeature","convertLexicalNodesToHTML","createNode","TableMarkdownTransformer","fields","name","type","defaultValue","required","EXPERIMENTAL_TableFeature","feature","config","isRoot","parentIsLocalized","validRelationships","collections","map","c","slug","sanitizedFields","requireFieldLevelRichTextEditor","ClientFeature","generateSchemaMap","schemaMap","Map","set","markdownTransformers","nodes","converters","html","converter","currentDepth","depth","draft","node","overrideAccess","parent","req","showHiddenFields","childrenText","lexicalNodes","children","nodeTypes","getType","tagName","headerState","headerStateClass","backgroundColor","colSpan","rowSpan","key"],"sources":["../../../../src/features/experimental_table/server/index.ts"],"sourcesContent":["import type {\n SerializedTableCellNode as _SerializedTableCellNode,\n SerializedTableNode as _SerializedTableNode,\n SerializedTableRowNode as _SerializedTableRowNode,\n} from '@lexical/table'\nimport type { Spread } from 'lexical'\nimport type { Config, Field, FieldSchemaMap } from 'payload'\n\nimport { TableCellNode, TableNode, TableRowNode } from '@lexical/table'\nimport { sanitizeFields } from 'payload'\n\nimport { createServerFeature } from '../../../utilities/createServerFeature.js'\nimport { convertLexicalNodesToHTML } from '../../converters/lexicalToHtml_deprecated/converter/index.js'\nimport { createNode } from '../../typeUtilities.js'\nimport { TableMarkdownTransformer } from '../markdownTransformer.js'\n\nconst fields: Field[] = [\n {\n name: 'rows',\n type: 'number',\n defaultValue: 5,\n required: true,\n },\n {\n name: 'columns',\n type: 'number',\n defaultValue: 5,\n required: true,\n },\n]\n\nexport type SerializedTableCellNode = Spread<\n {\n type: 'tablecell'\n },\n _SerializedTableCellNode\n>\n\nexport type SerializedTableNode = Spread<\n {\n type: 'table'\n },\n _SerializedTableNode\n>\n\nexport type SerializedTableRowNode = Spread<\n {\n type: 'tablerow'\n },\n _SerializedTableRowNode\n>\nexport const EXPERIMENTAL_TableFeature = createServerFeature({\n feature: async ({ config, isRoot, parentIsLocalized }) => {\n const validRelationships = config.collections.map((c) => c.slug) || []\n\n const sanitizedFields = await sanitizeFields({\n config: config as unknown as Config,\n fields,\n parentIsLocalized,\n requireFieldLevelRichTextEditor: isRoot,\n validRelationships,\n })\n return {\n ClientFeature: '@payloadcms/richtext-lexical/client#TableFeatureClient',\n generateSchemaMap: () => {\n const schemaMap: FieldSchemaMap = new Map()\n\n schemaMap.set('fields', {\n fields: sanitizedFields,\n })\n\n return schemaMap\n },\n markdownTransformers: [TableMarkdownTransformer],\n nodes: [\n createNode({\n converters: {\n html: {\n converter: async ({\n converters,\n currentDepth,\n depth,\n draft,\n node,\n overrideAccess,\n parent,\n req,\n showHiddenFields,\n }) => {\n const childrenText = await convertLexicalNodesToHTML({\n converters,\n currentDepth,\n depth,\n draft,\n lexicalNodes: node.children,\n overrideAccess,\n parent: {\n ...node,\n parent,\n },\n req,\n showHiddenFields,\n })\n return `<div class=\"lexical-table-container\"><table class=\"lexical-table\" style=\"border-collapse: collapse;\">${childrenText}</table></div>`\n },\n nodeTypes: [TableNode.getType()],\n },\n },\n node: TableNode,\n }),\n createNode({\n converters: {\n html: {\n converter: async ({\n converters,\n currentDepth,\n depth,\n draft,\n node,\n overrideAccess,\n parent,\n req,\n showHiddenFields,\n }) => {\n const childrenText = await convertLexicalNodesToHTML({\n converters,\n currentDepth,\n depth,\n draft,\n lexicalNodes: node.children,\n overrideAccess,\n parent: {\n ...node,\n parent,\n },\n req,\n showHiddenFields,\n })\n\n const tagName = node.headerState > 0 ? 'th' : 'td'\n const headerStateClass = `lexical-table-cell-header-${node.headerState}`\n const backgroundColor = node.backgroundColor\n ? `background-color: ${node.backgroundColor};`\n : ''\n const colSpan = node.colSpan && node.colSpan > 1 ? `colspan=\"${node.colSpan}\"` : ''\n const rowSpan = node.rowSpan && node.rowSpan > 1 ? `rowspan=\"${node.rowSpan}\"` : ''\n\n return `<${tagName} class=\"lexical-table-cell ${headerStateClass}\" style=\"border: 1px solid #ccc; padding: 8px; ${backgroundColor}\" ${colSpan} ${rowSpan}>${childrenText}</${tagName}>`\n },\n nodeTypes: [TableCellNode.getType()],\n },\n },\n node: TableCellNode,\n }),\n createNode({\n converters: {\n html: {\n converter: async ({\n converters,\n currentDepth,\n depth,\n draft,\n node,\n overrideAccess,\n parent,\n req,\n showHiddenFields,\n }) => {\n const childrenText = await convertLexicalNodesToHTML({\n converters,\n currentDepth,\n depth,\n draft,\n lexicalNodes: node.children,\n overrideAccess,\n parent: {\n ...node,\n parent,\n },\n req,\n showHiddenFields,\n })\n return `<tr class=\"lexical-table-row\">${childrenText}</tr>`\n },\n nodeTypes: [TableRowNode.getType()],\n },\n },\n node: TableRowNode,\n }),\n ],\n }\n },\n key: 'experimental_table',\n})\n"],"mappings":"AAQA,SAASA,aAAa,EAAEC,SAAS,EAAEC,YAAY,QAAQ;AACvD,SAASC,cAAc,QAAQ;AAE/B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,UAAU,QAAQ;AAC3B,SAASC,wBAAwB,QAAQ;AAEzC,MAAMC,MAAA,GAAkB,CACtB;EACEC,IAAA,EAAM;EACNC,IAAA,EAAM;EACNC,YAAA,EAAc;EACdC,QAAA,EAAU;AACZ,GACA;EACEH,IAAA,EAAM;EACNC,IAAA,EAAM;EACNC,YAAA,EAAc;EACdC,QAAA,EAAU;AACZ,EACD;AAsBD,OAAO,MAAMC,yBAAA,GAA4BT,mBAAA,CAAoB;EAC3DU,OAAA,EAAS,MAAAA,CAAO;IAAEC,MAAM;IAAEC,MAAM;IAAEC;EAAiB,CAAE;IACnD,MAAMC,kBAAA,GAAqBH,MAAA,CAAOI,WAAW,CAACC,GAAG,CAAEC,CAAA,IAAMA,CAAA,CAAEC,IAAI,KAAK,EAAE;IAEtE,MAAMC,eAAA,GAAkB,MAAMpB,cAAA,CAAe;MAC3CY,MAAA,EAAQA,MAAA;MACRP,MAAA;MACAS,iBAAA;MACAO,+BAAA,EAAiCR,MAAA;MACjCE;IACF;IACA,OAAO;MACLO,aAAA,EAAe;MACfC,iBAAA,EAAmBA,CAAA;QACjB,MAAMC,SAAA,GAA4B,I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+ {"version":3,"file":"index.js","names":["TableCellNode","TableNode","TableRowNode","sanitizeFields","createServerFeature","convertLexicalNodesToHTML","createNode","TableMarkdownTransformer","fields","name","type","defaultValue","required","EXPERIMENTAL_TableFeature","feature","config","isRoot","parentIsLocalized","validRelationships","collections","map","c","slug","sanitizedFields","requireFieldLevelRichTextEditor","ClientFeature","generateSchemaMap","schemaMap","Map","set","markdownTransformers","nodes","converters","html","converter","currentDepth","depth","draft","node","overrideAccess","parent","req","showHiddenFields","childrenText","lexicalNodes","children","nodeTypes","getType","tagName","headerState","headerStateClass","backgroundColor","colSpan","rowSpan","key"],"sources":["../../../../src/features/experimental_table/server/index.ts"],"sourcesContent":["import type {\n SerializedTableCellNode as _SerializedTableCellNode,\n SerializedTableNode as _SerializedTableNode,\n SerializedTableRowNode as _SerializedTableRowNode,\n} from '@lexical/table'\nimport type { SerializedLexicalNode } from 'lexical'\nimport type { Config, Field, FieldSchemaMap } from 'payload'\n\nimport { TableCellNode, TableNode, TableRowNode } from '@lexical/table'\nimport { sanitizeFields } from 'payload'\n\nimport type { StronglyTypedElementNode } from '../../../nodeTypes.js'\n\nimport { createServerFeature } from '../../../utilities/createServerFeature.js'\nimport { convertLexicalNodesToHTML } from '../../converters/lexicalToHtml_deprecated/converter/index.js'\nimport { createNode } from '../../typeUtilities.js'\nimport { TableMarkdownTransformer } from '../markdownTransformer.js'\n\nconst fields: Field[] = [\n {\n name: 'rows',\n type: 'number',\n defaultValue: 5,\n required: true,\n },\n {\n name: 'columns',\n type: 'number',\n defaultValue: 5,\n required: true,\n },\n]\n\nexport type SerializedTableCellNode<T extends SerializedLexicalNode = SerializedLexicalNode> =\n StronglyTypedElementNode<_SerializedTableCellNode, 'tablecell', T>\n\nexport type SerializedTableNode<T extends SerializedLexicalNode = SerializedLexicalNode> =\n StronglyTypedElementNode<_SerializedTableNode, 'table', T>\n\nexport type SerializedTableRowNode<T extends SerializedLexicalNode = SerializedLexicalNode> =\n StronglyTypedElementNode<_SerializedTableRowNode, 'tablerow', T>\nexport const EXPERIMENTAL_TableFeature = createServerFeature({\n feature: async ({ config, isRoot, parentIsLocalized }) => {\n const validRelationships = config.collections.map((c) => c.slug) || []\n\n const sanitizedFields = await sanitizeFields({\n config: config as unknown as Config,\n fields,\n parentIsLocalized,\n requireFieldLevelRichTextEditor: isRoot,\n validRelationships,\n })\n return {\n ClientFeature: '@payloadcms/richtext-lexical/client#TableFeatureClient',\n generateSchemaMap: () => {\n const schemaMap: FieldSchemaMap = new Map()\n\n schemaMap.set('fields', {\n fields: sanitizedFields,\n })\n\n return schemaMap\n },\n markdownTransformers: [TableMarkdownTransformer],\n nodes: [\n createNode({\n converters: {\n html: {\n converter: async ({\n converters,\n currentDepth,\n depth,\n draft,\n node,\n overrideAccess,\n parent,\n req,\n showHiddenFields,\n }) => {\n const childrenText = await convertLexicalNodesToHTML({\n converters,\n currentDepth,\n depth,\n draft,\n lexicalNodes: node.children,\n overrideAccess,\n parent: {\n ...node,\n parent,\n },\n req,\n showHiddenFields,\n })\n return `<div class=\"lexical-table-container\"><table class=\"lexical-table\" style=\"border-collapse: collapse;\">${childrenText}</table></div>`\n },\n nodeTypes: [TableNode.getType()],\n },\n },\n node: TableNode,\n }),\n createNode({\n converters: {\n html: {\n converter: async ({\n converters,\n currentDepth,\n depth,\n draft,\n node,\n overrideAccess,\n parent,\n req,\n showHiddenFields,\n }) => {\n const childrenText = await convertLexicalNodesToHTML({\n converters,\n currentDepth,\n depth,\n draft,\n lexicalNodes: node.children,\n overrideAccess,\n parent: {\n ...node,\n parent,\n },\n req,\n showHiddenFields,\n })\n\n const tagName = node.headerState > 0 ? 'th' : 'td'\n const headerStateClass = `lexical-table-cell-header-${node.headerState}`\n const backgroundColor = node.backgroundColor\n ? `background-color: ${node.backgroundColor};`\n : ''\n const colSpan = node.colSpan && node.colSpan > 1 ? `colspan=\"${node.colSpan}\"` : ''\n const rowSpan = node.rowSpan && node.rowSpan > 1 ? `rowspan=\"${node.rowSpan}\"` : ''\n\n return `<${tagName} class=\"lexical-table-cell ${headerStateClass}\" style=\"border: 1px solid #ccc; padding: 8px; ${backgroundColor}\" ${colSpan} ${rowSpan}>${childrenText}</${tagName}>`\n },\n nodeTypes: [TableCellNode.getType()],\n },\n },\n node: TableCellNode,\n }),\n createNode({\n converters: {\n html: {\n converter: async ({\n converters,\n currentDepth,\n depth,\n draft,\n node,\n overrideAccess,\n parent,\n req,\n showHiddenFields,\n }) => {\n const childrenText = await convertLexicalNodesToHTML({\n converters,\n currentDepth,\n depth,\n draft,\n lexicalNodes: node.children,\n overrideAccess,\n parent: {\n ...node,\n parent,\n },\n req,\n showHiddenFields,\n })\n return `<tr class=\"lexical-table-row\">${childrenText}</tr>`\n },\n nodeTypes: [TableRowNode.getType()],\n },\n },\n node: TableRowNode,\n }),\n ],\n }\n },\n key: 'experimental_table',\n})\n"],"mappings":"AAQA,SAASA,aAAa,EAAEC,SAAS,EAAEC,YAAY,QAAQ;AACvD,SAASC,cAAc,QAAQ;AAI/B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,UAAU,QAAQ;AAC3B,SAASC,wBAAwB,QAAQ;AAEzC,MAAMC,MAAA,GAAkB,CACtB;EACEC,IAAA,EAAM;EACNC,IAAA,EAAM;EACNC,YAAA,EAAc;EACdC,QAAA,EAAU;AACZ,GACA;EACEH,IAAA,EAAM;EACNC,IAAA,EAAM;EACNC,YAAA,EAAc;EACdC,QAAA,EAAU;AACZ,EACD;AAUD,OAAO,MAAMC,yBAAA,GAA4BT,mBAAA,CAAoB;EAC3DU,OAAA,EAAS,MAAAA,CAAO;IAAEC,MAAM;IAAEC,MAAM;IAAEC;EAAiB,CAAE;IACnD,MAAMC,kBAAA,GAAqBH,MAAA,CAAOI,WAAW,CAACC,GAAG,CAAEC,CAAA,IAAMA,CAAA,CAAEC,IAAI,KAAK,EAAE;IAEtE,MAAMC,eAAA,GAAkB,MAAMpB,cAAA,CAAe;MAC3CY,MAAA,EAA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iCC,YAAA,OAAmB;YAC7D;YACAG,SAAA,EAAW,CAAC5C,YAAA,CAAa6C,OAAO;UAClC;QACF;QACAT,IAAA,EAAMpC;MACR;IAEJ;EACF;EACAoD,GAAA,EAAK;AACP","ignoreList":[]}
@@ -1,8 +1,7 @@
1
1
  import type { SerializedHeadingNode as _SerializedHeadingNode, HeadingTagType } from '@lexical/rich-text';
2
- import type { Spread } from 'lexical';
3
- export type SerializedHeadingNode = Spread<{
4
- type: 'heading';
5
- }, Omit<_SerializedHeadingNode, 'type'>>;
2
+ import type { SerializedLexicalNode } from 'lexical';
3
+ import type { StronglyTypedElementNode } from '../../../nodeTypes.js';
4
+ export type SerializedHeadingNode<T extends SerializedLexicalNode = SerializedLexicalNode> = StronglyTypedElementNode<_SerializedHeadingNode, 'heading', T>;
6
5
  export type HeadingFeatureProps = {
7
6
  enabledHeadingSizes?: HeadingTagType[];
8
7
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/heading/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,IAAI,sBAAsB,EAC/C,cAAc,EACf,MAAM,oBAAoB,CAAA;AAC3B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAUrC,MAAM,MAAM,qBAAqB,GAAG,MAAM,CACxC;IACE,IAAI,EAAE,SAAS,CAAA;CAChB,EACD,IAAI,CAAC,sBAAsB,EAAE,MAAM,CAAC,CACrC,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,mBAAmB,CAAC,EAAE,cAAc,EAAE,CAAA;CACvC,CAAA;AAED,eAAO,MAAM,cAAc,6HAsEzB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/heading/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,IAAI,sBAAsB,EAC/C,cAAc,EACf,MAAM,oBAAoB,CAAA;AAC3B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAIpD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAA;AAQrE,MAAM,MAAM,qBAAqB,CAAC,CAAC,SAAS,qBAAqB,GAAG,qBAAqB,IACvF,wBAAwB,CAAC,sBAAsB,EAAE,SAAS,EAAE,CAAC,CAAC,CAAA;AAEhE,MAAM,MAAM,mBAAmB,GAAG;IAChC,mBAAmB,CAAC,EAAE,cAAc,EAAE,CAAA;CACvC,CAAA;AAED,eAAO,MAAM,cAAc,6HAsEzB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["HeadingNode","createServerFeature","convertLexicalNodesToHTML","createNode","MarkdownTransformer","i18n","HeadingFeature","feature","props","enabledHeadingSizes","sort","ClientFeature","clientFeatureProps","markdownTransformers","nodes","converters","html","converter","currentDepth","depth","draft","node","overrideAccess","parent","req","showHiddenFields","childrenText","lexicalNodes","children","style","format","indent","filter","Boolean","join","tag","nodeTypes","getType","sanitizedServerFeatureProps","key"],"sources":["../../../../src/features/heading/server/index.ts"],"sourcesContent":["import type {\n SerializedHeadingNode as _SerializedHeadingNode,\n HeadingTagType,\n} from '@lexical/rich-text'\nimport type { Spread } from 'lexical'\n\nimport { HeadingNode } from '@lexical/rich-text'\n\nimport { createServerFeature } from '../../../utilities/createServerFeature.js'\nimport { convertLexicalNodesToHTML } from '../../converters/lexicalToHtml_deprecated/converter/index.js'\nimport { createNode } from '../../typeUtilities.js'\nimport { MarkdownTransformer } from '../markdownTransformer.js'\nimport { i18n } from './i18n.js'\n\nexport type SerializedHeadingNode = Spread<\n {\n type: 'heading'\n },\n Omit<_SerializedHeadingNode, 'type'>\n>\n\nexport type HeadingFeatureProps = {\n enabledHeadingSizes?: HeadingTagType[]\n}\n\nexport const HeadingFeature = createServerFeature<\n HeadingFeatureProps,\n HeadingFeatureProps,\n HeadingFeatureProps\n>({\n feature: ({ props }) => {\n if (!props) {\n props = {}\n }\n\n const { enabledHeadingSizes = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'] } = props\n\n enabledHeadingSizes.sort()\n\n return {\n ClientFeature: '@payloadcms/richtext-lexical/client#HeadingFeatureClient',\n clientFeatureProps: props,\n i18n,\n markdownTransformers: [MarkdownTransformer(enabledHeadingSizes)],\n nodes: [\n createNode({\n converters: {\n html: {\n converter: async ({\n converters,\n currentDepth,\n depth,\n draft,\n node,\n overrideAccess,\n parent,\n req,\n showHiddenFields,\n }) => {\n const childrenText = await convertLexicalNodesToHTML({\n converters,\n currentDepth,\n depth,\n draft,\n lexicalNodes: node.children,\n overrideAccess,\n parent: {\n ...node,\n parent,\n },\n req,\n showHiddenFields,\n })\n const style = [\n node.format ? `text-align: ${node.format};` : '',\n // the unit should be px. Do not change it to rem, em, or something else.\n // The quantity should be 40px. Do not change it either.\n // See rationale in\n // https://github.com/payloadcms/payload/issues/13130#issuecomment-3058348085\n node.indent > 0 ? `padding-inline-start: ${node.indent * 40}px;` : '',\n ]\n .filter(Boolean)\n .join(' ')\n return `<${node?.tag}${style ? ` style='${style}'` : ''}>${childrenText}</${node?.tag}>`\n },\n nodeTypes: [HeadingNode.getType()],\n },\n },\n node: HeadingNode,\n }),\n ],\n sanitizedServerFeatureProps: props,\n }\n },\n key: 'heading',\n})\n"],"mappings":"AAMA,SAASA,WAAW,QAAQ;AAE5B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,UAAU,QAAQ;AAC3B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,IAAI,QAAQ;AAarB,OAAO,MAAMC,cAAA,GAAiBL,mBAAA,CAI5B;EACAM,OAAA,EAASA,CAAC;IAAEC;EAAK,CAAE;IACjB,IAAI,CAACA,KAAA,EAAO;MACVA,KAAA,GAAQ,CAAC;IACX;IAEA,MAAM;MAAEC,mBAAA,GAAsB,CAAC,MAAM,MAAM,MAAM,MAAM,MAAM;IAAK,CAAE,GAAGD,KAAA;IAEvEC,mBAAA,CAAoBC,IAAI;IAExB,OAAO;MACLC,aAAA,EAAe;MACfC,kBAAA,EAAoBJ,KAAA;MACpBH,IAAA;MACAQ,oBAAA,EAAsB,CAACT,mBAAA,CAAoBK,mBAAA,EAAqB;MAChEK,KAAA,EAAO,CACLX,UAAA,CAAW;QACTY,UAAA,EAAY;UACVC,IAAA,EAAM;YACJC,SAAA,EAAW,MAAAA,CAAO;cAChBF,UAAU;cACVG,YAAY;cACZC,KAAK;cACLC,KAAK;cACLC,IAAI;cACJC,cAAc;cACdC,MAAM;cACNC,GAAG;cACHC;YAAgB,CACjB;cACC,MAAMC,YAAA,GAAe,MAAMxB,yBAAA,CAA0B;gBACnDa,UAAA;gBACAG,YAAA;gBACAC,KAAA;gBACAC,KAAA;gBACAO,YAAA,EAAcN,IAAA,CAAKO,QAAQ;gBAC3BN,cAAA;gBACAC,MAAA,EAAQ;kBACN,GAAGF,IAAI;kBACPE;gBACF;gBACAC,GAAA;gBACAC;cACF;cACA,MAAMI,KAAA,GAAQ,CACZR,IAAA,CAAKS,MAAM,GAAG,eAAeT,IAAA,CAAKS,MAAM,GAAG,GAAG;cAC9C;cACA;cACA;cACA;cACAT,IAAA,CAAKU,MAAM,GAAG,IAAI,yBAAyBV,IAAA,CAAKU,MAAM,GAAG,OAAO,GAAG,GACpE,CACEC,MAAM,CAACC,OAAA,EACPC,IAAI,CAAC;cACR,OAAO,IAAIb,IAAA,EAAMc,GAAA,GAAMN,KAAA,GAAQ,WAAWA,KAAA,GAAQ,GAAG,MAAMH,YAAA,KAAiBL,IAAA,EAAMc,GAAA,GAAM;YAC1F;YACAC,SAAA,EAAW,CAACpC,WAAA,CAAYqC,OAAO;UACjC;QACF;QACAhB,IAAA,EAAMrB;MACR,GACD;MACDsC,2BAAA,EAA6B9B;IAC/B;EACF;EACA+B,GAAA,EAAK;AACP","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["HeadingNode","createServerFeature","convertLexicalNodesToHTML","createNode","MarkdownTransformer","i18n","HeadingFeature","feature","props","enabledHeadingSizes","sort","ClientFeature","clientFeatureProps","markdownTransformers","nodes","converters","html","converter","currentDepth","depth","draft","node","overrideAccess","parent","req","showHiddenFields","childrenText","lexicalNodes","children","style","format","indent","filter","Boolean","join","tag","nodeTypes","getType","sanitizedServerFeatureProps","key"],"sources":["../../../../src/features/heading/server/index.ts"],"sourcesContent":["import type {\n SerializedHeadingNode as _SerializedHeadingNode,\n HeadingTagType,\n} from '@lexical/rich-text'\nimport type { SerializedLexicalNode } from 'lexical'\n\nimport { HeadingNode } from '@lexical/rich-text'\n\nimport type { StronglyTypedElementNode } from '../../../nodeTypes.js'\n\nimport { createServerFeature } from '../../../utilities/createServerFeature.js'\nimport { convertLexicalNodesToHTML } from '../../converters/lexicalToHtml_deprecated/converter/index.js'\nimport { createNode } from '../../typeUtilities.js'\nimport { MarkdownTransformer } from '../markdownTransformer.js'\nimport { i18n } from './i18n.js'\n\nexport type SerializedHeadingNode<T extends SerializedLexicalNode = SerializedLexicalNode> =\n StronglyTypedElementNode<_SerializedHeadingNode, 'heading', T>\n\nexport type HeadingFeatureProps = {\n enabledHeadingSizes?: HeadingTagType[]\n}\n\nexport const HeadingFeature = createServerFeature<\n HeadingFeatureProps,\n HeadingFeatureProps,\n HeadingFeatureProps\n>({\n feature: ({ props }) => {\n if (!props) {\n props = {}\n }\n\n const { enabledHeadingSizes = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'] } = props\n\n enabledHeadingSizes.sort()\n\n return {\n ClientFeature: '@payloadcms/richtext-lexical/client#HeadingFeatureClient',\n clientFeatureProps: props,\n i18n,\n markdownTransformers: [MarkdownTransformer(enabledHeadingSizes)],\n nodes: [\n createNode({\n converters: {\n html: {\n converter: async ({\n converters,\n currentDepth,\n depth,\n draft,\n node,\n overrideAccess,\n parent,\n req,\n showHiddenFields,\n }) => {\n const childrenText = await convertLexicalNodesToHTML({\n converters,\n currentDepth,\n depth,\n draft,\n lexicalNodes: node.children,\n overrideAccess,\n parent: {\n ...node,\n parent,\n },\n req,\n showHiddenFields,\n })\n const style = [\n node.format ? `text-align: ${node.format};` : '',\n // the unit should be px. Do not change it to rem, em, or something else.\n // The quantity should be 40px. Do not change it either.\n // See rationale in\n // https://github.com/payloadcms/payload/issues/13130#issuecomment-3058348085\n node.indent > 0 ? `padding-inline-start: ${node.indent * 40}px;` : '',\n ]\n .filter(Boolean)\n .join(' ')\n return `<${node?.tag}${style ? ` style='${style}'` : ''}>${childrenText}</${node?.tag}>`\n },\n nodeTypes: [HeadingNode.getType()],\n },\n },\n node: HeadingNode,\n }),\n ],\n sanitizedServerFeatureProps: props,\n }\n },\n key: 'heading',\n})\n"],"mappings":"AAMA,SAASA,WAAW,QAAQ;AAI5B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,UAAU,QAAQ;AAC3B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,IAAI,QAAQ;AASrB,OAAO,MAAMC,cAAA,GAAiBL,mBAAA,CAI5B;EACAM,OAAA,EAASA,CAAC;IAAEC;EAAK,CAAE;IACjB,IAAI,CAACA,KAAA,EAAO;MACVA,KAAA,GAAQ,CAAC;IACX;IAEA,MAAM;MAAEC,mBAAA,GAAsB,CAAC,MAAM,MAAM,MAAM,MAAM,MAAM;IAAK,CAAE,GAAGD,KAAA;IAEvEC,mBAAA,CAAoBC,IAAI;IAExB,OAAO;MACLC,aAAA,EAAe;MACfC,kBAAA,EAAoBJ,KAAA;MACpBH,IAAA;MACAQ,oBAAA,EAAsB,CAACT,mBAAA,CAAoBK,mBAAA,EAAqB;MAChEK,KAAA,EAAO,CACLX,UAAA,CAAW;QACTY,UAAA,EAAY;UACVC,IAAA,EAAM;YACJC,SAAA,EAAW,MAAAA,CAAO;cAChBF,UAAU;cACVG,YAAY;cACZC,KAAK;cACLC,KAAK;cACLC,IAAI;cACJC,cAAc;cACdC,MAAM;cACNC,GAAG;cACHC;YAAgB,CACjB;cACC,MAAMC,YAAA,G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