@payloadcms/richtext-lexical 3.0.0-beta.92 → 3.0.0-beta.94
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.map +2 -2
- package/dist/features/blockquote/server/index.d.ts.map +1 -1
- package/dist/features/blockquote/server/index.js +5 -1
- package/dist/features/blockquote/server/index.js.map +1 -1
- package/dist/features/converters/html/converter/converters/paragraph.d.ts.map +1 -1
- package/dist/features/converters/html/converter/converters/paragraph.js +4 -0
- package/dist/features/converters/html/converter/converters/paragraph.js.map +1 -1
- package/dist/features/converters/html/converter/index.d.ts +6 -2
- package/dist/features/converters/html/converter/index.d.ts.map +1 -1
- package/dist/features/converters/html/converter/index.js +16 -0
- package/dist/features/converters/html/converter/index.js.map +1 -1
- package/dist/features/converters/html/converter/types.d.ts +2 -0
- package/dist/features/converters/html/converter/types.d.ts.map +1 -1
- package/dist/features/converters/html/converter/types.js.map +1 -1
- package/dist/features/converters/html/field/index.d.ts.map +1 -1
- package/dist/features/converters/html/field/index.js +4 -0
- package/dist/features/converters/html/field/index.js.map +1 -1
- package/dist/features/experimental_table/server/index.d.ts.map +1 -1
- package/dist/features/experimental_table/server/index.js +12 -0
- package/dist/features/experimental_table/server/index.js.map +1 -1
- package/dist/features/heading/server/index.d.ts.map +1 -1
- package/dist/features/heading/server/index.js +4 -0
- package/dist/features/heading/server/index.js.map +1 -1
- package/dist/features/link/server/index.d.ts.map +1 -1
- package/dist/features/link/server/index.js +8 -0
- package/dist/features/link/server/index.js.map +1 -1
- package/dist/features/lists/htmlConverter.d.ts.map +1 -1
- package/dist/features/lists/htmlConverter.js +8 -0
- package/dist/features/lists/htmlConverter.js.map +1 -1
- package/dist/features/upload/server/feature.server.d.ts.map +1 -1
- package/dist/features/upload/server/feature.server.js +4 -2
- package/dist/features/upload/server/feature.server.js.map +1 -1
- package/dist/field/bundled.css +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/lexical/utils/url.d.ts.map +1 -1
- package/dist/lexical/utils/url.js +1 -0
- package/dist/lexical/utils/url.js.map +1 -1
- package/package.json +9 -9
|
@@ -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,yFA8C5B,CAAA"}
|
|
@@ -2,8 +2,8 @@ import { QuoteNode } from '@lexical/rich-text';
|
|
|
2
2
|
import { createServerFeature } from '../../../utilities/createServerFeature.js';
|
|
3
3
|
import { convertLexicalNodesToHTML } from '../../converters/html/converter/index.js';
|
|
4
4
|
import { createNode } from '../../typeUtilities.js';
|
|
5
|
-
import { i18n } from './i18n.js';
|
|
6
5
|
import { MarkdownTransformer } from '../markdownTransformer.js';
|
|
6
|
+
import { i18n } from './i18n.js';
|
|
7
7
|
export const BlockquoteFeature = createServerFeature({
|
|
8
8
|
feature: {
|
|
9
9
|
ClientFeature: '@payloadcms/richtext-lexical/client#BlockquoteFeatureClient',
|
|
@@ -15,6 +15,8 @@ export const BlockquoteFeature = createServerFeature({
|
|
|
15
15
|
html: {
|
|
16
16
|
converter: async ({
|
|
17
17
|
converters,
|
|
18
|
+
currentDepth,
|
|
19
|
+
depth,
|
|
18
20
|
draft,
|
|
19
21
|
node,
|
|
20
22
|
overrideAccess,
|
|
@@ -24,6 +26,8 @@ export const BlockquoteFeature = createServerFeature({
|
|
|
24
26
|
}) => {
|
|
25
27
|
const childrenText = await convertLexicalNodesToHTML({
|
|
26
28
|
converters,
|
|
29
|
+
currentDepth,
|
|
30
|
+
depth,
|
|
27
31
|
draft,
|
|
28
32
|
lexicalNodes: node.children,
|
|
29
33
|
overrideAccess,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["QuoteNode","createServerFeature","convertLexicalNodesToHTML","createNode","
|
|
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","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/html/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\n return `<blockquote>${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;YAEA,OAAO,eAAeC,YAAA,eAA2B;UACnD;UACAG,SAAA,EAAW,CAAC1B,SAAA,CAAU2B,OAAO;QAC/B;MACF;MACAT,IAAA,EAAMlB;IACR;EAEJ;EACA4B,GAAA,EAAK;AACP","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paragraph.d.ts","sourceRoot":"","sources":["../../../../../../src/features/converters/html/converter/converters/paragraph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAA;AAEtD,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/html/converter/converters/paragraph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAA;AAEtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAIhD,eAAO,MAAM,sBAAsB,EAAE,aAAa,CAAC,uBAAuB,CA6BzE,CAAA"}
|
|
@@ -2,6 +2,8 @@ import { convertLexicalNodesToHTML } from '../index.js';
|
|
|
2
2
|
export const ParagraphHTMLConverter = {
|
|
3
3
|
async converter({
|
|
4
4
|
converters,
|
|
5
|
+
currentDepth,
|
|
6
|
+
depth,
|
|
5
7
|
draft,
|
|
6
8
|
node,
|
|
7
9
|
overrideAccess,
|
|
@@ -11,6 +13,8 @@ export const ParagraphHTMLConverter = {
|
|
|
11
13
|
}) {
|
|
12
14
|
const childrenText = await convertLexicalNodesToHTML({
|
|
13
15
|
converters,
|
|
16
|
+
currentDepth,
|
|
17
|
+
depth,
|
|
14
18
|
draft,
|
|
15
19
|
lexicalNodes: node.children,
|
|
16
20
|
overrideAccess,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paragraph.js","names":["convertLexicalNodesToHTML","ParagraphHTMLConverter","converter","converters","draft","node","overrideAccess","parent","req","showHiddenFields","childrenText","lexicalNodes","children","nodeTypes"],"sources":["../../../../../../src/features/converters/html/converter/converters/paragraph.ts"],"sourcesContent":["import type { SerializedParagraphNode } from 'lexical'\n\nimport type { HTMLConverter } from '../types.js'\n\nimport { convertLexicalNodesToHTML } from '../index.js'\n\nexport const ParagraphHTMLConverter: HTMLConverter<SerializedParagraphNode> = {\n async converter({
|
|
1
|
+
{"version":3,"file":"paragraph.js","names":["convertLexicalNodesToHTML","ParagraphHTMLConverter","converter","converters","currentDepth","depth","draft","node","overrideAccess","parent","req","showHiddenFields","childrenText","lexicalNodes","children","nodeTypes"],"sources":["../../../../../../src/features/converters/html/converter/converters/paragraph.ts"],"sourcesContent":["import type { SerializedParagraphNode } from 'lexical'\n\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 return `<p>${childrenText}</p>`\n },\n nodeTypes: ['paragraph'],\n}\n"],"mappings":"AAIA,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,OAAO,MAAMC,YAAA,MAAkB;EACjC;EACAG,SAAA,EAAW,CAAC;AACd","ignoreList":[]}
|
|
@@ -3,7 +3,9 @@ import type { Payload, PayloadRequest } from 'payload';
|
|
|
3
3
|
import type { HTMLConverter, SerializedLexicalNodeWithParent } from './types.js';
|
|
4
4
|
export type ConvertLexicalToHTMLArgs = {
|
|
5
5
|
converters: HTMLConverter[];
|
|
6
|
+
currentDepth?: number;
|
|
6
7
|
data: SerializedEditorState;
|
|
8
|
+
depth?: number;
|
|
7
9
|
draft?: boolean;
|
|
8
10
|
overrideAccess?: boolean;
|
|
9
11
|
showHiddenFields?: boolean;
|
|
@@ -32,9 +34,11 @@ export type ConvertLexicalToHTMLArgs = {
|
|
|
32
34
|
*/
|
|
33
35
|
req: PayloadRequest;
|
|
34
36
|
});
|
|
35
|
-
export declare function convertLexicalToHTML({ converters, data, draft, overrideAccess, payload, req, showHiddenFields, }: ConvertLexicalToHTMLArgs): Promise<string>;
|
|
36
|
-
export declare function convertLexicalNodesToHTML({ converters, draft, lexicalNodes, overrideAccess, parent, req, showHiddenFields, }: {
|
|
37
|
+
export declare function convertLexicalToHTML({ converters, currentDepth, data, depth, draft, overrideAccess, payload, req, showHiddenFields, }: ConvertLexicalToHTMLArgs): Promise<string>;
|
|
38
|
+
export declare function convertLexicalNodesToHTML({ converters, currentDepth, depth, draft, lexicalNodes, overrideAccess, parent, req, showHiddenFields, }: {
|
|
37
39
|
converters: HTMLConverter[];
|
|
40
|
+
currentDepth: number;
|
|
41
|
+
depth: number;
|
|
38
42
|
draft: boolean;
|
|
39
43
|
lexicalNodes: SerializedLexicalNode[];
|
|
40
44
|
overrideAccess: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/converters/html/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;AAEhF,MAAM,MAAM,wBAAwB,GAAG;IACrC,UAAU,EAAE,aAAa,EAAE,CAAA;IAC3B,IAAI,EAAE,qBAAqB,CAAA;IAC3B,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,OAAO,CAAA;IACjB;;;;;OAKG;IACH,GAAG,CAAC,EAAE,IAAI,GAAG,SAAS,CAAA;CACvB,GACD;IACE;;OAEG;IACH,OAAO,CAAC,EAAE,KAAK,CAAA;IACf;;;;;OAKG;IACH,GAAG,EAAE,cAAc,CAAA;CACpB,CACJ,CAAA;AAED,wBAAsB,oBAAoB,CAAC,EACzC,UAAU,EACV,IAAI,EACJ,KAAK,EACL,cAAc,EACd,OAAO,EACP,GAAG,EACH,gBAAgB,GACjB,EAAE,wBAAwB,GAAG,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/converters/html/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;AAEhF,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,OAAO,CAAA;IACjB;;;;;OAKG;IACH,GAAG,CAAC,EAAE,IAAI,GAAG,SAAS,CAAA;CACvB,GACD;IACE;;OAEG;IACH,OAAO,CAAC,EAAE,KAAK,CAAA;IACf;;;;;OAKG;IACH,GAAG,EAAE,cAAc,CAAA;CACpB,CACJ,CAAA;AAED,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,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,cAAc,GAAG,IAAI,CAAA;IAC1B,gBAAgB,EAAE,OAAO,CAAA;CAC1B,GAAG,OAAO,CAAC,MAAM,CAAC,CA8ClB"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { createLocalReq } from 'payload';
|
|
2
2
|
export async function convertLexicalToHTML({
|
|
3
3
|
converters,
|
|
4
|
+
currentDepth,
|
|
4
5
|
data,
|
|
6
|
+
depth,
|
|
5
7
|
draft,
|
|
6
8
|
overrideAccess,
|
|
7
9
|
payload,
|
|
@@ -12,8 +14,16 @@ export async function convertLexicalToHTML({
|
|
|
12
14
|
if (req === undefined && payload) {
|
|
13
15
|
req = await createLocalReq({}, payload);
|
|
14
16
|
}
|
|
17
|
+
if (!currentDepth) {
|
|
18
|
+
currentDepth = 0;
|
|
19
|
+
}
|
|
20
|
+
if (!depth) {
|
|
21
|
+
depth = req?.payload?.config?.defaultDepth;
|
|
22
|
+
}
|
|
15
23
|
return await convertLexicalNodesToHTML({
|
|
16
24
|
converters,
|
|
25
|
+
currentDepth,
|
|
26
|
+
depth,
|
|
17
27
|
draft: draft === undefined ? false : draft,
|
|
18
28
|
lexicalNodes: data?.root?.children,
|
|
19
29
|
overrideAccess: overrideAccess === undefined ? false : overrideAccess,
|
|
@@ -26,6 +36,8 @@ export async function convertLexicalToHTML({
|
|
|
26
36
|
}
|
|
27
37
|
export async function convertLexicalNodesToHTML({
|
|
28
38
|
converters,
|
|
39
|
+
currentDepth,
|
|
40
|
+
depth,
|
|
29
41
|
draft,
|
|
30
42
|
lexicalNodes,
|
|
31
43
|
overrideAccess,
|
|
@@ -42,6 +54,8 @@ export async function convertLexicalNodesToHTML({
|
|
|
42
54
|
return await unknownConverter.converter({
|
|
43
55
|
childIndex: i,
|
|
44
56
|
converters,
|
|
57
|
+
currentDepth,
|
|
58
|
+
depth,
|
|
45
59
|
draft,
|
|
46
60
|
node,
|
|
47
61
|
overrideAccess,
|
|
@@ -55,6 +69,8 @@ export async function convertLexicalNodesToHTML({
|
|
|
55
69
|
return await converterForNode.converter({
|
|
56
70
|
childIndex: i,
|
|
57
71
|
converters,
|
|
72
|
+
currentDepth,
|
|
73
|
+
depth,
|
|
58
74
|
draft,
|
|
59
75
|
node,
|
|
60
76
|
overrideAccess,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["createLocalReq","convertLexicalToHTML","converters","data","draft","overrideAccess","payload","req","showHiddenFields","root","children","length","undefined","convertLexicalNodesToHTML","lexicalNodes","parent","unknownConverter","find","converter","nodeTypes","includes","htmlArray","Promise","all","map","node","i","converterForNode","type","childIndex","error","console","join"],"sources":["../../../../../src/features/converters/html/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\nexport type ConvertLexicalToHTMLArgs = {\n converters: HTMLConverter[]\n data: SerializedEditorState\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?: 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 * 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\nexport async function convertLexicalToHTML({\n converters,\n data,\n draft,\n overrideAccess,\n payload,\n req,\n showHiddenFields,\n}: ConvertLexicalToHTMLArgs): Promise<string> {\n if (data?.root?.children?.length) {\n if (req === undefined && payload) {\n req = await createLocalReq({}, payload)\n }\n\n return await convertLexicalNodesToHTML({\n converters,\n draft: draft === undefined ? false : draft,\n lexicalNodes: data?.root?.children,\n overrideAccess: overrideAccess === undefined ? false : overrideAccess,\n parent: data?.root,\n req,\n showHiddenFields: showHiddenFields === undefined ? false : showHiddenFields,\n })\n }\n return ''\n}\n\nexport async function convertLexicalNodesToHTML({\n converters,\n draft,\n lexicalNodes,\n overrideAccess,\n parent,\n req,\n showHiddenFields,\n}: {\n converters: HTMLConverter[]\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: PayloadRequest | null\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 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 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;
|
|
1
|
+
{"version":3,"file":"index.js","names":["createLocalReq","convertLexicalToHTML","converters","currentDepth","data","depth","draft","overrideAccess","payload","req","showHiddenFields","root","children","length","undefined","config","defaultDepth","convertLexicalNodesToHTML","lexicalNodes","parent","unknownConverter","find","converter","nodeTypes","includes","htmlArray","Promise","all","map","node","i","converterForNode","type","childIndex","error","console","join"],"sources":["../../../../../src/features/converters/html/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\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?: 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 * 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\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 (data?.root?.children?.length) {\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,\n draft: draft === undefined ? false : draft,\n lexicalNodes: data?.root?.children,\n overrideAccess: overrideAccess === undefined ? false : overrideAccess,\n parent: data?.root,\n req,\n showHiddenFields: showHiddenFields === undefined ? false : showHiddenFields,\n })\n }\n return ''\n}\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: PayloadRequest | null\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;AAyC/B,OAAO,eAAeC,qBAAqB;EACzCC,UAAU;EACVC,YAAY;EACZC,IAAI;EACJC,KAAK;EACLC,KAAK;EACLC,cAAc;EACdC,OAAO;EACPC,GAAG;EACHC;AAAgB,CACS;EACzB,IAAIN,IAAA,EAAMO,IAAA,EAAMC,QAAA,EAAUC,MAAA,EAAQ;IAChC,IAAIJ,GAAA,KAAQK,SAAA,IAAaN,OAAA,EAAS;MAChCC,GAAA,GAAM,MAAMT,cAAA,CAAe,CAAC,GAAGQ,OAAA;IACjC;IAEA,IAAI,CAACL,YAAA,EAAc;MACjBA,YAAA,GAAe;IACjB;IAEA,IAAI,CAACE,KAAA,EAAO;MACVA,KAAA,GAAQI,GAAA,EAAKD,OAAA,EAASO,MAAA,EAAQC,YAAA;IAChC;IAEA,OAAO,MAAMC,yBAAA,CAA0B;MACrCf,UAAA;MACAC,YAAA;MACAE,KAAA;MACAC,KAAA,EAAOA,KAAA,KAAUQ,SAAA,GAAY,QAAQR,KAAA;MACrCY,YAAA,EAAcd,IAAA,EAAMO,IAAA,EAAMC,QAAA;MAC1BL,cAAA,EAAgBA,cAAA,KAAmBO,SAAA,GAAY,QAAQP,cAAA;MACvDY,MAAA,EAAQf,IAAA,EAAMO,IAAA;MACdF,GAAA;MACAC,g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+1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/features/converters/html/converter/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE7C,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,qBAAqB,GAAG,qBAAqB,IAAI;IACnF,SAAS,EAAE,CAAC,IAAI,EAAE;QAChB,UAAU,EAAE,MAAM,CAAA;QAClB,UAAU,EAAE,aAAa,CAAC,GAAG,CAAC,EAAE,CAAA;QAChC,KAAK,EAAE,OAAO,CAAA;QACd,IAAI,EAAE,CAAC,CAAA;QACP,cAAc,EAAE,OAAO,CAAA;QACvB,MAAM,EAAE,+BAA+B,CAAA;QACvC;;WAEG;QACH,GAAG,EAAE,cAAc,GAAG,IAAI,CAAA;QAC1B,gBAAgB,EAAE,OAAO,CAAA;KAC1B,KAAK,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAA;IAC9B,SAAS,EAAE,MAAM,EAAE,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,+BAA+B,GAAG;IAC5C,MAAM,CAAC,EAAE,qBAAqB,CAAA;CAC/B,GAAG,qBAAqB,CAAA"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/features/converters/html/converter/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE7C,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,qBAAqB,GAAG,qBAAqB,IAAI;IACnF,SAAS,EAAE,CAAC,IAAI,EAAE;QAChB,UAAU,EAAE,MAAM,CAAA;QAClB,UAAU,EAAE,aAAa,CAAC,GAAG,CAAC,EAAE,CAAA;QAChC,YAAY,EAAE,MAAM,CAAA;QACpB,KAAK,EAAE,MAAM,CAAA;QACb,KAAK,EAAE,OAAO,CAAA;QACd,IAAI,EAAE,CAAC,CAAA;QACP,cAAc,EAAE,OAAO,CAAA;QACvB,MAAM,EAAE,+BAA+B,CAAA;QACvC;;WAEG;QACH,GAAG,EAAE,cAAc,GAAG,IAAI,CAAA;QAC1B,gBAAgB,EAAE,OAAO,CAAA;KAC1B,KAAK,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAA;IAC9B,SAAS,EAAE,MAAM,EAAE,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,+BAA+B,GAAG;IAC5C,MAAM,CAAC,EAAE,qBAAqB,CAAA;CAC/B,GAAG,qBAAqB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../../../src/features/converters/html/converter/types.ts"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\nimport type { PayloadRequest } from 'payload'\n\nexport type HTMLConverter<T extends SerializedLexicalNode = SerializedLexicalNode> = {\n converter: (args: {\n childIndex: number\n converters: HTMLConverter<any>[]\n draft: boolean\n node: T\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: PayloadRequest | null\n showHiddenFields: boolean\n }) => Promise<string> | string\n nodeTypes: string[]\n}\n\nexport type SerializedLexicalNodeWithParent = {\n parent?: SerializedLexicalNode\n} & SerializedLexicalNode\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../../../src/features/converters/html/converter/types.ts"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\nimport type { PayloadRequest } from 'payload'\n\nexport type HTMLConverter<T extends SerializedLexicalNode = SerializedLexicalNode> = {\n converter: (args: {\n childIndex: number\n converters: HTMLConverter<any>[]\n currentDepth: number\n depth: number\n draft: boolean\n node: T\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: PayloadRequest | null\n showHiddenFields: boolean\n }) => Promise<string> | string\n nodeTypes: string[]\n}\n\nexport type SerializedLexicalNodeWithParent = {\n parent?: SerializedLexicalNode\n} & SerializedLexicalNode\n"],"mappings":"AAsBA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/converters/html/field/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAqC,MAAM,SAAS,CAAA;AAEvE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAA;AAEtF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAM1D,KAAK,KAAK,GAAG;IACX;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,sBAEnC;IACD,YAAY,EAAE,2BAA2B,CAAA;CAC1C,KAAG,aAAa,EA+ChB,CAAA;AA0DD,eAAO,MAAM,WAAW,EAAE;AACxB;;;;IAII;AACJ,gBAAgB,EAAE,MAAM,EACxB,KAAK,EAAE,KAAK,KACT,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/converters/html/field/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAqC,MAAM,SAAS,CAAA;AAEvE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAA;AAEtF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAM1D,KAAK,KAAK,GAAG;IACX;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,sBAEnC;IACD,YAAY,EAAE,2BAA2B,CAAA;CAC1C,KAAG,aAAa,EA+ChB,CAAA;AA0DD,eAAO,MAAM,WAAW,EAAE;AACxB;;;;IAII;AACJ,gBAAgB,EAAE,MAAM,EACxB,KAAK,EAAE,KAAK,KACT,KA6FJ,CAAA"}
|
|
@@ -95,6 +95,8 @@ export const lexicalHTML = (lexicalFieldName, props) => {
|
|
|
95
95
|
hooks: {
|
|
96
96
|
afterRead: [async ({
|
|
97
97
|
collection,
|
|
98
|
+
currentDepth,
|
|
99
|
+
depth,
|
|
98
100
|
draft,
|
|
99
101
|
field,
|
|
100
102
|
global,
|
|
@@ -129,7 +131,9 @@ export const lexicalHTML = (lexicalFieldName, props) => {
|
|
|
129
131
|
});
|
|
130
132
|
return await convertLexicalToHTML({
|
|
131
133
|
converters: finalConverters,
|
|
134
|
+
currentDepth,
|
|
132
135
|
data: lexicalFieldData,
|
|
136
|
+
depth,
|
|
133
137
|
draft,
|
|
134
138
|
overrideAccess,
|
|
135
139
|
req,
|
|
@@ -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","findFieldPathAndSiblingFields","fields","path","field","curField","name","siblingFields","result","tab","tabs","block","blocks","slug","lexicalHTML","lexicalFieldName","props","hidden","storeInDB","type","admin","editorOptions","language","hooks","afterRead","collection","draft","global","overrideAccess","req","showHiddenFields","siblingData","foundSiblingFields","Error","lexicalField","find","lexicalFieldData","config","editor","has","data","beforeChange","value"],"sources":["../../../../../src/features/converters/html/field/index.ts"],"sourcesContent":["import type { SerializedEditorState } from 'lexical'\nimport type { Field, FieldAffectingData, 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 Props = {\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 * @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// find the path of this field, as well as its sibling fields, by looking for this `field` in fields and traversing it recursively\nfunction findFieldPathAndSiblingFields(\n fields: Field[],\n path: string[],\n field: FieldAffectingData,\n): {\n path: string[]\n siblingFields: Field[]\n} {\n for (const curField of fields) {\n if (curField === field) {\n return {\n path: [...path, curField.name],\n siblingFields: fields,\n }\n }\n\n if ('fields' in curField) {\n const result = findFieldPathAndSiblingFields(\n curField.fields,\n 'name' in curField ? [...path, curField.name] : [...path],\n field,\n )\n if (result) {\n return result\n }\n } else if ('tabs' in curField) {\n for (const tab of curField.tabs) {\n const result = findFieldPathAndSiblingFields(\n tab.fields,\n 'name' in tab ? [...path, tab.name] : [...path],\n field,\n )\n if (result) {\n return result\n }\n }\n } else if ('blocks' in curField) {\n for (const block of curField.blocks) {\n if (block?.fields?.length) {\n const result = findFieldPathAndSiblingFields(\n block.fields,\n [...path, curField.name, block.slug],\n field,\n )\n if (result) {\n return result\n }\n }\n }\n }\n }\n\n return null\n}\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 props: Props,\n) => Field = (lexicalFieldName, props) => {\n const { name = 'lexicalHTML', hidden = true, storeInDB = false } = props\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 collection,\n draft,\n field,\n global,\n overrideAccess,\n req,\n showHiddenFields,\n siblingData,\n }) => {\n const fields = collection ? collection.fields : global.fields\n\n const foundSiblingFields = findFieldPathAndSiblingFields(fields, [], field)\n\n if (!foundSiblingFields)\n throw new Error(\n `Could not find sibling fields of current lexicalHTML field with name ${field?.name}`,\n )\n\n const { siblingFields } = foundSiblingFields\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 data: lexicalFieldData,\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;;;;;AAKA,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,QAA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MAAK,CAAE;QACrB,IAAIxB,SAAA,EAAW;UACb,OAAOwB,KAAA;QACT;QACA,OAAOX,WAAW,CAACzB,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","findFieldPathAndSiblingFields","fields","path","field","curField","name","siblingFields","result","tab","tabs","block","blocks","slug","lexicalHTML","lexicalFieldName","props","hidden","storeInDB","type","admin","editorOptions","language","hooks","afterRead","collection","currentDepth","depth","draft","global","overrideAccess","req","showHiddenFields","siblingData","foundSiblingFields","Error","lexicalField","find","lexicalFieldData","config","editor","has","data","beforeChange","value"],"sources":["../../../../../src/features/converters/html/field/index.ts"],"sourcesContent":["import type { SerializedEditorState } from 'lexical'\nimport type { Field, FieldAffectingData, 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 Props = {\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 * @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// find the path of this field, as well as its sibling fields, by looking for this `field` in fields and traversing it recursively\nfunction findFieldPathAndSiblingFields(\n fields: Field[],\n path: string[],\n field: FieldAffectingData,\n): {\n path: string[]\n siblingFields: Field[]\n} {\n for (const curField of fields) {\n if (curField === field) {\n return {\n path: [...path, curField.name],\n siblingFields: fields,\n }\n }\n\n if ('fields' in curField) {\n const result = findFieldPathAndSiblingFields(\n curField.fields,\n 'name' in curField ? [...path, curField.name] : [...path],\n field,\n )\n if (result) {\n return result\n }\n } else if ('tabs' in curField) {\n for (const tab of curField.tabs) {\n const result = findFieldPathAndSiblingFields(\n tab.fields,\n 'name' in tab ? [...path, tab.name] : [...path],\n field,\n )\n if (result) {\n return result\n }\n }\n } else if ('blocks' in curField) {\n for (const block of curField.blocks) {\n if (block?.fields?.length) {\n const result = findFieldPathAndSiblingFields(\n block.fields,\n [...path, curField.name, block.slug],\n field,\n )\n if (result) {\n return result\n }\n }\n }\n }\n }\n\n return null\n}\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 props: Props,\n) => Field = (lexicalFieldName, props) => {\n const { name = 'lexicalHTML', hidden = true, storeInDB = false } = props\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 collection,\n currentDepth,\n depth,\n draft,\n field,\n global,\n overrideAccess,\n req,\n showHiddenFields,\n siblingData,\n }) => {\n const fields = collection ? collection.fields : global.fields\n\n const foundSiblingFields = findFieldPathAndSiblingFields(fields, [], field)\n\n if (!foundSiblingFields)\n throw new Error(\n `Could not find sibling fields of current lexicalHTML field with name ${field?.name}`,\n )\n\n const { siblingFields } = foundSiblingFields\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;;;;;AAKA,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,SAAA;EACnD;EAEA,MAAMK,eAAA,GACJR,yBAAA,EAA2BK,UAAA,IAC3B,OAAOL,yBAAA,EAA2BK,UAAA,KAAe,aAC7CL,yBAAA,CAA0BK,UAAU,CAAC;IACnCI,iBAAA,EAAmBP;EACrB,KACAF,yBAAC,EAA2BK,UAAA,IAC5BH,2CAAA;EAEN;EACA;EACA;EACA,MAAMQ,cAAA,GAA2B,EAAE;EACnC,MAAMC,kBAAA,GAAsC,EAAE;EAC9C,KAAK,MAAMR,SAAA,IAAaK,eAAA,CAAgBI,OAAO,IAAI;IACjD,IAAI,CAACT,SAAA,CAAUU,SAAS,EAAEC,MAAA,EAAQ;MAChC;IACF;IACA,MAAMC,YAAA,GAA8B;MAClCZ,SAAA,EAAWA,SAAA,CAAUA,SA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,KAAKS,gBAAA;QAGjD,MAAMuB,gBAAA,GAA0CL,WAAW,CAAClB,gBAAA,CAAiB;QAE7E,IAAI,CAACuB,gBAAA,EAAkB;UACrB,OAAO;QACT;QAEA,IAAI,CAACF,YAAA,EAAc;UACjB,MAAM,IAAID,KAAA,CACR;QAEJ;QAEA,MAAMI,MAAA,GAAUH,YAAA,EAAcI,MAAA,EAAmC9D,YAAA;QAEjE,IAAI,CAAC6D,MAAA,EAAQ;UACX,MAAM,IAAIJ,KAAA,CACR;QAEJ;QAEA,IAAI,CAACI,MAAA,EAAQ3D,kBAAA,EAAoB6D,GAAA,CAAI,kBAAkB;UACrD,MAAM,IAAIN,KAAA,CACR;QAEJ;QAEA,MAAM7C,eAAA,GAAkBb,yBAAA,CAA0B;UAChDC,YAAA,EAAc6D;QAChB;QAEA,OAAO,MAAM/D,oBAAA,CAAqB;UAChCW,UAAA,EAAYG,eAAA;UACZoC,YAAA;UACAgB,IAAA,EAAMJ,gBAAA;UACNX,KAAA;UACAC,KAAA;UACAE,cAAA;UACAC,GAAA;UACAC;QACF;MACF,EACD;MACDW,YAAA,EAAc,CACZ,CAAC;QAAEV,WAAW;QAAEW;MAAK,CAAE;QACrB,IAAI1B,SAAA,EAAW;UACb,OAAO0B,KAAA;QACT;QACA,OAAOX,WAAW,CAAC3B,IAAA,CAAK;QACxB,OAAO;MACT;IAEJ;EACF;AACF","ignoreList":[]}
|
|
@@ -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;AAyBrC,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,+
|
|
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;AAyBrC,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,+FA0IpC,CAAA"}
|
|
@@ -38,6 +38,8 @@ export const EXPERIMENTAL_TableFeature = createServerFeature({
|
|
|
38
38
|
html: {
|
|
39
39
|
converter: async ({
|
|
40
40
|
converters,
|
|
41
|
+
currentDepth,
|
|
42
|
+
depth,
|
|
41
43
|
draft,
|
|
42
44
|
node,
|
|
43
45
|
overrideAccess,
|
|
@@ -47,6 +49,8 @@ export const EXPERIMENTAL_TableFeature = createServerFeature({
|
|
|
47
49
|
}) => {
|
|
48
50
|
const childrenText = await convertLexicalNodesToHTML({
|
|
49
51
|
converters,
|
|
52
|
+
currentDepth,
|
|
53
|
+
depth,
|
|
50
54
|
draft,
|
|
51
55
|
lexicalNodes: node.children,
|
|
52
56
|
overrideAccess,
|
|
@@ -68,6 +72,8 @@ export const EXPERIMENTAL_TableFeature = createServerFeature({
|
|
|
68
72
|
html: {
|
|
69
73
|
converter: async ({
|
|
70
74
|
converters,
|
|
75
|
+
currentDepth,
|
|
76
|
+
depth,
|
|
71
77
|
draft,
|
|
72
78
|
node,
|
|
73
79
|
overrideAccess,
|
|
@@ -77,6 +83,8 @@ export const EXPERIMENTAL_TableFeature = createServerFeature({
|
|
|
77
83
|
}) => {
|
|
78
84
|
const childrenText = await convertLexicalNodesToHTML({
|
|
79
85
|
converters,
|
|
86
|
+
currentDepth,
|
|
87
|
+
depth,
|
|
80
88
|
draft,
|
|
81
89
|
lexicalNodes: node.children,
|
|
82
90
|
overrideAccess,
|
|
@@ -103,6 +111,8 @@ export const EXPERIMENTAL_TableFeature = createServerFeature({
|
|
|
103
111
|
html: {
|
|
104
112
|
converter: async ({
|
|
105
113
|
converters,
|
|
114
|
+
currentDepth,
|
|
115
|
+
depth,
|
|
106
116
|
draft,
|
|
107
117
|
node,
|
|
108
118
|
overrideAccess,
|
|
@@ -112,6 +122,8 @@ export const EXPERIMENTAL_TableFeature = createServerFeature({
|
|
|
112
122
|
}) => {
|
|
113
123
|
const childrenText = await convertLexicalNodesToHTML({
|
|
114
124
|
converters,
|
|
125
|
+
currentDepth,
|
|
126
|
+
depth,
|
|
115
127
|
draft,
|
|
116
128
|
lexicalNodes: node.children,
|
|
117
129
|
overrideAccess,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["TableCellNode","TableNode","TableRowNode","sanitizeFields","createServerFeature","convertLexicalNodesToHTML","createNode","fields","name","type","defaultValue","required","EXPERIMENTAL_TableFeature","feature","config","isRoot","validRelationships","collections","map","c","slug","sanitizedFields","requireFieldLevelRichTextEditor","ClientFeature","generateSchemaMap","schemaMap","Map","set","nodes","converters","html","converter","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 } 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/html/converter/index.js'\nimport { createNode } from '../../typeUtilities.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 }) => {\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 requireFieldLevelRichTextEditor: isRoot,\n validRelationships,\n })\n return {\n ClientFeature: '@payloadcms/richtext-lexical/client#TableFeatureClient',\n generateSchemaMap: () => {\n const schemaMap = new Map<string, Field[]>()\n\n schemaMap.set('fields', sanitizedFields)\n\n return schemaMap\n },\n nodes: [\n createNode({\n converters: {\n html: {\n converter: async ({\n converters,\n draft,\n node,\n overrideAccess,\n parent,\n req,\n showHiddenFields,\n }) => {\n const childrenText = await convertLexicalNodesToHTML({\n converters,\n draft,\n lexicalNodes: node.children,\n overrideAccess,\n parent: {\n ...node,\n parent,\n },\n req,\n showHiddenFields,\n })\n return `<table class=\"lexical-table\" style=\"border-collapse: collapse;\">${childrenText}</table>`\n },\n nodeTypes: [TableNode.getType()],\n },\n },\n node: TableNode,\n }),\n createNode({\n converters: {\n html: {\n converter: async ({\n converters,\n draft,\n node,\n overrideAccess,\n parent,\n req,\n showHiddenFields,\n }) => {\n const childrenText = await convertLexicalNodesToHTML({\n converters,\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 > 1 ? `colspan=\"${node.colSpan}\"` : ''\n const 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 draft,\n node,\n overrideAccess,\n parent,\n req,\n showHiddenFields,\n }) => {\n const childrenText = await convertLexicalNodesToHTML({\n converters,\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;AAE3B,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,GAA4BR,mBAAA,CAAoB;EAC3DS,OAAA,EAAS,MAAAA,CAAO;IAAEC,MAAM;IAAEC;EAAM,CAAE;IAChC,MAAMC,kBAAA,GAAqBF,MAAA,CAAOG,WAAW,CAACC,GAAG,CAAEC,CAAA,IAAMA,CAAA,CAAEC,IAAI,KAAK,EAAE;IAEtE,MAAMC,eAAA,GAAkB,MAAMlB,cAAA,CAAe;MAC3CW,MAAA,EAAQA,MAAA;MACRP,MAAA;MACAe,+BAAA,EAAiCP,MAAA;MACjCC;IACF;IACA,OAAO;MACLO,aAAA,EAAe;MACfC,iBAAA,EAAmBA,CAAA;QACjB,MAAMC,SAAA,GAAY,IAAIC,GAAA;QAEtBD,SAAA,CAAUE,GAAG,CAAC,UAAUN,eAAA;QAExB,OAAOI,SAAA;MACT;MACAG,KAAA,EAAO,CACLtB,UAAA,CAAW;QACTuB,UAAA,EAAY;UACVC,IAAA,EAAM;YACJC,SAAA,EAAW,MAAAA,CAAO;cAChBF,UAAU;cACVG,KAAK;cACLC,IAAI;cACJC,cAAc;cACdC,MAAM;cACNC,GAAG;cACHC;YAAgB,CACjB;cACC,MAAMC,YAAA,GAAe,
|
|
1
|
+
{"version":3,"file":"index.js","names":["TableCellNode","TableNode","TableRowNode","sanitizeFields","createServerFeature","convertLexicalNodesToHTML","createNode","fields","name","type","defaultValue","required","EXPERIMENTAL_TableFeature","feature","config","isRoot","validRelationships","collections","map","c","slug","sanitizedFields","requireFieldLevelRichTextEditor","ClientFeature","generateSchemaMap","schemaMap","Map","set","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 } 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/html/converter/index.js'\nimport { createNode } from '../../typeUtilities.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 }) => {\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 requireFieldLevelRichTextEditor: isRoot,\n validRelationships,\n })\n return {\n ClientFeature: '@payloadcms/richtext-lexical/client#TableFeatureClient',\n generateSchemaMap: () => {\n const schemaMap = new Map<string, Field[]>()\n\n schemaMap.set('fields', sanitizedFields)\n\n return schemaMap\n },\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 `<table class=\"lexical-table\" style=\"border-collapse: collapse;\">${childrenText}</table>`\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 > 1 ? `colspan=\"${node.colSpan}\"` : ''\n const 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,S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AO;UACnC;QACF;QACAT,IAAA,EAAMnC;MACR,IACAM,UAAA,CAAW;QACTuB,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,MAAMnC,yBAAA,CAA0B;gBACnDwB,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,OAAO,iCAAiCC,YAAA,OAAmB;YAC7D;YACAG,SAAA,EAAW,CAACzC,YAAA,CAAa0C,OAAO;UAClC;QACF;QACAT,IAAA,EAAMjC;MACR;IAEJ;EACF;EACAiD,GAAA,EAAK;AACP","ignoreList":[]}
|
|
@@ -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,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,6HA2DzB,CAAA"}
|
|
@@ -24,6 +24,8 @@ export const HeadingFeature = createServerFeature({
|
|
|
24
24
|
html: {
|
|
25
25
|
converter: async ({
|
|
26
26
|
converters,
|
|
27
|
+
currentDepth,
|
|
28
|
+
depth,
|
|
27
29
|
draft,
|
|
28
30
|
node,
|
|
29
31
|
overrideAccess,
|
|
@@ -33,6 +35,8 @@ export const HeadingFeature = createServerFeature({
|
|
|
33
35
|
}) => {
|
|
34
36
|
const childrenText = await convertLexicalNodesToHTML({
|
|
35
37
|
converters,
|
|
38
|
+
currentDepth,
|
|
39
|
+
depth,
|
|
36
40
|
draft,
|
|
37
41
|
lexicalNodes: node.children,
|
|
38
42
|
overrideAccess,
|
|
@@ -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","draft","node","overrideAccess","parent","req","showHiddenFields","childrenText","lexicalNodes","children","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/html/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 draft,\n node,\n overrideAccess,\n parent,\n req,\n showHiddenFields,\n }) => {\n const childrenText = await convertLexicalNodesToHTML({\n converters,\n draft,\n lexicalNodes: node.children,\n overrideAccess,\n parent: {\n ...node,\n parent,\n },\n req,\n showHiddenFields,\n })\n\n return '<' + node?.tag + '>' + 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,KAAK;cACLC,IAAI;cACJC,cAAc;cACdC,MAAM;cACNC,GAAG;cACHC;YAAgB,CACjB;cACC,MAAMC,YAAA,GAAe,
|
|
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","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/html/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\n return '<' + node?.tag + '>' + 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;cAEA,OAAO,MAAMJ,IAAA,EAAMQ,GAAA,GAAM,MAAMH,YAAA,GAAe,OAAOL,IAAA,EAAMQ,GAAA,GAAM;YACnE;YACAC,SAAA,EAAW,CAAC7B,WAAA,CAAY8B,OAAO;UACjC;QACF;QACAV,IAAA,EAAMpB;MACR,GACD;MACD+B,2BAAA,EAA6BvB;IAC/B;EACF;EACAwB,GAAA,EAAK;AACP","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/link/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAU,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAkBjG,MAAM,MAAM,6BAA6B,GACrC;IACE;;;QAGI;IACJ,mBAAmB,CAAC,EAAE,cAAc,EAAE,CAAA;IAGtC,kBAAkB,CAAC,EAAE,KAAK,CAAA;CAC3B,GACD;IAEE,mBAAmB,CAAC,EAAE,KAAK,CAAA;IAE3B;;;QAGI;IACJ,kBAAkB,CAAC,EAAE,cAAc,EAAE,CAAA;CACtC,CAAA;AAEL,MAAM,MAAM,sBAAsB,GAAG;IACnC;;;OAGG;IACH,MAAM,CAAC,EACH,CAAC,CAAC,IAAI,EAAE;QACN,MAAM,EAAE,eAAe,CAAA;QACvB,aAAa,EAAE,kBAAkB,EAAE,CAAA;KACpC,KAAK,CAAC,KAAK,GAAG,kBAAkB,CAAC,EAAE,CAAC,GACrC,KAAK,EAAE,CAAA;IACX;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,GAAG,6BAA6B,CAAA;AAEjC,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/link/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAU,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAkBjG,MAAM,MAAM,6BAA6B,GACrC;IACE;;;QAGI;IACJ,mBAAmB,CAAC,EAAE,cAAc,EAAE,CAAA;IAGtC,kBAAkB,CAAC,EAAE,KAAK,CAAA;CAC3B,GACD;IAEE,mBAAmB,CAAC,EAAE,KAAK,CAAA;IAE3B;;;QAGI;IACJ,kBAAkB,CAAC,EAAE,cAAc,EAAE,CAAA;CACtC,CAAA;AAEL,MAAM,MAAM,sBAAsB,GAAG;IACnC;;;OAGG;IACH,MAAM,CAAC,EACH,CAAC,CAAC,IAAI,EAAE;QACN,MAAM,EAAE,eAAe,CAAA;QACvB,aAAa,EAAE,kBAAkB,EAAE,CAAA;KACpC,KAAK,CAAC,KAAK,GAAG,kBAAkB,CAAC,EAAE,CAAC,GACrC,KAAK,EAAE,CAAA;IACX;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,GAAG,6BAA6B,CAAA;AAEjC,eAAO,MAAM,WAAW,6IA+JtB,CAAA"}
|
|
@@ -53,6 +53,8 @@ export const LinkFeature = createServerFeature({
|
|
|
53
53
|
html: {
|
|
54
54
|
converter: async ({
|
|
55
55
|
converters,
|
|
56
|
+
currentDepth,
|
|
57
|
+
depth,
|
|
56
58
|
draft,
|
|
57
59
|
node,
|
|
58
60
|
overrideAccess,
|
|
@@ -62,6 +64,8 @@ export const LinkFeature = createServerFeature({
|
|
|
62
64
|
}) => {
|
|
63
65
|
const childrenText = await convertLexicalNodesToHTML({
|
|
64
66
|
converters,
|
|
67
|
+
currentDepth,
|
|
68
|
+
depth,
|
|
65
69
|
draft,
|
|
66
70
|
lexicalNodes: node.children,
|
|
67
71
|
overrideAccess,
|
|
@@ -91,6 +95,8 @@ export const LinkFeature = createServerFeature({
|
|
|
91
95
|
html: {
|
|
92
96
|
converter: async ({
|
|
93
97
|
converters,
|
|
98
|
+
currentDepth,
|
|
99
|
+
depth,
|
|
94
100
|
draft,
|
|
95
101
|
node,
|
|
96
102
|
overrideAccess,
|
|
@@ -100,6 +106,8 @@ export const LinkFeature = createServerFeature({
|
|
|
100
106
|
}) => {
|
|
101
107
|
const childrenText = await convertLexicalNodesToHTML({
|
|
102
108
|
converters,
|
|
109
|
+
currentDepth,
|
|
110
|
+
depth,
|
|
103
111
|
draft,
|
|
104
112
|
lexicalNodes: node.children,
|
|
105
113
|
overrideAccess,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["sanitizeFields","deepCopyObject","createServerFeature","convertLexicalNodesToHTML","createNode","LinkMarkdownTransformer","AutoLinkNode","LinkNode","linkPopulationPromiseHOC","i18n","transformExtraFields","linkValidation","LinkFeature","feature","config","_config","isRoot","props","validRelationships","collections","map","c","slug","_transformedFields","fields","enabledCollections","disabledCollections","maxDepth","sanitizedFields","requireFieldLevelRichTextEditor","sanitizedFieldsWithoutText","filter","field","name","ClientFeature","clientFeatureProps","generateSchemaMap","Array","isArray","length","schemaMap","Map","set","markdownTransformers","nodes","converters","html","converter","draft","node","overrideAccess","parent","req","showHiddenFields","childrenText","lexicalNodes","children","rel","newTab","target","href","url","linkType","doc","value","id","nodeTypes","getType","validations","getSubFields","getSubFieldsData","graphQLPopulationPromises","sanitizedServerFeatureProps","key"],"sources":["../../../../src/features/link/server/index.ts"],"sourcesContent":["import type { CollectionSlug, Config, Field, FieldAffectingData, SanitizedConfig } from 'payload'\n\nimport { sanitizeFields } from 'payload'\nimport { deepCopyObject } from 'payload/shared'\n\nimport type { ClientProps } from '../client/index.js'\n\nimport { createServerFeature } from '../../../utilities/createServerFeature.js'\nimport { convertLexicalNodesToHTML } from '../../converters/html/converter/index.js'\nimport { createNode } from '../../typeUtilities.js'\nimport { LinkMarkdownTransformer } from '../markdownTransformer.js'\nimport { AutoLinkNode } from '../nodes/AutoLinkNode.js'\nimport { LinkNode } from '../nodes/LinkNode.js'\nimport { linkPopulationPromiseHOC } from './graphQLPopulationPromise.js'\nimport { i18n } from './i18n.js'\nimport { transformExtraFields } from './transformExtraFields.js'\nimport { linkValidation } from './validate.js'\n\nexport type ExclusiveLinkCollectionsProps =\n | {\n /**\n * The collections that should be disabled for internal linking. Overrides the `enableRichTextLink` property in the collection config.\n * When this property is set, `enabledCollections` will not be available.\n **/\n disabledCollections?: CollectionSlug[]\n\n // Ensures that enabledCollections is not available when disabledCollections is set\n enabledCollections?: never\n }\n | {\n // Ensures that disabledCollections is not available when enabledCollections is set\n disabledCollections?: never\n\n /**\n * The collections that should be enabled for internal linking. Overrides the `enableRichTextLink` property in the collection config\n * When this property is set, `disabledCollections` will not be available.\n **/\n enabledCollections?: CollectionSlug[]\n }\n\nexport type LinkFeatureServerProps = {\n /**\n * A function or array defining additional fields for the link feature. These will be\n * displayed in the link editor drawer.\n */\n fields?:\n | ((args: {\n config: SanitizedConfig\n defaultFields: FieldAffectingData[]\n }) => (Field | FieldAffectingData)[])\n | Field[]\n /**\n * Sets a maximum population depth for the internal doc default field of link, regardless of the remaining depth when the field is reached.\n * This behaves exactly like the maxDepth properties of relationship and upload fields.\n *\n * {@link https://payloadcms.com/docs/getting-started/concepts#field-level-max-depth}\n */\n maxDepth?: number\n} & ExclusiveLinkCollectionsProps\n\nexport const LinkFeature = createServerFeature<\n LinkFeatureServerProps,\n LinkFeatureServerProps,\n ClientProps\n>({\n feature: async ({ config: _config, isRoot, props }) => {\n if (!props) {\n props = {}\n }\n const validRelationships = _config.collections.map((c) => c.slug) || []\n\n const _transformedFields = transformExtraFields(\n deepCopyObject(props.fields),\n _config,\n props.enabledCollections,\n props.disabledCollections,\n props.maxDepth,\n )\n\n const sanitizedFields = await sanitizeFields({\n config: _config as unknown as Config,\n fields: _transformedFields,\n requireFieldLevelRichTextEditor: isRoot,\n validRelationships,\n })\n props.fields = sanitizedFields\n\n // the text field is not included in the node data.\n // Thus, for tasks like validation, we do not want to pass it a text field in the schema which will never have data.\n // Otherwise, it will cause a validation error (field is required).\n const sanitizedFieldsWithoutText = deepCopyObject(sanitizedFields).filter(\n (field) => !('name' in field) || field.name !== 'text',\n )\n\n return {\n ClientFeature: '@payloadcms/richtext-lexical/client#LinkFeatureClient',\n clientFeatureProps: {\n disabledCollections: props.disabledCollections,\n enabledCollections: props.enabledCollections,\n } as ExclusiveLinkCollectionsProps,\n generateSchemaMap: () => {\n if (!sanitizedFields || !Array.isArray(sanitizedFields) || sanitizedFields.length === 0) {\n return null\n }\n\n const schemaMap = new Map<string, Field[]>()\n schemaMap.set('fields', sanitizedFields)\n\n return schemaMap\n },\n i18n,\n markdownTransformers: [LinkMarkdownTransformer],\n nodes: [\n createNode({\n converters: {\n html: {\n converter: async ({\n converters,\n draft,\n node,\n overrideAccess,\n parent,\n req,\n showHiddenFields,\n }) => {\n const childrenText = await convertLexicalNodesToHTML({\n converters,\n draft,\n lexicalNodes: node.children,\n overrideAccess,\n parent: {\n ...node,\n parent,\n },\n req,\n showHiddenFields,\n })\n\n const rel: string = node.fields.newTab ? ' rel=\"noopener noreferrer\"' : ''\n const target: string = node.fields.newTab ? ' target=\"_blank\"' : ''\n\n let href: string = node.fields.url\n if (node.fields.linkType === 'internal') {\n href =\n typeof node.fields.doc?.value === 'string'\n ? node.fields.doc?.value\n : node.fields.doc?.value?.id\n }\n\n return `<a href=\"${href}\"${target}${rel}>${childrenText}</a>`\n },\n nodeTypes: [AutoLinkNode.getType()],\n },\n },\n node: AutoLinkNode,\n // Since AutoLinkNodes are just internal links, they need no hooks or graphQL population promises\n validations: [linkValidation(props, sanitizedFieldsWithoutText)],\n }),\n createNode({\n converters: {\n html: {\n converter: async ({\n converters,\n draft,\n node,\n overrideAccess,\n parent,\n req,\n showHiddenFields,\n }) => {\n const childrenText = await convertLexicalNodesToHTML({\n converters,\n draft,\n lexicalNodes: node.children,\n overrideAccess,\n parent: {\n ...node,\n parent,\n },\n req,\n showHiddenFields,\n })\n\n const rel: string = node.fields.newTab ? ' rel=\"noopener noreferrer\"' : ''\n const target: string = node.fields.newTab ? ' target=\"_blank\"' : ''\n\n const href: string =\n node.fields.linkType === 'custom'\n ? node.fields.url\n : (node.fields.doc?.value as string)\n\n return `<a href=\"${href}\"${target}${rel}>${childrenText}</a>`\n },\n nodeTypes: [LinkNode.getType()],\n },\n },\n getSubFields: () => {\n return sanitizedFieldsWithoutText\n },\n getSubFieldsData: ({ node }) => {\n return node?.fields\n },\n graphQLPopulationPromises: [linkPopulationPromiseHOC(props)],\n node: LinkNode,\n validations: [linkValidation(props, sanitizedFieldsWithoutText)],\n }),\n ],\n sanitizedServerFeatureProps: props,\n }\n },\n key: 'link',\n})\n"],"mappings":"AAEA,SAASA,cAAc,QAAQ;AAC/B,SAASC,cAAc,QAAQ;AAI/B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,UAAU,QAAQ;AAC3B,SAASC,uBAAuB,QAAQ;AACxC,SAASC,YAAY,QAAQ;AAC7B,SAASC,QAAQ,QAAQ;AACzB,SAASC,wBAAwB,QAAQ;AACzC,SAASC,IAAI,QAAQ;AACrB,SAASC,oBAAoB,QAAQ;AACrC,SAASC,cAAc,QAAQ;AA4C/B,OAAO,MAAMC,WAAA,GAAcV,mBAAA,CAIzB;EACAW,OAAA,EAAS,MAAAA,CAAO;IAAEC,MAAA,EAAQC,OAAO;IAAEC,MAAM;IAAEC;EAAK,CAAE;IAChD,IAAI,CAACA,KAAA,EAAO;MACVA,KAAA,GAAQ,CAAC;IACX;IACA,MAAMC,kBAAA,GAAqBH,OAAA,CAAQI,WAAW,CAACC,GAAG,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BACAC,MAAA,EAAQ;kBACN,GAAGF,IAAI;kBACPE;gBACF;gBACAC,GAAA;gBACAC;cACF;cAEA,MAAMI,GAAA,GAAcR,IAAA,CAAKzB,MAAM,CAACkC,MAAM,GAAG,+BAA+B;cACxE,MAAMC,MAAA,GAAiBV,IAAA,CAAKzB,MAAM,CAACkC,MAAM,GAAG,qBAAqB;cAEjE,MAAME,IAAA,GACJX,IAAA,CAAKzB,MAAM,CAACsC,QAAQ,KAAK,WACrBb,IAAA,CAAKzB,MAAM,CAACqC,GAAG,GACdZ,IAAA,CAAKzB,MAAM,CAACuC,GAAG,EAAEC,KAAA;cAExB,OAAO,YAAYJ,IAAA,IAAQD,MAAA,GAASF,GAAA,IAAOH,YAAA,MAAkB;YAC/D;YACAY,SAAA,EAAW,CAAC3D,QAAA,CAAS4D,OAAO;UAC9B;QACF;QACAE,YAAA,EAAcA,CAAA;UACZ,OAAOvC,0BAAA;QACT;QACAwC,gBAAA,EAAkBA,CAAC;UAAErB;QAAI,CAAE;UACzB,OAAOA,IAAA,EAAMzB,MAAA;QACf;QACA+C,yBAAA,EAA2B,CAAC/D,wBAAA,CAAyBS,KAAA,EAAO;QAC5DgC,IAAA,EAAM1C,QAAA;QACN6D,WAAA,EAAa,CAACzD,cAAA,CAAeM,KAAA,EAAOa,0BAAA;MACtC,GACD;MACD0C,2BAAA,EAA6BvD;IAC/B;EACF;EACAwD,GAAA,EAAK;AACP","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["sanitizeFields","deepCopyObject","createServerFeature","convertLexicalNodesToHTML","createNode","LinkMarkdownTransformer","AutoLinkNode","LinkNode","linkPopulationPromiseHOC","i18n","transformExtraFields","linkValidation","LinkFeature","feature","config","_config","isRoot","props","validRelationships","collections","map","c","slug","_transformedFields","fields","enabledCollections","disabledCollections","maxDepth","sanitizedFields","requireFieldLevelRichTextEditor","sanitizedFieldsWithoutText","filter","field","name","ClientFeature","clientFeatureProps","generateSchemaMap","Array","isArray","length","schemaMap","Map","set","markdownTransformers","nodes","converters","html","converter","currentDepth","depth","draft","node","overrideAccess","parent","req","showHiddenFields","childrenText","lexicalNodes","children","rel","newTab","target","href","url","linkType","doc","value","id","nodeTypes","getType","validations","getSubFields","getSubFieldsData","graphQLPopulationPromises","sanitizedServerFeatureProps","key"],"sources":["../../../../src/features/link/server/index.ts"],"sourcesContent":["import type { CollectionSlug, Config, Field, FieldAffectingData, SanitizedConfig } from 'payload'\n\nimport { sanitizeFields } from 'payload'\nimport { deepCopyObject } from 'payload/shared'\n\nimport type { ClientProps } from '../client/index.js'\n\nimport { createServerFeature } from '../../../utilities/createServerFeature.js'\nimport { convertLexicalNodesToHTML } from '../../converters/html/converter/index.js'\nimport { createNode } from '../../typeUtilities.js'\nimport { LinkMarkdownTransformer } from '../markdownTransformer.js'\nimport { AutoLinkNode } from '../nodes/AutoLinkNode.js'\nimport { LinkNode } from '../nodes/LinkNode.js'\nimport { linkPopulationPromiseHOC } from './graphQLPopulationPromise.js'\nimport { i18n } from './i18n.js'\nimport { transformExtraFields } from './transformExtraFields.js'\nimport { linkValidation } from './validate.js'\n\nexport type ExclusiveLinkCollectionsProps =\n | {\n /**\n * The collections that should be disabled for internal linking. Overrides the `enableRichTextLink` property in the collection config.\n * When this property is set, `enabledCollections` will not be available.\n **/\n disabledCollections?: CollectionSlug[]\n\n // Ensures that enabledCollections is not available when disabledCollections is set\n enabledCollections?: never\n }\n | {\n // Ensures that disabledCollections is not available when enabledCollections is set\n disabledCollections?: never\n\n /**\n * The collections that should be enabled for internal linking. Overrides the `enableRichTextLink` property in the collection config\n * When this property is set, `disabledCollections` will not be available.\n **/\n enabledCollections?: CollectionSlug[]\n }\n\nexport type LinkFeatureServerProps = {\n /**\n * A function or array defining additional fields for the link feature. These will be\n * displayed in the link editor drawer.\n */\n fields?:\n | ((args: {\n config: SanitizedConfig\n defaultFields: FieldAffectingData[]\n }) => (Field | FieldAffectingData)[])\n | Field[]\n /**\n * Sets a maximum population depth for the internal doc default field of link, regardless of the remaining depth when the field is reached.\n * This behaves exactly like the maxDepth properties of relationship and upload fields.\n *\n * {@link https://payloadcms.com/docs/getting-started/concepts#field-level-max-depth}\n */\n maxDepth?: number\n} & ExclusiveLinkCollectionsProps\n\nexport const LinkFeature = createServerFeature<\n LinkFeatureServerProps,\n LinkFeatureServerProps,\n ClientProps\n>({\n feature: async ({ config: _config, isRoot, props }) => {\n if (!props) {\n props = {}\n }\n const validRelationships = _config.collections.map((c) => c.slug) || []\n\n const _transformedFields = transformExtraFields(\n deepCopyObject(props.fields),\n _config,\n props.enabledCollections,\n props.disabledCollections,\n props.maxDepth,\n )\n\n const sanitizedFields = await sanitizeFields({\n config: _config as unknown as Config,\n fields: _transformedFields,\n requireFieldLevelRichTextEditor: isRoot,\n validRelationships,\n })\n props.fields = sanitizedFields\n\n // the text field is not included in the node data.\n // Thus, for tasks like validation, we do not want to pass it a text field in the schema which will never have data.\n // Otherwise, it will cause a validation error (field is required).\n const sanitizedFieldsWithoutText = deepCopyObject(sanitizedFields).filter(\n (field) => !('name' in field) || field.name !== 'text',\n )\n\n return {\n ClientFeature: '@payloadcms/richtext-lexical/client#LinkFeatureClient',\n clientFeatureProps: {\n disabledCollections: props.disabledCollections,\n enabledCollections: props.enabledCollections,\n } as ExclusiveLinkCollectionsProps,\n generateSchemaMap: () => {\n if (!sanitizedFields || !Array.isArray(sanitizedFields) || sanitizedFields.length === 0) {\n return null\n }\n\n const schemaMap = new Map<string, Field[]>()\n schemaMap.set('fields', sanitizedFields)\n\n return schemaMap\n },\n i18n,\n markdownTransformers: [LinkMarkdownTransformer],\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\n const rel: string = node.fields.newTab ? ' rel=\"noopener noreferrer\"' : ''\n const target: string = node.fields.newTab ? ' target=\"_blank\"' : ''\n\n let href: string = node.fields.url\n if (node.fields.linkType === 'internal') {\n href =\n typeof node.fields.doc?.value === 'string'\n ? node.fields.doc?.value\n : node.fields.doc?.value?.id\n }\n\n return `<a href=\"${href}\"${target}${rel}>${childrenText}</a>`\n },\n nodeTypes: [AutoLinkNode.getType()],\n },\n },\n node: AutoLinkNode,\n // Since AutoLinkNodes are just internal links, they need no hooks or graphQL population promises\n validations: [linkValidation(props, sanitizedFieldsWithoutText)],\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 rel: string = node.fields.newTab ? ' rel=\"noopener noreferrer\"' : ''\n const target: string = node.fields.newTab ? ' target=\"_blank\"' : ''\n\n const href: string =\n node.fields.linkType === 'custom'\n ? node.fields.url\n : (node.fields.doc?.value as string)\n\n return `<a href=\"${href}\"${target}${rel}>${childrenText}</a>`\n },\n nodeTypes: [LinkNode.getType()],\n },\n },\n getSubFields: () => {\n return sanitizedFieldsWithoutText\n },\n getSubFieldsData: ({ node }) => {\n return node?.fields\n },\n graphQLPopulationPromises: [linkPopulationPromiseHOC(props)],\n node: LinkNode,\n validations: [linkValidation(props, sanitizedFieldsWithoutText)],\n }),\n ],\n sanitizedServerFeatureProps: props,\n }\n },\n key: 'link',\n})\n"],"mappings":"AAEA,SAASA,cAAc,QAAQ;AAC/B,SAASC,cAAc,QAAQ;AAI/B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,UAAU,QAAQ;AAC3B,SAASC,uBAAuB,QAAQ;AACxC,SAASC,YAA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