@payloadcms/richtext-lexical 3.45.0-internal.2f73d3c → 3.45.0-internal.5103e58
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":"baseFields.js","names":["validateUrl","validateUrlMinimal","getBaseFields","config","enabledCollections","disabledCollections","maxDepth","enabledRelations","collections","filter","slug","includes","map","admin","enableRichTextLink","hidden","baseFields","name","type","label","t","required","description","defaultValue","options","value","hooks","beforeChange","encodeURIComponent","validate","siblingData","linkType","length","push","condition","_data","_siblingData","filterOptions","relationTo","user","find"],"sources":["../../../../src/features/link/server/baseFields.ts"],"sourcesContent":["import type {\n CollectionSlug,\n FieldAffectingData,\n RadioField,\n SanitizedConfig,\n TextField,\n TextFieldSingleValidation,\n
|
|
1
|
+
{"version":3,"file":"baseFields.js","names":["validateUrl","validateUrlMinimal","getBaseFields","config","enabledCollections","disabledCollections","maxDepth","enabledRelations","collections","filter","slug","includes","map","admin","enableRichTextLink","hidden","baseFields","name","type","label","t","required","description","defaultValue","options","value","hooks","beforeChange","encodeURIComponent","validate","siblingData","linkType","length","push","condition","_data","_siblingData","filterOptions","relationTo","user","find"],"sources":["../../../../src/features/link/server/baseFields.ts"],"sourcesContent":["import type {\n CollectionSlug,\n FieldAffectingData,\n RadioField,\n SanitizedConfig,\n TextField,\n TextFieldSingleValidation,\n User,\n} from 'payload'\n\nimport type { LinkFields } from '../nodes/types.js'\n\nimport { validateUrl, validateUrlMinimal } from '../../../lexical/utils/url.js'\n\nexport const getBaseFields = (\n config: SanitizedConfig,\n enabledCollections?: CollectionSlug[],\n disabledCollections?: CollectionSlug[],\n maxDepth?: number,\n): FieldAffectingData[] => {\n let enabledRelations: CollectionSlug[]\n\n /**\n * Figure out which relations should be enabled (enabledRelations) based on a collection's admin.enableRichTextLink property,\n * or the Link Feature's enabledCollections and disabledCollections properties which override it.\n */\n if (enabledCollections) {\n enabledRelations = enabledCollections\n } else if (disabledCollections) {\n enabledRelations = config.collections\n .filter(({ slug }) => !disabledCollections.includes(slug))\n .map(({ slug }) => slug)\n } else {\n enabledRelations = config.collections\n .filter(({ admin: { enableRichTextLink, hidden } }) => {\n if (typeof hidden !== 'function' && hidden) {\n return false\n }\n return enableRichTextLink\n })\n .map(({ slug }) => slug)\n }\n\n const baseFields: FieldAffectingData[] = [\n {\n name: 'text',\n type: 'text',\n label: ({ t }) => t('fields:textToDisplay'),\n required: true,\n },\n {\n name: 'linkType',\n type: 'radio',\n admin: {\n description: ({ t }) => t('fields:chooseBetweenCustomTextOrDocument'),\n },\n defaultValue: 'custom',\n label: ({ t }) => t('fields:linkType'),\n options: [\n {\n label: ({ t }) => t('fields:customURL'),\n value: 'custom',\n },\n ],\n required: true,\n } as RadioField,\n {\n name: 'url',\n type: 'text',\n hooks: {\n beforeChange: [\n ({ value }) => {\n if (!value) {\n return\n }\n\n if (!validateUrl(value)) {\n return encodeURIComponent(value)\n }\n return value\n },\n ],\n },\n label: ({ t }) => t('fields:enterURL'),\n required: true,\n validate: ((value: string, options) => {\n if ((options?.siblingData as LinkFields)?.linkType === 'internal') {\n return // no validation needed, as no url should exist for internal links\n }\n if (!validateUrlMinimal(value)) {\n return 'Invalid URL'\n }\n }) as TextFieldSingleValidation,\n },\n ]\n\n // Only display internal link-specific fields / options / conditions if there are enabled relations\n if (enabledRelations?.length) {\n ;(baseFields[1] as RadioField).options.push({\n label: ({ t }) => t('fields:internalLink'),\n value: 'internal',\n })\n ;(baseFields[2] as TextField).admin = {\n condition: (_data, _siblingData) => {\n return _siblingData.linkType !== 'internal'\n },\n }\n\n baseFields.push({\n name: 'doc',\n admin: {\n condition: (_data, _siblingData) => {\n return _siblingData.linkType === 'internal'\n },\n },\n // when admin.hidden is a function we need to dynamically call hidden with the user to know if the collection should be shown\n type: 'relationship',\n filterOptions:\n !enabledCollections && !disabledCollections\n ? ({ relationTo, user }) => {\n const hidden = config.collections.find(({ slug }) => slug === relationTo)?.admin\n .hidden\n if (typeof hidden === 'function' && hidden({ user } as { user: User })) {\n return false\n }\n return true\n }\n : null,\n label: ({ t }) => t('fields:chooseDocumentToLink'),\n maxDepth,\n relationTo: enabledRelations,\n required: true,\n })\n }\n\n baseFields.push({\n name: 'newTab',\n type: 'checkbox',\n label: ({ t }) => t('fields:openInNewTab'),\n })\n\n return baseFields\n}\n"],"mappings":"AAYA,SAASA,WAAW,EAAEC,kBAAkB,QAAQ;AAEhD,OAAO,MAAMC,aAAA,GAAgBA,CAC3BC,MAAA,EACAC,kBAAA,EACAC,mBAAA,EACAC,QAAA;EAEA,IAAIC,gBAAA;EAEJ;;;;EAIA,IAAIH,kBAAA,EAAoB;IACtBG,gBAAA,GAAmBH,kBAAA;EACrB,OAAO,IAAIC,mBAAA,EAAqB;IAC9BE,gBAAA,GAAmBJ,MAAA,CAAOK,WAAW,CAClCC,MAAM,CAAC,CAAC;MAAEC;IAAI,CAAE,KAAK,CAACL,mBAAA,CAAoBM,QAAQ,CAACD,IAAA,GACnDE,GAAG,CAAC,CAAC;MAAEF;IAAI,CAAE,KAAKA,IAAA;EACvB,OAAO;IACLH,gBAAA,GAAmBJ,MAAA,CAAOK,WAAW,CAClCC,MAAM,CAAC,CAAC;MAAEI,KAAA,EAAO;QAAEC,kBAAkB;QAAEC;MAAM;IAAE,CAAE;MAChD,IAAI,OAAOA,MAAA,KAAW,cAAcA,MAAA,EAAQ;QAC1C,OAAO;MACT;MACA,OAAOD,kBAAA;IACT,GACCF,GAAG,CAAC,CAAC;MAAEF;IAAI,CAAE,KAAKA,IAAA;EACvB;EAEA,MAAMM,UAAA,GAAmC,CACvC;IACEC,IAAA,EAAM;IACNC,IAAA,EAAM;IACNC,KAAA,EAAOA,CAAC;MAAEC;IAAC,CAAE,KAAKA,CAAA,CAAE;IACpBC,QAAA,EAAU;EACZ,GACA;IACEJ,IAAA,EAAM;IACNC,IAAA,EAAM;IACNL,KAAA,EAAO;MACLS,WAAA,EAAaA,CAAC;Q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AO;QACLqB,SAAA,EAAWA,CAACC,KAAA,EAAOC,YAAA;UACjB,OAAOA,YAAA,CAAaL,QAAQ,KAAK;QACnC;MACF;MACA;MACAb,IAAA,EAAM;MACNmB,aAAA,EACE,CAACjC,kBAAA,IAAsB,CAACC,mBAAA,GACpB,CAAC;QAAEiC,UAAU;QAAEC;MAAI,CAAE;QACnB,MAAMxB,MAAA,GAASZ,MAAA,CAAOK,WAAW,CAACgC,IAAI,CAAC,CAAC;UAAE9B;QAAI,CAAE,KAAKA,IAAA,KAAS4B,UAAA,GAAazB,KAAA,CACxEE,MAAA;QACH,IAAI,OAAOA,MAAA,KAAW,cAAcA,MAAA,CAAO;UAAEwB;QAAK,IAAsB;UACtE,OAAO;QACT;QACA,OAAO;MACT,IACA;MACNpB,KAAA,EAAOA,CAAC;QAAEC;MAAC,CAAE,KAAKA,CAAA,CAAE;MACpBd,QAAA;MACAgC,UAAA,EAAY/B,gBAAA;MACZc,QAAA,EAAU;IACZ;EACF;EAEAL,UAAA,CAAWiB,IAAI,CAAC;IACdhB,IAAA,EAAM;IACNC,IAAA,EAAM;IACNC,KAAA,EAAOA,CAAC;MAAEC;IAAC,CAAE,KAAKA,CAAA,CAAE;EACtB;EAEA,OAAOJ,UAAA;AACT","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/richtext-lexical",
|
|
3
|
-
"version": "3.45.0-internal.
|
|
3
|
+
"version": "3.45.0-internal.5103e58",
|
|
4
4
|
"description": "The officially supported Lexical richtext adapter for Payload",
|
|
5
5
|
"homepage": "https://payloadcms.com",
|
|
6
6
|
"repository": {
|
|
@@ -368,8 +368,8 @@
|
|
|
368
368
|
"react-error-boundary": "4.1.2",
|
|
369
369
|
"ts-essentials": "10.0.3",
|
|
370
370
|
"uuid": "10.0.0",
|
|
371
|
-
"@payloadcms/translations": "3.45.0-internal.
|
|
372
|
-
"@payloadcms/ui": "3.45.0-internal.
|
|
371
|
+
"@payloadcms/translations": "3.45.0-internal.5103e58",
|
|
372
|
+
"@payloadcms/ui": "3.45.0-internal.5103e58"
|
|
373
373
|
},
|
|
374
374
|
"devDependencies": {
|
|
375
375
|
"@babel/cli": "7.27.2",
|
|
@@ -389,15 +389,15 @@
|
|
|
389
389
|
"esbuild-sass-plugin": "3.3.1",
|
|
390
390
|
"swc-plugin-transform-remove-imports": "4.0.4",
|
|
391
391
|
"@payloadcms/eslint-config": "3.28.0",
|
|
392
|
-
"payload": "3.45.0-internal.
|
|
392
|
+
"payload": "3.45.0-internal.5103e58"
|
|
393
393
|
},
|
|
394
394
|
"peerDependencies": {
|
|
395
395
|
"@faceless-ui/modal": "3.0.0-beta.2",
|
|
396
396
|
"@faceless-ui/scroll-info": "2.0.0",
|
|
397
397
|
"react": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
|
|
398
398
|
"react-dom": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
|
|
399
|
-
"@payloadcms/next": "3.45.0-internal.
|
|
400
|
-
"payload": "3.45.0-internal.
|
|
399
|
+
"@payloadcms/next": "3.45.0-internal.5103e58",
|
|
400
|
+
"payload": "3.45.0-internal.5103e58"
|
|
401
401
|
},
|
|
402
402
|
"engines": {
|
|
403
403
|
"node": "^18.20.2 || >=20.9.0"
|