@payloadcms/richtext-lexical 3.44.0-canary.2 → 3.44.0-canary.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/features/blockquote/server/index.js +1 -1
- package/dist/features/blockquote/server/index.js.map +1 -1
- package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.js +1 -1
- package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.js.map +1 -1
- package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/paragraph.js +1 -1
- package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/paragraph.js.map +1 -1
- package/dist/features/heading/server/index.js +1 -1
- package/dist/features/heading/server/index.js.map +1 -1
- package/package.json +6 -6
|
@@ -38,7 +38,7 @@ export const BlockquoteFeature = createServerFeature({
|
|
|
38
38
|
req,
|
|
39
39
|
showHiddenFields
|
|
40
40
|
});
|
|
41
|
-
const style = [node.format ? `text-align: ${node.format};` : '', node.indent > 0 ? `padding-inline-start: ${node.indent *
|
|
41
|
+
const style = [node.format ? `text-align: ${node.format};` : '', node.indent > 0 ? `padding-inline-start: ${Number(node.indent) * 2}rem;` : ''].filter(Boolean).join(' ');
|
|
42
42
|
return `<blockquote${style ? ` style='${style}'` : ''}>${childrenText}</blockquote>`;
|
|
43
43
|
},
|
|
44
44
|
nodeTypes: [QuoteNode.getType()]
|
|
@@ -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 node.indent > 0 ? `padding-inline-start: ${node.indent *
|
|
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","Number","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 node.indent > 0 ? `padding-inline-start: ${Number(node.indent) * 2}rem;` : '',\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,IAC9CT,IAAA,CAAKU,MAAM,GAAG,IAAI,yBAAyBC,MAAA,CAAOX,IAAA,CAAKU,MAAM,IAAI,OAAO,GAAG,GAC5E,CACEE,MAAM,CAACC,OAAA,EACPC,IAAI,CAAC;YAER,OAAO,cAAcN,KAAA,GAAQ,WAAWA,KAAA,GAAQ,GAAG,MAAMH,YAAA,eAA2B;UACtF;UACAU,SAAA,EAAW,CAACjC,SAAA,CAAUkC,OAAO;QAC/B;MACF;MACAhB,IAAA,EAAMlB;IACR;EAEJ;EACAmC,GAAA,EAAK;AACP","ignoreList":[]}
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
}
|
|
47
47
|
if (!disableIndent && (!Array.isArray(disableIndent) || !disableIndent?.includes(node.type))) {
|
|
48
48
|
if ('indent' in node && node.indent && node.type !== 'listitem') {
|
|
49
|
-
style['padding-inline-start'] = `${Number(node.indent) * 2}
|
|
49
|
+
style['padding-inline-start'] = `${Number(node.indent) * 2}rem`;
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
let providedCSSString = '';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findConverterForNode.js","names":["findConverterForNode","converters","disableIndent","disableTextAlign","node","unknownConverter","converterForNode","type","blocks","fields","blockType","console","error","inlineBlocks","style","Array","isArray","includes","format","indent","Number","providedCSSString","key","Object","keys","providedStyleTag","length"],"sources":["../../../../../src/features/converters/lexicalToHtml/shared/findConverterForNode.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport type { SerializedLexicalNode } from 'lexical'\n\nimport type { SerializedBlockNode, SerializedInlineBlockNode } from '../../../../nodeTypes.js'\nimport type { HTMLConverterAsync, HTMLConvertersAsync } from '../async/types.js'\nimport type { HTMLConverter, HTMLConverters } from '../sync/types.js'\nimport type { ProvidedCSS } from './types.js'\n\nexport function findConverterForNode<\n TConverters extends HTMLConverters | HTMLConvertersAsync,\n TConverter extends HTMLConverter | HTMLConverterAsync,\n>({\n converters,\n disableIndent,\n disableTextAlign,\n node,\n unknownConverter,\n}: {\n converters: TConverters\n disableIndent?: boolean | string[]\n disableTextAlign?: boolean | string[]\n node: SerializedLexicalNode\n unknownConverter: TConverter\n}): {\n converterForNode: TConverter | undefined\n providedCSSString: string\n providedStyleTag: string\n} {\n let converterForNode: TConverter | undefined\n if (node.type === 'block') {\n converterForNode = converters?.blocks?.[\n (node as SerializedBlockNode)?.fields?.blockType\n ] as TConverter\n if (!converterForNode && !unknownConverter) {\n console.error(\n `Lexical => HTML converter: Blocks converter: found ${(node as SerializedBlockNode)?.fields?.blockType} block, but no converter is provided`,\n )\n }\n } else if (node.type === 'inlineBlock') {\n converterForNode = converters?.inlineBlocks?.[\n (node as SerializedInlineBlockNode)?.fields?.blockType\n ] as TConverter\n if (!converterForNode && !unknownConverter) {\n console.error(\n `Lexical => HTML converter: Inline Blocks converter: found ${(node as SerializedInlineBlockNode)?.fields?.blockType} inline block, but no converter is provided`,\n )\n }\n } else {\n converterForNode = converters[node.type] as TConverter\n }\n\n const style: ProvidedCSS = {}\n\n // Check if disableTextAlign is not true and does not include node type\n if (\n !disableTextAlign &&\n (!Array.isArray(disableTextAlign) || !disableTextAlign?.includes(node.type))\n ) {\n if ('format' in node && node.format) {\n switch (node.format) {\n case 'center':\n style['text-align'] = 'center'\n break\n case 'end':\n style['text-align'] = 'right'\n break\n case 'justify':\n style['text-align'] = 'justify'\n break\n case 'left':\n //style['text-align'] = 'left'\n // Do nothing, as left is the default\n break\n case 'right':\n style['text-align'] = 'right'\n break\n case 'start':\n style['text-align'] = 'left'\n break\n }\n }\n }\n\n if (!disableIndent && (!Array.isArray(disableIndent) || !disableIndent?.includes(node.type))) {\n if ('indent' in node && node.indent && node.type !== 'listitem') {\n style['padding-inline-start'] = `${Number(node.indent) * 2}
|
|
1
|
+
{"version":3,"file":"findConverterForNode.js","names":["findConverterForNode","converters","disableIndent","disableTextAlign","node","unknownConverter","converterForNode","type","blocks","fields","blockType","console","error","inlineBlocks","style","Array","isArray","includes","format","indent","Number","providedCSSString","key","Object","keys","providedStyleTag","length"],"sources":["../../../../../src/features/converters/lexicalToHtml/shared/findConverterForNode.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport type { SerializedLexicalNode } from 'lexical'\n\nimport type { SerializedBlockNode, SerializedInlineBlockNode } from '../../../../nodeTypes.js'\nimport type { HTMLConverterAsync, HTMLConvertersAsync } from '../async/types.js'\nimport type { HTMLConverter, HTMLConverters } from '../sync/types.js'\nimport type { ProvidedCSS } from './types.js'\n\nexport function findConverterForNode<\n TConverters extends HTMLConverters | HTMLConvertersAsync,\n TConverter extends HTMLConverter | HTMLConverterAsync,\n>({\n converters,\n disableIndent,\n disableTextAlign,\n node,\n unknownConverter,\n}: {\n converters: TConverters\n disableIndent?: boolean | string[]\n disableTextAlign?: boolean | string[]\n node: SerializedLexicalNode\n unknownConverter: TConverter\n}): {\n converterForNode: TConverter | undefined\n providedCSSString: string\n providedStyleTag: string\n} {\n let converterForNode: TConverter | undefined\n if (node.type === 'block') {\n converterForNode = converters?.blocks?.[\n (node as SerializedBlockNode)?.fields?.blockType\n ] as TConverter\n if (!converterForNode && !unknownConverter) {\n console.error(\n `Lexical => HTML converter: Blocks converter: found ${(node as SerializedBlockNode)?.fields?.blockType} block, but no converter is provided`,\n )\n }\n } else if (node.type === 'inlineBlock') {\n converterForNode = converters?.inlineBlocks?.[\n (node as SerializedInlineBlockNode)?.fields?.blockType\n ] as TConverter\n if (!converterForNode && !unknownConverter) {\n console.error(\n `Lexical => HTML converter: Inline Blocks converter: found ${(node as SerializedInlineBlockNode)?.fields?.blockType} inline block, but no converter is provided`,\n )\n }\n } else {\n converterForNode = converters[node.type] as TConverter\n }\n\n const style: ProvidedCSS = {}\n\n // Check if disableTextAlign is not true and does not include node type\n if (\n !disableTextAlign &&\n (!Array.isArray(disableTextAlign) || !disableTextAlign?.includes(node.type))\n ) {\n if ('format' in node && node.format) {\n switch (node.format) {\n case 'center':\n style['text-align'] = 'center'\n break\n case 'end':\n style['text-align'] = 'right'\n break\n case 'justify':\n style['text-align'] = 'justify'\n break\n case 'left':\n //style['text-align'] = 'left'\n // Do nothing, as left is the default\n break\n case 'right':\n style['text-align'] = 'right'\n break\n case 'start':\n style['text-align'] = 'left'\n break\n }\n }\n }\n\n if (!disableIndent && (!Array.isArray(disableIndent) || !disableIndent?.includes(node.type))) {\n if ('indent' in node && node.indent && node.type !== 'listitem') {\n style['padding-inline-start'] = `${Number(node.indent) * 2}rem`\n }\n }\n\n let providedCSSString: string = ''\n for (const key of Object.keys(style)) {\n // @ts-expect-error we're iterating over the keys of the object\n providedCSSString += `${key}: ${style[key]};`\n }\n const providedStyleTag = providedCSSString?.length ? ` style=\"${providedCSSString}\"` : ''\n\n return {\n converterForNode: converterForNode ?? unknownConverter,\n providedCSSString,\n providedStyleTag,\n }\n}\n"],"mappings":"AAAA,+BAQA,OAAO,SAASA,qBAGd;EACAC,UAAU;EACVC,aAAa;EACbC,gBAAgB;EAChBC,IAAI;EACJC;AAAgB,CAOjB;EAKC,IAAIC,gBAAA;EACJ,IAAIF,IAAA,CAAKG,IAAI,KAAK,SAAS;IACzBD,gBAAA,GAAmBL,UAAA,EAAYO,MAAA,GAC5BJ,IAAA,EAA8BK,MAAA,EAAQC,SAAA,CACxC;IACD,IAAI,CAACJ,gBAAA,IAAoB,CAACD,gBAAA,EAAkB;MAC1CM,OAAA,CAAQC,KAAK,CACX,sDAAuDR,IAAA,EAA8BK,MAAA,EAAQC,SAAA,sCAA+C;IAEhJ;EACF,OAAO,IAAIN,IAAA,CAAKG,IAAI,KAAK,eAAe;IACtCD,gBAAA,GAAmBL,UAAA,EAAYY,YAAA,GAC5BT,IAAA,EAAoCK,MAAA,EAAQC,SAAA,CAC9C;IACD,IAAI,CAACJ,gBAAA,IAAoB,CAACD,gBAAA,EAAkB;MAC1CM,OAAA,CAAQC,KAAK,CACX,6DAA8DR,IAAA,EAAoCK,MAAA,EAAQC,SAAA,6CAAsD;IAEpK;EACF,OAAO;IACLJ,gBAAA,GAAmBL,UAAU,CAACG,IAAA,CAAKG,IAAI,CAAC;EAC1C;EAEA,MAAMO,KAAA,GAAqB,CAAC;EAE5B;EACA,IACE,CAACX,gBAAA,KACA,CAACY,KAAA,CAAMC,OAAO,CAACb,gBAAA,KAAqB,CAACA,gBAAA,EAAkBc,QAAA,CAASb,IAAA,CAAKG,IAAI,IAC1E;IACA,IAAI,YAAYH,IAAA,IAAQA,IAAA,CAAKc,MAAM,EAAE;MACnC,QAAQd,IAAA,CAAKc,MAAM;QACjB,KAAK;UACHJ,KAAK,CAAC,aAAa,GAAG;UACtB;QACF,KAAK;UACHA,KAAK,CAAC,aAAa,GAAG;UACtB;QACF,KAAK;UACHA,KAAK,CAAC,aAAa,GAAG;UACtB;QACF,KAAK;UAGH;QACF,KAAK;UACHA,KAAK,CAAC,aAAa,GAAG;UACtB;QACF,KAAK;UACHA,KAAK,CAAC,aAAa,GAAG;UACtB;MACJ;IACF;EACF;EAEA,IAAI,CAACZ,aAAA,KAAkB,CAACa,KAAA,CAAMC,OAAO,CAACd,aAAA,KAAkB,CAACA,aAAA,EAAee,QAAA,CAASb,IAAA,CAAKG,IAAI,IAAI;IAC5F,IAAI,YAAYH,IAAA,IAAQA,IAAA,CAAKe,MAAM,IAAIf,IAAA,CAAKG,IAAI,KAAK,YAAY;MAC/DO,KAAK,CAAC,uBAAuB,GAAG,GAAGM,MAAA,CAAOhB,IAAA,CAAKe,MAAM,IAAI,MAAM;IACjE;EACF;EAEA,IAAIE,iBAAA,GAA4B;EAChC,KAAK,MAAMC,GAAA,IAAOC,MAAA,CAAOC,IAAI,CAACV,KAAA,GAAQ;IACpC;IACAO,iBAAA,IAAqB,GAAGC,GAAA,KAAQR,KAAK,CAACQ,GAAA,CAAI,GAAG;EAC/C;EACA,MAAMG,gBAAA,GAAmBJ,iBAAA,EAAmBK,MAAA,GAAS,WAAWL,iBAAA,GAAoB,GAAG;EAEvF,OAAO;IACLf,gBAAA,EAAkBA,gBAAA,IAAoBD,gBAAA;IACtCgB,iBAAA;IACAI;EACF;AACF","ignoreList":[]}
|
|
@@ -25,7 +25,7 @@ export const ParagraphHTMLConverter = {
|
|
|
25
25
|
req,
|
|
26
26
|
showHiddenFields
|
|
27
27
|
});
|
|
28
|
-
const style = [node.format ? `text-align: ${node.format};` : '', node.indent > 0 ? `padding-inline-start: ${node.indent *
|
|
28
|
+
const style = [node.format ? `text-align: ${node.format};` : '', node.indent > 0 ? `padding-inline-start: ${Number(node.indent) * 2}rem;` : ''].filter(Boolean).join(' ');
|
|
29
29
|
return `<p${style ? ` style='${style}'` : ''}>${childrenText}</p>`;
|
|
30
30
|
},
|
|
31
31
|
nodeTypes: ['paragraph']
|
package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/paragraph.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paragraph.js","names":["convertLexicalNodesToHTML","ParagraphHTMLConverter","converter","converters","currentDepth","depth","draft","node","overrideAccess","parent","req","showHiddenFields","childrenText","lexicalNodes","children","style","format","indent","filter","Boolean","join","nodeTypes"],"sources":["../../../../../../src/features/converters/lexicalToHtml_deprecated/converter/converters/paragraph.ts"],"sourcesContent":["import type { SerializedParagraphNode } from '../../../../../nodeTypes.js'\nimport type { HTMLConverter } from '../types.js'\n\nimport { convertLexicalNodesToHTML } from '../index.js'\n\nexport const ParagraphHTMLConverter: HTMLConverter<SerializedParagraphNode> = {\n async converter({\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 node.indent > 0 ? `padding-inline-start: ${node.indent *
|
|
1
|
+
{"version":3,"file":"paragraph.js","names":["convertLexicalNodesToHTML","ParagraphHTMLConverter","converter","converters","currentDepth","depth","draft","node","overrideAccess","parent","req","showHiddenFields","childrenText","lexicalNodes","children","style","format","indent","Number","filter","Boolean","join","nodeTypes"],"sources":["../../../../../../src/features/converters/lexicalToHtml_deprecated/converter/converters/paragraph.ts"],"sourcesContent":["import type { SerializedParagraphNode } from '../../../../../nodeTypes.js'\nimport type { HTMLConverter } from '../types.js'\n\nimport { convertLexicalNodesToHTML } from '../index.js'\n\nexport const ParagraphHTMLConverter: HTMLConverter<SerializedParagraphNode> = {\n async converter({\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 node.indent > 0 ? `padding-inline-start: ${Number(node.indent) * 2}rem;` : '',\n ]\n .filter(Boolean)\n .join(' ')\n return `<p${style ? ` style='${style}'` : ''}>${childrenText}</p>`\n },\n nodeTypes: ['paragraph'],\n}\n"],"mappings":"AAGA,SAASA,yBAAyB,QAAQ;AAE1C,OAAO,MAAMC,sBAAA,GAAiE;EAC5E,MAAMC,UAAU;IACdC,UAAU;IACVC,YAAY;IACZC,KAAK;IACLC,KAAK;IACLC,IAAI;IACJC,cAAc;IACdC,MAAM;IACNC,GAAG;IACHC;EAAgB,CACjB;IACC,MAAMC,YAAA,GAAe,MAAMZ,yBAAA,CAA0B;MACnDG,UAAA;MACAC,YAAA;MACAC,KAAA;MACAC,KAAA;MACAO,YAAA,EAAcN,IAAA,CAAKO,QAAQ;MAC3BN,cAAA;MACAC,MAAA,EAAQ;QACN,GAAGF,IAAI;QACPE;MACF;MACAC,GAAA;MACAC;IACF;IACA,MAAMI,KAAA,GAAQ,CACZR,IAAA,CAAKS,MAAM,GAAG,eAAeT,IAAA,CAAKS,MAAM,GAAG,GAAG,IAC9CT,IAAA,CAAKU,MAAM,GAAG,IAAI,yBAAyBC,MAAA,CAAOX,IAAA,CAAKU,MAAM,IAAI,OAAO,GAAG,GAC5E,CACEE,MAAM,CAACC,OAAA,EACPC,IAAI,CAAC;IACR,OAAO,KAAKN,KAAA,GAAQ,WAAWA,KAAA,GAAQ,GAAG,MAAMH,YAAA,MAAkB;EACpE;EACAU,SAAA,EAAW,CAAC;AACd","ignoreList":[]}
|
|
@@ -47,7 +47,7 @@ export const HeadingFeature = createServerFeature({
|
|
|
47
47
|
req,
|
|
48
48
|
showHiddenFields
|
|
49
49
|
});
|
|
50
|
-
const style = [node.format ? `text-align: ${node.format};` : '', node.indent > 0 ? `padding-inline-start: ${node.indent *
|
|
50
|
+
const style = [node.format ? `text-align: ${node.format};` : '', node.indent > 0 ? `padding-inline-start: ${Number(node.indent) * 2}rem;` : ''].filter(Boolean).join(' ');
|
|
51
51
|
return `<${node?.tag}${style ? ` style='${style}'` : ''}>${childrenText}</${node?.tag}>`;
|
|
52
52
|
},
|
|
53
53
|
nodeTypes: [HeadingNode.getType()]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["HeadingNode","createServerFeature","convertLexicalNodesToHTML","createNode","MarkdownTransformer","i18n","HeadingFeature","feature","props","enabledHeadingSizes","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 _SerializedHeadingNode\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 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 node.indent > 0 ? `padding-inline-start: ${node.indent *
|
|
1
|
+
{"version":3,"file":"index.js","names":["HeadingNode","createServerFeature","convertLexicalNodesToHTML","createNode","MarkdownTransformer","i18n","HeadingFeature","feature","props","enabledHeadingSizes","ClientFeature","clientFeatureProps","markdownTransformers","nodes","converters","html","converter","currentDepth","depth","draft","node","overrideAccess","parent","req","showHiddenFields","childrenText","lexicalNodes","children","style","format","indent","Number","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 _SerializedHeadingNode\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 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 node.indent > 0 ? `padding-inline-start: ${Number(node.indent) * 2}rem;` : '',\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;IAEvE,OAAO;MACLE,aAAA,EAAe;MACfC,kBAAA,EAAoBH,KAAA;MACpBH,IAAA;MACAO,oBAAA,EAAsB,CAACR,mBAAA,CAAoBK,mBAAA,EAAqB;MAChEI,KAAA,EAAO,CACLV,UAAA,CAAW;QACTW,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,MAAMvB,yBAAA,CAA0B;gBACnDY,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,IAC9CT,IAAA,CAAKU,MAAM,GAAG,IAAI,yBAAyBC,MAAA,CAAOX,IAAA,CAAKU,MAAM,IAAI,OAAO,GAAG,GAC5E,CACEE,MAAM,CAACC,OAAA,EACPC,IAAI,CAAC;cACR,OAAO,IAAId,IAAA,EAAMe,GAAA,GAAMP,KAAA,GAAQ,WAAWA,KAAA,GAAQ,GAAG,MAAMH,YAAA,KAAiBL,IAAA,EAAMe,GAAA,GAAM;YAC1F;YACAC,SAAA,EAAW,CAACpC,WAAA,CAAYqC,OAAO;UACjC;QACF;QACAjB,IAAA,EAAMpB;MACR,GACD;MACDsC,2BAAA,EAA6B9B;IAC/B;EACF;EACA+B,GAAA,EAAK;AACP","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/richtext-lexical",
|
|
3
|
-
"version": "3.44.0-canary.
|
|
3
|
+
"version": "3.44.0-canary.4",
|
|
4
4
|
"description": "The officially supported Lexical richtext adapter for Payload",
|
|
5
5
|
"homepage": "https://payloadcms.com",
|
|
6
6
|
"repository": {
|
|
@@ -368,8 +368,8 @@
|
|
|
368
368
|
"react-error-boundary": "4.1.2",
|
|
369
369
|
"ts-essentials": "10.0.3",
|
|
370
370
|
"uuid": "10.0.0",
|
|
371
|
-
"@payloadcms/translations": "3.44.0-canary.
|
|
372
|
-
"@payloadcms/ui": "3.44.0-canary.
|
|
371
|
+
"@payloadcms/translations": "3.44.0-canary.4",
|
|
372
|
+
"@payloadcms/ui": "3.44.0-canary.4"
|
|
373
373
|
},
|
|
374
374
|
"devDependencies": {
|
|
375
375
|
"@babel/cli": "7.27.2",
|
|
@@ -388,7 +388,7 @@
|
|
|
388
388
|
"esbuild": "0.25.5",
|
|
389
389
|
"esbuild-sass-plugin": "3.3.1",
|
|
390
390
|
"swc-plugin-transform-remove-imports": "4.0.4",
|
|
391
|
-
"payload": "3.44.0-canary.
|
|
391
|
+
"payload": "3.44.0-canary.4",
|
|
392
392
|
"@payloadcms/eslint-config": "3.28.0"
|
|
393
393
|
},
|
|
394
394
|
"peerDependencies": {
|
|
@@ -396,8 +396,8 @@
|
|
|
396
396
|
"@faceless-ui/scroll-info": "2.0.0",
|
|
397
397
|
"react": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
|
|
398
398
|
"react-dom": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
|
|
399
|
-
"@payloadcms/next": "3.44.0-canary.
|
|
400
|
-
"payload": "3.44.0-canary.
|
|
399
|
+
"@payloadcms/next": "3.44.0-canary.4",
|
|
400
|
+
"payload": "3.44.0-canary.4"
|
|
401
401
|
},
|
|
402
402
|
"engines": {
|
|
403
403
|
"node": "^18.20.2 || >=20.9.0"
|