@payloadcms/richtext-lexical 3.50.0-canary.0 → 3.50.0-canary.2
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/exports/client/bundled.css +1 -1
- package/dist/exports/client/index.js +10 -10
- package/dist/exports/client/index.js.map +3 -3
- package/dist/features/blockquote/server/index.d.ts.map +1 -1
- package/dist/features/blockquote/server/index.js +6 -1
- package/dist/features/blockquote/server/index.js.map +1 -1
- package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.d.ts.map +1 -1
- package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.js +5 -1
- package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.js.map +1 -1
- package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/paragraph.d.ts.map +1 -1
- package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/paragraph.js +6 -1
- package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/paragraph.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/index.d.ts.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/index.js +5 -1
- package/dist/features/converters/lexicalToJSX/converter/index.js.map +1 -1
- package/dist/features/debug/jsxConverter/client/plugin/index.d.ts +1 -0
- package/dist/features/debug/jsxConverter/client/plugin/index.d.ts.map +1 -1
- package/dist/features/debug/jsxConverter/client/plugin/index.js +6 -3
- package/dist/features/debug/jsxConverter/client/plugin/index.js.map +1 -1
- package/dist/features/heading/server/index.d.ts.map +1 -1
- package/dist/features/heading/server/index.js +6 -1
- package/dist/features/heading/server/index.js.map +1 -1
- package/dist/field/bundled.css +1 -1
- package/package.json +7 -7
|
@@ -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,
|
|
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"}
|
|
@@ -38,7 +38,12 @@ export const BlockquoteFeature = createServerFeature({
|
|
|
38
38
|
req,
|
|
39
39
|
showHiddenFields
|
|
40
40
|
});
|
|
41
|
-
const style = [node.format ? `text-align: ${node.format};` : '',
|
|
41
|
+
const style = [node.format ? `text-align: ${node.format};` : '',
|
|
42
|
+
// the unit should be px. Do not change it to rem, em, or something else.
|
|
43
|
+
// The quantity should be 40px. Do not change it either.
|
|
44
|
+
// See rationale in
|
|
45
|
+
// https://github.com/payloadcms/payload/issues/13130#issuecomment-3058348085
|
|
46
|
+
node.indent > 0 ? `padding-inline-start: ${node.indent * 40}px;` : ''].filter(Boolean).join(' ');
|
|
42
47
|
return `<blockquote${style ? ` style='${style}'` : ''}>${childrenText}</blockquote>`;
|
|
43
48
|
},
|
|
44
49
|
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","
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findConverterForNode.d.ts","sourceRoot":"","sources":["../../../../../src/features/converters/lexicalToHtml/shared/findConverterForNode.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAGpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAChF,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAGrE,wBAAgB,oBAAoB,CAClC,WAAW,SAAS,cAAc,GAAG,mBAAmB,EACxD,UAAU,SAAS,aAAa,GAAG,kBAAkB,EACrD,EACA,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,IAAI,EACJ,gBAAgB,GACjB,EAAE;IACD,UAAU,EAAE,WAAW,CAAA;IACvB,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAA;IAClC,gBAAgB,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAA;IACrC,IAAI,EAAE,qBAAqB,CAAA;IAC3B,gBAAgB,EAAE,UAAU,CAAA;CAC7B,GAAG;IACF,gBAAgB,EAAE,UAAU,GAAG,SAAS,CAAA;IACxC,iBAAiB,EAAE,MAAM,CAAA;IACzB,gBAAgB,EAAE,MAAM,CAAA;CACzB,
|
|
1
|
+
{"version":3,"file":"findConverterForNode.d.ts","sourceRoot":"","sources":["../../../../../src/features/converters/lexicalToHtml/shared/findConverterForNode.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAGpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAChF,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAGrE,wBAAgB,oBAAoB,CAClC,WAAW,SAAS,cAAc,GAAG,mBAAmB,EACxD,UAAU,SAAS,aAAa,GAAG,kBAAkB,EACrD,EACA,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,IAAI,EACJ,gBAAgB,GACjB,EAAE;IACD,UAAU,EAAE,WAAW,CAAA;IACvB,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAA;IAClC,gBAAgB,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAA;IACrC,IAAI,EAAE,qBAAqB,CAAA;IAC3B,gBAAgB,EAAE,UAAU,CAAA;CAC7B,GAAG;IACF,gBAAgB,EAAE,UAAU,GAAG,SAAS,CAAA;IACxC,iBAAiB,EAAE,MAAM,CAAA;IACzB,gBAAgB,EAAE,MAAM,CAAA;CACzB,CA8EA"}
|
|
@@ -46,7 +46,11 @@
|
|
|
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
|
-
|
|
49
|
+
// the unit should be px. Do not change it to rem, em, or something else.
|
|
50
|
+
// The quantity should be 40px. Do not change it either.
|
|
51
|
+
// See rationale in
|
|
52
|
+
// https://github.com/payloadcms/payload/issues/13130#issuecomment-3058348085
|
|
53
|
+
style['padding-inline-start'] = `${Number(node.indent) * 40}px`;
|
|
50
54
|
}
|
|
51
55
|
}
|
|
52
56
|
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) *
|
|
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 // 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 style['padding-inline-start'] = `${Number(node.indent) * 40}px`\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,SAA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M,IAAIf,IAAA,CAAKG,IAAI,KAAK,YAAY;MAC/D;MACA;MACA;MACA;MACAO,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":[]}
|
package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/paragraph.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paragraph.d.ts","sourceRoot":"","sources":["../../../../../../src/features/converters/lexicalToHtml_deprecated/converter/converters/paragraph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAA;AAC1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAIhD,eAAO,MAAM,sBAAsB,EAAE,aAAa,CAAC,uBAAuB,
|
|
1
|
+
{"version":3,"file":"paragraph.d.ts","sourceRoot":"","sources":["../../../../../../src/features/converters/lexicalToHtml_deprecated/converter/converters/paragraph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAA;AAC1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAIhD,eAAO,MAAM,sBAAsB,EAAE,aAAa,CAAC,uBAAuB,CAuCzE,CAAA"}
|
|
@@ -25,7 +25,12 @@ export const ParagraphHTMLConverter = {
|
|
|
25
25
|
req,
|
|
26
26
|
showHiddenFields
|
|
27
27
|
});
|
|
28
|
-
const style = [node.format ? `text-align: ${node.format};` : '',
|
|
28
|
+
const style = [node.format ? `text-align: ${node.format};` : '',
|
|
29
|
+
// the unit should be px. Do not change it to rem, em, or something else.
|
|
30
|
+
// The quantity should be 40px. Do not change it either.
|
|
31
|
+
// See rationale in
|
|
32
|
+
// https://github.com/payloadcms/payload/issues/13130#issuecomment-3058348085
|
|
33
|
+
node.indent > 0 ? `padding-inline-start: ${node.indent * 40}px;` : ''].filter(Boolean).join(' ');
|
|
29
34
|
return `<p${style ? ` style='${style}'` : ''}>${childrenText}</p>`;
|
|
30
35
|
},
|
|
31
36
|
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","
|
|
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 // 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 `<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;IAC9C;IACA;IACA;IACA;IACAT,IAAA,CAAKU,MAAM,GAAG,IAAI,yBAAyBV,IAAA,CAAKU,MAAM,GAAG,OAAO,GAAG,GACpE,CACEC,MAAM,CAACC,OAAA,EACPC,IAAI,CAAC;IACR,OAAO,KAAKL,KAAA,GAAQ,WAAWA,KAAA,GAAQ,GAAG,MAAMH,YAAA,MAAkB;EACpE;EACAS,SAAA,EAAW,CAAC;AACd","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/converters/lexicalToJSX/converter/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAE3E,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,KAAK,EAAgB,aAAa,EAAE,+BAA+B,EAAE,MAAM,YAAY,CAAA;AAI9F,MAAM,MAAM,uBAAuB,GAAG;IACpC,UAAU,EAAE,aAAa,CAAA;IACzB,IAAI,EAAE,qBAAqB,CAAA;IAC3B,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAA;IAClC,gBAAgB,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAA;CACtC,CAAA;AAED,wBAAgB,mBAAmB,CAAC,EAClC,UAAU,EACV,IAAI,EACJ,aAAa,EACb,gBAAgB,GACjB,EAAE,uBAAuB,GAAG,KAAK,CAAC,SAAS,CAW3C;AAED,wBAAgB,wBAAwB,CAAC,EACvC,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,KAAK,EACL,MAAM,GACP,EAAE;IACD,UAAU,EAAE,aAAa,CAAA;IACzB,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAA;IAClC,gBAAgB,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAA;IACrC,KAAK,EAAE,qBAAqB,EAAE,CAAA;IAC9B,MAAM,EAAE,+BAA+B,CAAA;CACxC,GAAG,KAAK,CAAC,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/converters/lexicalToJSX/converter/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAE3E,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,KAAK,EAAgB,aAAa,EAAE,+BAA+B,EAAE,MAAM,YAAY,CAAA;AAI9F,MAAM,MAAM,uBAAuB,GAAG;IACpC,UAAU,EAAE,aAAa,CAAA;IACzB,IAAI,EAAE,qBAAqB,CAAA;IAC3B,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAA;IAClC,gBAAgB,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAA;CACtC,CAAA;AAED,wBAAgB,mBAAmB,CAAC,EAClC,UAAU,EACV,IAAI,EACJ,aAAa,EACb,gBAAgB,GACjB,EAAE,uBAAuB,GAAG,KAAK,CAAC,SAAS,CAW3C;AAED,wBAAgB,wBAAwB,CAAC,EACvC,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,KAAK,EACL,MAAM,GACP,EAAE;IACD,UAAU,EAAE,aAAa,CAAA;IACzB,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAA;IAClC,gBAAgB,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAA;IACrC,KAAK,EAAE,qBAAqB,EAAE,CAAA;IAC9B,MAAM,EAAE,+BAA+B,CAAA;CACxC,GAAG,KAAK,CAAC,SAAS,EAAE,CAmIpB"}
|
|
@@ -98,7 +98,11 @@ export function convertLexicalNodesToJSX({
|
|
|
98
98
|
}
|
|
99
99
|
if (!disableIndent && (!Array.isArray(disableIndent) || !disableIndent?.includes(node.type))) {
|
|
100
100
|
if ('indent' in node && node.indent && node.type !== 'listitem') {
|
|
101
|
-
|
|
101
|
+
// the unit should be px. Do not change it to rem, em, or something else.
|
|
102
|
+
// The quantity should be 40px. Do not change it either.
|
|
103
|
+
// See rationale in
|
|
104
|
+
// https://github.com/payloadcms/payload/issues/13130#issuecomment-3058348085
|
|
105
|
+
style.paddingInlineStart = `${Number(node.indent) * 40}px`;
|
|
102
106
|
}
|
|
103
107
|
}
|
|
104
108
|
if (/*#__PURE__*/React.isValidElement(reactNode)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["jsx","_jsx","Fragment","_Fragment","React","hasText","convertLexicalToJSX","converters","data","disableIndent","disableTextAlign","convertLexicalNodesToJSX","nodes","root","children","parent","unknownConverter","unknown","jsxArray","map","node","i","converterForNode","type","blocks","fields","blockType","console","error","inlineBlocks","reactNode","converted","childIndex","nodesToJSX","args","style","Array","isArray","includes","format","textAlign","indent","paddingInlineStart","Number","isValidElement","newStyle","props","cloneElement","key","filter","Boolean"],"sources":["../../../../../src/features/converters/lexicalToJSX/converter/index.tsx"],"sourcesContent":["/* eslint-disable no-console */\nimport type { SerializedEditorState, SerializedLexicalNode } from 'lexical'\n\nimport React from 'react'\n\nimport type { SerializedBlockNode, SerializedInlineBlockNode } from '../../../../nodeTypes.js'\nimport type { JSXConverter, JSXConverters, SerializedLexicalNodeWithParent } from './types.js'\n\nimport { hasText } from '../../../../validate/hasText.js'\n\nexport type ConvertLexicalToJSXArgs = {\n converters: JSXConverters\n data: SerializedEditorState\n disableIndent?: boolean | string[]\n disableTextAlign?: boolean | string[]\n}\n\nexport function convertLexicalToJSX({\n converters,\n data,\n disableIndent,\n disableTextAlign,\n}: ConvertLexicalToJSXArgs): React.ReactNode {\n if (hasText(data)) {\n return convertLexicalNodesToJSX({\n converters,\n disableIndent,\n disableTextAlign,\n nodes: data?.root?.children,\n parent: data?.root,\n })\n }\n return <></>\n}\n\nexport function convertLexicalNodesToJSX({\n converters,\n disableIndent,\n disableTextAlign,\n nodes,\n parent,\n}: {\n converters: JSXConverters\n disableIndent?: boolean | string[]\n disableTextAlign?: boolean | string[]\n nodes: SerializedLexicalNode[]\n parent: SerializedLexicalNodeWithParent\n}): React.ReactNode[] {\n const unknownConverter: JSXConverter<any> = converters.unknown as JSXConverter<any>\n\n const jsxArray: React.ReactNode[] = nodes.map((node, i) => {\n let converterForNode: JSXConverter<any> | undefined\n if (node.type === 'block') {\n converterForNode = converters?.blocks?.[(node as SerializedBlockNode)?.fields?.blockType]\n if (!converterForNode && !unknownConverter) {\n console.error(\n `Lexical => JSX 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 =\n converters?.inlineBlocks?.[(node as SerializedInlineBlockNode)?.fields?.blockType]\n if (!converterForNode && !unknownConverter) {\n console.error(\n `Lexical => JSX 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 JSXConverter<any>\n }\n\n try {\n if (!converterForNode && unknownConverter) {\n converterForNode = unknownConverter\n }\n\n let reactNode: React.ReactNode\n if (converterForNode) {\n const converted =\n typeof converterForNode === 'function'\n ? converterForNode({\n childIndex: i,\n converters,\n node,\n nodesToJSX: (args) => {\n return convertLexicalNodesToJSX({\n converters: args.converters ?? converters,\n disableIndent: args.disableIndent ?? disableIndent,\n disableTextAlign: args.disableTextAlign ?? disableTextAlign,\n nodes: args.nodes,\n parent: args.parent ?? {\n ...node,\n parent,\n },\n })\n },\n parent,\n })\n : converterForNode\n reactNode = converted\n } else {\n reactNode = <span key={i}>unknown node</span>\n }\n\n const style: React.CSSProperties = {}\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.textAlign = 'center'\n break\n case 'end':\n style.textAlign = 'right'\n break\n case 'justify':\n style.textAlign = 'justify'\n break\n case 'left':\n //style.textAlign = 'left'\n // Do nothing, as left is the default\n break\n case 'right':\n style.textAlign = 'right'\n break\n case 'start':\n style.textAlign = 'left'\n break\n }\n }\n }\n\n if (\n !disableIndent &&\n (!Array.isArray(disableIndent) || !disableIndent?.includes(node.type))\n ) {\n if ('indent' in node && node.indent && node.type !== 'listitem') {\n style.paddingInlineStart = `${Number(node.indent) *
|
|
1
|
+
{"version":3,"file":"index.js","names":["jsx","_jsx","Fragment","_Fragment","React","hasText","convertLexicalToJSX","converters","data","disableIndent","disableTextAlign","convertLexicalNodesToJSX","nodes","root","children","parent","unknownConverter","unknown","jsxArray","map","node","i","converterForNode","type","blocks","fields","blockType","console","error","inlineBlocks","reactNode","converted","childIndex","nodesToJSX","args","style","Array","isArray","includes","format","textAlign","indent","paddingInlineStart","Number","isValidElement","newStyle","props","cloneElement","key","filter","Boolean"],"sources":["../../../../../src/features/converters/lexicalToJSX/converter/index.tsx"],"sourcesContent":["/* eslint-disable no-console */\nimport type { SerializedEditorState, SerializedLexicalNode } from 'lexical'\n\nimport React from 'react'\n\nimport type { SerializedBlockNode, SerializedInlineBlockNode } from '../../../../nodeTypes.js'\nimport type { JSXConverter, JSXConverters, SerializedLexicalNodeWithParent } from './types.js'\n\nimport { hasText } from '../../../../validate/hasText.js'\n\nexport type ConvertLexicalToJSXArgs = {\n converters: JSXConverters\n data: SerializedEditorState\n disableIndent?: boolean | string[]\n disableTextAlign?: boolean | string[]\n}\n\nexport function convertLexicalToJSX({\n converters,\n data,\n disableIndent,\n disableTextAlign,\n}: ConvertLexicalToJSXArgs): React.ReactNode {\n if (hasText(data)) {\n return convertLexicalNodesToJSX({\n converters,\n disableIndent,\n disableTextAlign,\n nodes: data?.root?.children,\n parent: data?.root,\n })\n }\n return <></>\n}\n\nexport function convertLexicalNodesToJSX({\n converters,\n disableIndent,\n disableTextAlign,\n nodes,\n parent,\n}: {\n converters: JSXConverters\n disableIndent?: boolean | string[]\n disableTextAlign?: boolean | string[]\n nodes: SerializedLexicalNode[]\n parent: SerializedLexicalNodeWithParent\n}): React.ReactNode[] {\n const unknownConverter: JSXConverter<any> = converters.unknown as JSXConverter<any>\n\n const jsxArray: React.ReactNode[] = nodes.map((node, i) => {\n let converterForNode: JSXConverter<any> | undefined\n if (node.type === 'block') {\n converterForNode = converters?.blocks?.[(node as SerializedBlockNode)?.fields?.blockType]\n if (!converterForNode && !unknownConverter) {\n console.error(\n `Lexical => JSX 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 =\n converters?.inlineBlocks?.[(node as SerializedInlineBlockNode)?.fields?.blockType]\n if (!converterForNode && !unknownConverter) {\n console.error(\n `Lexical => JSX 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 JSXConverter<any>\n }\n\n try {\n if (!converterForNode && unknownConverter) {\n converterForNode = unknownConverter\n }\n\n let reactNode: React.ReactNode\n if (converterForNode) {\n const converted =\n typeof converterForNode === 'function'\n ? converterForNode({\n childIndex: i,\n converters,\n node,\n nodesToJSX: (args) => {\n return convertLexicalNodesToJSX({\n converters: args.converters ?? converters,\n disableIndent: args.disableIndent ?? disableIndent,\n disableTextAlign: args.disableTextAlign ?? disableTextAlign,\n nodes: args.nodes,\n parent: args.parent ?? {\n ...node,\n parent,\n },\n })\n },\n parent,\n })\n : converterForNode\n reactNode = converted\n } else {\n reactNode = <span key={i}>unknown node</span>\n }\n\n const style: React.CSSProperties = {}\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.textAlign = 'center'\n break\n case 'end':\n style.textAlign = 'right'\n break\n case 'justify':\n style.textAlign = 'justify'\n break\n case 'left':\n //style.textAlign = 'left'\n // Do nothing, as left is the default\n break\n case 'right':\n style.textAlign = 'right'\n break\n case 'start':\n style.textAlign = 'left'\n break\n }\n }\n }\n\n if (\n !disableIndent &&\n (!Array.isArray(disableIndent) || !disableIndent?.includes(node.type))\n ) {\n if ('indent' in node && node.indent && node.type !== 'listitem') {\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 style.paddingInlineStart = `${Number(node.indent) * 40}px`\n }\n }\n\n if (React.isValidElement(reactNode)) {\n // Inject style into reactNode\n if (style.textAlign || style.paddingInlineStart) {\n const newStyle = {\n ...style,\n // @ts-expect-error type better later\n ...(reactNode?.props?.style ?? {}),\n // reactNode style comes after, thus a textAlign specified in the converter has priority over the one we inject here\n }\n\n return React.cloneElement(reactNode, {\n key: i,\n // @ts-expect-error type better later\n style: newStyle,\n })\n }\n return React.cloneElement(reactNode, {\n key: i,\n })\n }\n\n return reactNode\n } catch (error) {\n console.error('Error converting lexical node to JSX:', error, 'node:', node)\n return null\n }\n })\n\n return jsxArray.filter(Boolean)\n}\n"],"mappings":"AAAA,+BAA6B,SAAAA,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA;AAG7B,OAAOC,KAAA,MAAW;AAKlB,SAASC,OAAO,QAAQ;AASxB,OAAO,SAASC,oBAAoB;EAClCC,UAAU;EACVC,IAAI;EACJC,aAAa;EACbC;AAAgB,CACQ;EACxB,IAAIL,OAAA,CAAQG,IAAA,GAAO;IACjB,OAAOG,wBAAA,CAAyB;MAC9BJ,UAAA;MACAE,aAAA;MACAC,gBAAA;MACAE,KAAA,EAAOJ,IAAA,EAAMK,IAAA,EAAMC,QAAA;MACnBC,MAAA,EAAQP,IAAA,EAAMK;IAChB;EACF;EACA,oBAAOZ,IAAA,CAAAE,SAAA;AACT;AAEA,OAAO,SAASQ,yBAAyB;EACvCJ,UAAU;EACVE,aAAa;EACbC,gBAAgB;EAChBE,KAAK;EACLG;AAAM,CAOP;EACC,MAAMC,gBAAA,GAAsCT,UAAA,CAAWU,OAAO;EAE9D,MAAMC,QAAA,GAA8BN,KAAA,CAAMO,GAAG,CAAC,CAACC,IAAA,EAAMC,CAAA;IACnD,IAAIC,gBAAA;IACJ,IAAIF,IAAA,CAAKG,IAAI,KAAK,SAAS;MACzBD,gBAAA,GAAmBf,UAAA,EAAYiB,MAAA,GAAUJ,IAAA,EAA8BK,MAAA,EAAQC,SAAA,CAAU;MACzF,IAAI,CAACJ,gBAAA,IAAoB,CAACN,gBAAA,EAAkB;QAC1CW,OAAA,CAAQC,KAAK,CACX,qDAAsDR,IAAA,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EAAW;UACnCkB,GAAA,EAAK3B;QACP;MACF;MAEA,OAAOS,SAAA;IACT,EAAE,OAAOF,KAAA,EAAO;MACdD,OAAA,CAAQC,KAAK,CAAC,yCAAyCA,KAAA,EAAO,SAASR,IAAA;MACvE,OAAO;IACT;EACF;EAEA,OAAOF,QAAA,CAAS+B,MAAM,CAACC,OAAA;AACzB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/features/debug/jsxConverter/client/plugin/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/features/debug/jsxConverter/client/plugin/index.tsx"],"names":[],"mappings":"AAOA,OAAO,cAAc,CAAA;AAErB,wBAAgB,cAAc,gCAe7B"}
|
|
@@ -38,9 +38,12 @@ export function RichTextPlugin() {
|
|
|
38
38
|
useEffect(t1, t2);
|
|
39
39
|
let t3;
|
|
40
40
|
if ($[5] !== editorState) {
|
|
41
|
-
t3 = _jsx(
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
t3 = _jsx("div", {
|
|
42
|
+
className: "debug-jsx-converter",
|
|
43
|
+
children: _jsx(RichText, {
|
|
44
|
+
converters: defaultJSXConverters,
|
|
45
|
+
data: editorState
|
|
46
|
+
})
|
|
44
47
|
});
|
|
45
48
|
$[5] = editorState;
|
|
46
49
|
$[6] = t3;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","useEffect","useState","defaultJSXConverters","RichText","RichTextPlugin","$","editor","t0","getEditorState","toJSON","editorState","setEditorState","t1","t2","registerUpdateListener","t3","editorState_0","_jsx","converters","data"],"sources":["../../../../../../src/features/debug/jsxConverter/client/plugin/index.tsx"],"sourcesContent":["'use client'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useEffect, useState } from 'react'\n\n// eslint-disable-next-line payload/no-imports-from-exports-dir\nimport { defaultJSXConverters, RichText } from '../../../../../exports/react/index.js'\n\nexport function RichTextPlugin() {\n const [editor] = useLexicalComposerContext()\n const [editorState, setEditorState] = useState(editor.getEditorState().toJSON())\n\n useEffect(() => {\n return editor.registerUpdateListener(({ editorState }) => {\n setEditorState(editorState.toJSON())\n })\n }, [editor])\n\n return <RichText converters={defaultJSXConverters} data={editorState} />\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAEA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,SAAS,EAAEC,QAAQ,QAAQ;AAEpC;AACA,SAASC,oBAAoB,EAAEC,QAAQ,QAAQ;
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","useEffect","useState","defaultJSXConverters","RichText","RichTextPlugin","$","editor","t0","getEditorState","toJSON","editorState","setEditorState","t1","t2","registerUpdateListener","t3","editorState_0","_jsx","className","children","converters","data"],"sources":["../../../../../../src/features/debug/jsxConverter/client/plugin/index.tsx"],"sourcesContent":["'use client'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useEffect, useState } from 'react'\n\n// eslint-disable-next-line payload/no-imports-from-exports-dir\nimport { defaultJSXConverters, RichText } from '../../../../../exports/react/index.js'\nimport './style.scss'\n\nexport function RichTextPlugin() {\n const [editor] = useLexicalComposerContext()\n const [editorState, setEditorState] = useState(editor.getEditorState().toJSON())\n\n useEffect(() => {\n return editor.registerUpdateListener(({ editorState }) => {\n setEditorState(editorState.toJSON())\n })\n }, [editor])\n\n return (\n <div className=\"debug-jsx-converter\">\n <RichText converters={defaultJSXConverters} data={editorState} />\n </div>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAEA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,SAAS,EAAEC,QAAQ,QAAQ;AAEpC;AACA,SAASC,oBAAoB,EAAEC,QAAQ,QAAQ;AAG/C,OAAO,SAAAC,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3B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAUrC,MAAM,MAAM,qBAAqB,GAAG,MAAM,CACxC;IACE,IAAI,EAAE,SAAS,CAAA;CAChB,EACD,sBAAsB,CACvB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,mBAAmB,CAAC,EAAE,cAAc,EAAE,CAAA;CACvC,CAAA;AAED,eAAO,MAAM,cAAc,
|
|
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,sBAAsB,CACvB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,mBAAmB,CAAC,EAAE,cAAc,EAAE,CAAA;CACvC,CAAA;AAED,eAAO,MAAM,cAAc,6HAoEzB,CAAA"}
|
|
@@ -47,7 +47,12 @@ export const HeadingFeature = createServerFeature({
|
|
|
47
47
|
req,
|
|
48
48
|
showHiddenFields
|
|
49
49
|
});
|
|
50
|
-
const style = [node.format ? `text-align: ${node.format};` : '',
|
|
50
|
+
const style = [node.format ? `text-align: ${node.format};` : '',
|
|
51
|
+
// the unit should be px. Do not change it to rem, em, or something else.
|
|
52
|
+
// The quantity should be 40px. Do not change it either.
|
|
53
|
+
// See rationale in
|
|
54
|
+
// https://github.com/payloadcms/payload/issues/13130#issuecomment-3058348085
|
|
55
|
+
node.indent > 0 ? `padding-inline-start: ${node.indent * 40}px;` : ''].filter(Boolean).join(' ');
|
|
51
56
|
return `<${node?.tag}${style ? ` style='${style}'` : ''}>${childrenText}</${node?.tag}>`;
|
|
52
57
|
},
|
|
53
58
|
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","
|
|
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 // 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;IAEvE,OAAO;MACLE,aAAA,EAAe;MACfC,kBAAA,EAAoBH,KAAA;MACpBH,IAAA;MACAO,oBAAA,EAAsB,CAACR,mBAAA,CAAoBK,mBAAA,EAAqB;MAChEI,KAAA,EAAO,CACLV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