@payloadcms/richtext-lexical 3.69.0-canary.0 → 3.69.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rscEntry.d.ts","sourceRoot":"","sources":["../../src/cell/rscEntry.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AAuB3D,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,
|
|
1
|
+
{"version":3,"file":"rscEntry.d.ts","sourceRoot":"","sources":["../../src/cell/rscEntry.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AAuB3D,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CA4ElE,CAAA"}
|
package/dist/cell/rscEntry.js
CHANGED
|
@@ -39,6 +39,7 @@ export const RscEntryLexicalCell = props => {
|
|
|
39
39
|
const classNameFromConfigContext = admin && 'className' in admin ? admin.className : undefined;
|
|
40
40
|
const className = classNameFromProps || (field.admin && 'className' in field.admin ? field.admin.className : null) || classNameFromConfigContext;
|
|
41
41
|
const adminRoute = payload.config.routes.admin;
|
|
42
|
+
const serverURL = payload.config.serverURL;
|
|
42
43
|
const onClick = onClickFromProps;
|
|
43
44
|
let WrapElement = 'span';
|
|
44
45
|
const wrapElementProps = {
|
|
@@ -49,7 +50,8 @@ export const RscEntryLexicalCell = props => {
|
|
|
49
50
|
WrapElement = Link;
|
|
50
51
|
wrapElementProps.href = collectionConfig?.slug ? formatAdminURL({
|
|
51
52
|
adminRoute,
|
|
52
|
-
path: `/collections/${collectionConfig?.slug}/${rowData.id}
|
|
53
|
+
path: `/collections/${collectionConfig?.slug}/${rowData.id}`,
|
|
54
|
+
serverURL
|
|
53
55
|
}) : '';
|
|
54
56
|
}
|
|
55
57
|
if (typeof onClick === 'function') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rscEntry.js","names":["getTranslation","Link","formatAdminURL","React","recurseEditorState","editorState","textContent","i","node","text","push","_jsxs","type","children","RscEntryLexicalCell","props","cellData","className","classNameFromProps","collectionConfig","field","admin","i18n","link","onClick","onClickFromProps","payload","rowData","classNameFromConfigContext","undefined","adminRoute","config","routes","WrapElement","wrapElementProps","prefetch","href","slug","path","id","collectionSlug","root","length","t","label","_jsx"],"sources":["../../src/cell/rscEntry.tsx"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { Link } from '@payloadcms/ui'\nimport { formatAdminURL } from 'payload/shared'\nimport React from 'react'\n\nimport type { LexicalRichTextCellProps } from '../types.js'\n\nfunction recurseEditorState(\n editorState: SerializedLexicalNode[],\n textContent: React.ReactNode[],\n i: number = 0,\n): React.ReactNode[] {\n for (const node of editorState) {\n i++\n if ('text' in node && node.text) {\n textContent.push(node.text as string)\n } else {\n if (!('children' in node)) {\n textContent.push(<code key={i}> [{node.type}]</code>)\n }\n }\n if ('children' in node && node.children) {\n textContent = recurseEditorState(node.children as SerializedLexicalNode[], textContent, i)\n }\n }\n return textContent\n}\n\nexport const RscEntryLexicalCell: React.FC<LexicalRichTextCellProps> = (props) => {\n const {\n cellData,\n className: classNameFromProps,\n collectionConfig,\n field: { admin },\n field,\n i18n,\n link,\n onClick: onClickFromProps,\n payload,\n rowData,\n } = props\n\n const classNameFromConfigContext = admin && 'className' in admin ? admin.className : undefined\n\n const className =\n classNameFromProps ||\n (field.admin && 'className' in field.admin ? field.admin.className : null) ||\n classNameFromConfigContext\n const adminRoute = payload.config.routes.admin\n\n const onClick = onClickFromProps\n\n let WrapElement: React.ComponentType<any> | string = 'span'\n\n const wrapElementProps: {\n className?: string\n href?: string\n onClick?: () => void\n prefetch?: false\n type?: 'button'\n } = {\n className,\n }\n\n if (link) {\n wrapElementProps.prefetch = false\n WrapElement = Link\n wrapElementProps.href = collectionConfig?.slug\n ? formatAdminURL({\n adminRoute,\n path: `/collections/${collectionConfig?.slug}/${rowData.id}`,\n })\n : ''\n }\n\n if (typeof onClick === 'function') {\n WrapElement = 'button'\n wrapElementProps.type = 'button'\n wrapElementProps.onClick = () => {\n onClick({\n cellData,\n collectionSlug: collectionConfig?.slug,\n rowData,\n })\n }\n }\n\n let textContent: React.ReactNode[] = []\n\n if (cellData?.root?.children) {\n textContent = recurseEditorState(cellData?.root?.children, textContent)\n }\n\n if (!textContent?.length) {\n textContent = [\n i18n.t('general:noLabel', {\n label: getTranslation(('label' in field ? field.label : null) || 'data', i18n),\n }),\n ]\n }\n\n return <WrapElement {...wrapElementProps}>{textContent}</WrapElement>\n}\n"],"mappings":";AAEA,SAASA,cAAc,QAAQ;AAC/B,SAASC,IAAI,QAAQ;AACrB,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,MAAW;AAIlB,SAASC,mBACPC,WAAoC,EACpCC,WAA8B,EAC9BC,CAAA,GAAY,CAAC;EAEb,KAAK,MAAMC,IAAA,IAAQH,WAAA,EAAa;IAC9BE,CAAA;IACA,IAAI,UAAUC,IAAA,IAAQA,IAAA,CAAKC,IAAI,EAAE;MAC/BH,WAAA,CAAYI,IAAI,CAACF,IAAA,CAAKC,IAAI;IAC5B,OAAO;MACL,IAAI,EAAE,cAAcD,IAAG,GAAI;QACzBF,WAAA,CAAYI,IAAI,cAACC,KAAA,CAAC;qBAAa,MAAOH,IAAA,CAAKI,IAAI,EAAC;WAApBL,CAAA;MAC9B;IACF;IACA,IAAI,cAAcC,IAAA,IAAQA,IAAA,CAAKK,QAAQ,EAAE;MACvCP,WAAA,GAAcF,kBAAA,CAAmBI,IAAA,CAAKK,QAAQ,EAA6BP,WAAA,EAAaC,CAAA;IAC1F;EACF;EACA,OAAOD,WAAA;AACT;AAEA,OAAO,MAAMQ,mBAAA,GAA2DC,KAAA;EACtE,MAAM;IACJC,QAAQ;IACRC,SAAA,EAAWC,kBAAkB;IAC7BC,gBAAgB;IAChBC,KAAA,EAAO;MAAEC;IAAK,CAAE;IAChBD,KAAK;IACLE,IAAI;IACJC,IAAI;IACJC,OAAA,EAASC,gBAAgB;IACzBC,OAAO;IACPC;EAAO,CACR,GAAGZ,KAAA;EAEJ,MAAMa,0BAAA,GAA6BP,KAAA,IAAS,eAAeA,KAAA,GAAQA,KAAA,CAAMJ,SAAS,GAAGY,SAAA;EAErF,MAAMZ,SAAA,GACJC,kBAAA,KACCE,KAAA,CAAMC,KAAK,IAAI,eAAeD,KAAA,CAAMC,KAAK,GAAGD,KAAA,CAAMC,KAAK,CAACJ,SAAS,GAAG,IAAG,KACxEW,0BAAA;EACF,MAAME,UAAA,GAAaJ,OAAA,CAAQK,MAAM,CAACC,MAAM,CAACX,KAAK;
|
|
1
|
+
{"version":3,"file":"rscEntry.js","names":["getTranslation","Link","formatAdminURL","React","recurseEditorState","editorState","textContent","i","node","text","push","_jsxs","type","children","RscEntryLexicalCell","props","cellData","className","classNameFromProps","collectionConfig","field","admin","i18n","link","onClick","onClickFromProps","payload","rowData","classNameFromConfigContext","undefined","adminRoute","config","routes","serverURL","WrapElement","wrapElementProps","prefetch","href","slug","path","id","collectionSlug","root","length","t","label","_jsx"],"sources":["../../src/cell/rscEntry.tsx"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { Link } from '@payloadcms/ui'\nimport { formatAdminURL } from 'payload/shared'\nimport React from 'react'\n\nimport type { LexicalRichTextCellProps } from '../types.js'\n\nfunction recurseEditorState(\n editorState: SerializedLexicalNode[],\n textContent: React.ReactNode[],\n i: number = 0,\n): React.ReactNode[] {\n for (const node of editorState) {\n i++\n if ('text' in node && node.text) {\n textContent.push(node.text as string)\n } else {\n if (!('children' in node)) {\n textContent.push(<code key={i}> [{node.type}]</code>)\n }\n }\n if ('children' in node && node.children) {\n textContent = recurseEditorState(node.children as SerializedLexicalNode[], textContent, i)\n }\n }\n return textContent\n}\n\nexport const RscEntryLexicalCell: React.FC<LexicalRichTextCellProps> = (props) => {\n const {\n cellData,\n className: classNameFromProps,\n collectionConfig,\n field: { admin },\n field,\n i18n,\n link,\n onClick: onClickFromProps,\n payload,\n rowData,\n } = props\n\n const classNameFromConfigContext = admin && 'className' in admin ? admin.className : undefined\n\n const className =\n classNameFromProps ||\n (field.admin && 'className' in field.admin ? field.admin.className : null) ||\n classNameFromConfigContext\n const adminRoute = payload.config.routes.admin\n const serverURL = payload.config.serverURL\n\n const onClick = onClickFromProps\n\n let WrapElement: React.ComponentType<any> | string = 'span'\n\n const wrapElementProps: {\n className?: string\n href?: string\n onClick?: () => void\n prefetch?: false\n type?: 'button'\n } = {\n className,\n }\n\n if (link) {\n wrapElementProps.prefetch = false\n WrapElement = Link\n wrapElementProps.href = collectionConfig?.slug\n ? formatAdminURL({\n adminRoute,\n path: `/collections/${collectionConfig?.slug}/${rowData.id}`,\n serverURL,\n })\n : ''\n }\n\n if (typeof onClick === 'function') {\n WrapElement = 'button'\n wrapElementProps.type = 'button'\n wrapElementProps.onClick = () => {\n onClick({\n cellData,\n collectionSlug: collectionConfig?.slug,\n rowData,\n })\n }\n }\n\n let textContent: React.ReactNode[] = []\n\n if (cellData?.root?.children) {\n textContent = recurseEditorState(cellData?.root?.children, textContent)\n }\n\n if (!textContent?.length) {\n textContent = [\n i18n.t('general:noLabel', {\n label: getTranslation(('label' in field ? field.label : null) || 'data', i18n),\n }),\n ]\n }\n\n return <WrapElement {...wrapElementProps}>{textContent}</WrapElement>\n}\n"],"mappings":";AAEA,SAASA,cAAc,QAAQ;AAC/B,SAASC,IAAI,QAAQ;AACrB,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,MAAW;AAIlB,SAASC,mBACPC,WAAoC,EACpCC,WAA8B,EAC9BC,CAAA,GAAY,CAAC;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;IACFlB;EACF;EAEA,IAAIM,IAAA,EAAM;IACRY,gBAAA,CAAiBC,QAAQ,GAAG;IAC5BF,WAAA,GAAcjC,IAAA;IACdkC,gBAAA,CAAiBE,IAAI,GAAGlB,gBAAA,EAAkBmB,IAAA,GACtCpC,cAAA,CAAe;MACb4B,UAAA;MACAS,IAAA,EAAM,gBAAgBpB,gBAAA,EAAkBmB,IAAA,IAAQX,OAAA,CAAQa,EAAE,EAAE;MAC5DP;IACF,KACA;EACN;EAEA,IAAI,OAAOT,OAAA,KAAY,YAAY;IACjCU,WAAA,GAAc;IACdC,gBAAA,CAAiBvB,IAAI,GAAG;IACxBuB,gBAAA,CAAiBX,OAAO,GAAG;MACzBA,OAAA,CAAQ;QACNR,QAAA;QACAyB,cAAA,EAAgBtB,gBAAA,EAAkBmB,IAAA;QAClCX;MACF;IACF;EACF;EAEA,IAAIrB,WAAA,GAAiC,EAAE;EAEvC,IAAIU,QAAA,EAAU0B,IAAA,EAAM7B,QAAA,EAAU;IAC5BP,WAAA,GAAcF,kBAAA,CAAmBY,QAAA,EAAU0B,IAAA,EAAM7B,QAAA,EAAUP,WAAA;EAC7D;EAEA,IAAI,CAACA,WAAA,EAAaqC,MAAA,EAAQ;IACxBrC,WAAA,GAAc,CACZgB,IAAA,CAAKsB,CAAC,CAAC,mBAAmB;MACxBC,KAAA,EAAO7C,cAAA,CAAe,CAAC,WAAWoB,KAAA,GAAQA,KAAA,CAAMyB,KAAK,GAAG,IAAG,KAAM,QAAQvB,IAAA;IAC3E,GACD;EACH;EAEA,oBAAOwB,IAAA,CAACZ,WAAA;IAAa,GAAGC,gBAAgB;cAAG7B;;AAC7C","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/richtext-lexical",
|
|
3
|
-
"version": "3.69.0-canary.
|
|
3
|
+
"version": "3.69.0-canary.2",
|
|
4
4
|
"description": "The officially supported Lexical richtext adapter for Payload",
|
|
5
5
|
"homepage": "https://payloadcms.com",
|
|
6
6
|
"repository": {
|
|
@@ -374,8 +374,8 @@
|
|
|
374
374
|
"react-error-boundary": "4.1.2",
|
|
375
375
|
"ts-essentials": "10.0.3",
|
|
376
376
|
"uuid": "10.0.0",
|
|
377
|
-
"@payloadcms/
|
|
378
|
-
"@payloadcms/
|
|
377
|
+
"@payloadcms/translations": "3.69.0-canary.2",
|
|
378
|
+
"@payloadcms/ui": "3.69.0-canary.2"
|
|
379
379
|
},
|
|
380
380
|
"devDependencies": {
|
|
381
381
|
"@babel/cli": "7.27.2",
|
|
@@ -394,16 +394,16 @@
|
|
|
394
394
|
"esbuild": "0.25.5",
|
|
395
395
|
"esbuild-sass-plugin": "3.3.1",
|
|
396
396
|
"swc-plugin-transform-remove-imports": "8.3.0",
|
|
397
|
-
"
|
|
398
|
-
"
|
|
397
|
+
"@payloadcms/eslint-config": "3.28.0",
|
|
398
|
+
"payload": "3.69.0-canary.2"
|
|
399
399
|
},
|
|
400
400
|
"peerDependencies": {
|
|
401
401
|
"@faceless-ui/modal": "3.0.0",
|
|
402
402
|
"@faceless-ui/scroll-info": "2.0.0",
|
|
403
403
|
"react": "^19.0.1 || ^19.1.2 || ^19.2.1",
|
|
404
404
|
"react-dom": "^19.0.1 || ^19.1.2 || ^19.2.1",
|
|
405
|
-
"@payloadcms/next": "3.69.0-canary.
|
|
406
|
-
"payload": "3.69.0-canary.
|
|
405
|
+
"@payloadcms/next": "3.69.0-canary.2",
|
|
406
|
+
"payload": "3.69.0-canary.2"
|
|
407
407
|
},
|
|
408
408
|
"engines": {
|
|
409
409
|
"node": "^18.20.2 || >=20.9.0"
|