Adding new content sections

Removing old dependencies
This commit is contained in:
Julio Ruiz 2026-07-06 09:18:57 -05:00
parent 3baa7dc14c
commit c7bd2ef59a
11 changed files with 6449 additions and 226 deletions

BIN
cdrdjyp.db Normal file

Binary file not shown.

BIN
media/comunicado-2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 KiB

BIN
media/comunicado-3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 KiB

4699
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -18,12 +18,16 @@
"test:int": "cross-env NODE_OPTIONS=--no-deprecation vitest run --config ./vitest.config.mts" "test:int": "cross-env NODE_OPTIONS=--no-deprecation vitest run --config ./vitest.config.mts"
}, },
"dependencies": { "dependencies": {
"@infonomic/payload-alternative-lexical-editor": "^1.6.5",
"@mdxeditor/editor": "^4.0.4",
"@payloadcms/db-postgres": "^3.85.1", "@payloadcms/db-postgres": "^3.85.1",
"@payloadcms/db-sqlite": "3.85.1", "@payloadcms/db-sqlite": "3.85.1",
"@payloadcms/next": "3.85.1", "@payloadcms/next": "3.85.1",
"@payloadcms/plugin-import-export": "^3.85.1",
"@payloadcms/richtext-lexical": "^3.85.1", "@payloadcms/richtext-lexical": "^3.85.1",
"@payloadcms/storage-s3": "^3.85.1", "@payloadcms/storage-s3": "^3.85.1",
"@payloadcms/ui": "3.85.1", "@payloadcms/ui": "3.85.1",
"@uiw/react-md-editor": "^4.1.1",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"dotenv": "16.4.7", "dotenv": "16.4.7",
"graphql": "^16.8.1", "graphql": "^16.8.1",
@ -31,6 +35,7 @@
"payload": "3.85.1", "payload": "3.85.1",
"react": "19.2.6", "react": "19.2.6",
"react-dom": "19.2.6", "react-dom": "19.2.6",
"react-markdown-editor-lite": "^1.4.2",
"sharp": "0.34.2" "sharp": "0.34.2"
}, },
"devDependencies": { "devDependencies": {

View File

@ -1,54 +1,88 @@
import { SlugField as SlugField_2b8867833a34864a02ddf429b0728a40 } from '@payloadcms/next/client'
import { RscEntryLexicalCell as RscEntryLexicalCell_44fe37237e0ebf4470c9990d8cb7b07e } from '@payloadcms/richtext-lexical/rsc' import { RscEntryLexicalCell as RscEntryLexicalCell_44fe37237e0ebf4470c9990d8cb7b07e } from '@payloadcms/richtext-lexical/rsc'
import { RscEntryLexicalField as RscEntryLexicalField_44fe37237e0ebf4470c9990d8cb7b07e } from '@payloadcms/richtext-lexical/rsc' import { RscEntryLexicalField as RscEntryLexicalField_44fe37237e0ebf4470c9990d8cb7b07e } from '@payloadcms/richtext-lexical/rsc'
import { LexicalDiffComponent as LexicalDiffComponent_44fe37237e0ebf4470c9990d8cb7b07e } from '@payloadcms/richtext-lexical/rsc' import { LexicalDiffComponent as LexicalDiffComponent_44fe37237e0ebf4470c9990d8cb7b07e } from '@payloadcms/richtext-lexical/rsc'
import { InlineToolbarFeatureClient as InlineToolbarFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
import { HorizontalRuleFeatureClient as HorizontalRuleFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
import { UploadFeatureClient as UploadFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
import { BlockquoteFeatureClient as BlockquoteFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
import { RelationshipFeatureClient as RelationshipFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
import { LinkFeatureClient as LinkFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
import { ChecklistFeatureClient as ChecklistFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
import { OrderedListFeatureClient as OrderedListFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
import { UnorderedListFeatureClient as UnorderedListFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
import { IndentFeatureClient as IndentFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
import { AlignFeatureClient as AlignFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
import { HeadingFeatureClient as HeadingFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
import { ParagraphFeatureClient as ParagraphFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
import { InlineCodeFeatureClient as InlineCodeFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
import { SuperscriptFeatureClient as SuperscriptFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
import { SubscriptFeatureClient as SubscriptFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
import { StrikethroughFeatureClient as StrikethroughFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
import { UnderlineFeatureClient as UnderlineFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
import { BoldFeatureClient as BoldFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client' import { BoldFeatureClient as BoldFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
import { ItalicFeatureClient as ItalicFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client' import { ItalicFeatureClient as ItalicFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
import { UnderlineFeatureClient as UnderlineFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
import { StrikethroughFeatureClient as StrikethroughFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
import { SubscriptFeatureClient as SubscriptFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
import { SuperscriptFeatureClient as SuperscriptFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
import { InlineCodeFeatureClient as InlineCodeFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
import { ParagraphFeatureClient as ParagraphFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
import { HeadingFeatureClient as HeadingFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
import { AlignFeatureClient as AlignFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
import { IndentFeatureClient as IndentFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
import { UnorderedListFeatureClient as UnorderedListFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
import { OrderedListFeatureClient as OrderedListFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
import { ChecklistFeatureClient as ChecklistFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
import { LinkFeatureClient as LinkFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
import { RelationshipFeatureClient as RelationshipFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
import { BlockquoteFeatureClient as BlockquoteFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
import { UploadFeatureClient as UploadFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
import { HorizontalRuleFeatureClient as HorizontalRuleFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
import { InlineToolbarFeatureClient as InlineToolbarFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
import { ExportListMenuItem as ExportListMenuItem_cdf7e044479f899a31f804427d568b36 } from '@payloadcms/plugin-import-export/rsc'
import { ImportListMenuItem as ImportListMenuItem_cdf7e044479f899a31f804427d568b36 } from '@payloadcms/plugin-import-export/rsc'
import { FormatField as FormatField_cdf7e044479f899a31f804427d568b36 } from '@payloadcms/plugin-import-export/rsc'
import { LimitField as LimitField_cdf7e044479f899a31f804427d568b36 } from '@payloadcms/plugin-import-export/rsc'
import { Page as Page_cdf7e044479f899a31f804427d568b36 } from '@payloadcms/plugin-import-export/rsc'
import { SortBy as SortBy_cdf7e044479f899a31f804427d568b36 } from '@payloadcms/plugin-import-export/rsc'
import { SortOrder as SortOrder_cdf7e044479f899a31f804427d568b36 } from '@payloadcms/plugin-import-export/rsc'
import { LocaleField as LocaleField_cdf7e044479f899a31f804427d568b36 } from '@payloadcms/plugin-import-export/rsc'
import { SelectionToUseField as SelectionToUseField_cdf7e044479f899a31f804427d568b36 } from '@payloadcms/plugin-import-export/rsc'
import { FieldsToExport as FieldsToExport_cdf7e044479f899a31f804427d568b36 } from '@payloadcms/plugin-import-export/rsc'
import { CollectionField as CollectionField_cdf7e044479f899a31f804427d568b36 } from '@payloadcms/plugin-import-export/rsc'
import { ExportPreview as ExportPreview_cdf7e044479f899a31f804427d568b36 } from '@payloadcms/plugin-import-export/rsc'
import { ExportSaveButton as ExportSaveButton_cdf7e044479f899a31f804427d568b36 } from '@payloadcms/plugin-import-export/rsc'
import { ImportPreview as ImportPreview_cdf7e044479f899a31f804427d568b36 } from '@payloadcms/plugin-import-export/rsc'
import { ImportSaveButton as ImportSaveButton_cdf7e044479f899a31f804427d568b36 } from '@payloadcms/plugin-import-export/rsc'
import { S3ClientUploadHandler as S3ClientUploadHandler_f97aa6c64367fa259c5bc0567239ef24 } from '@payloadcms/storage-s3/client' import { S3ClientUploadHandler as S3ClientUploadHandler_f97aa6c64367fa259c5bc0567239ef24 } from '@payloadcms/storage-s3/client'
import { ImportExportProvider as ImportExportProvider_cdf7e044479f899a31f804427d568b36 } from '@payloadcms/plugin-import-export/rsc'
import { CollectionCards as CollectionCards_f9c02e79a4aed9a3924487c0cd4cafb1 } from '@payloadcms/next/rsc' import { CollectionCards as CollectionCards_f9c02e79a4aed9a3924487c0cd4cafb1 } from '@payloadcms/next/rsc'
/** @type import('payload').ImportMap */ /** @type import('payload').ImportMap */
export const importMap = { export const importMap = {
"@payloadcms/next/client#SlugField": SlugField_2b8867833a34864a02ddf429b0728a40,
"@payloadcms/richtext-lexical/rsc#RscEntryLexicalCell": RscEntryLexicalCell_44fe37237e0ebf4470c9990d8cb7b07e, "@payloadcms/richtext-lexical/rsc#RscEntryLexicalCell": RscEntryLexicalCell_44fe37237e0ebf4470c9990d8cb7b07e,
"@payloadcms/richtext-lexical/rsc#RscEntryLexicalField": RscEntryLexicalField_44fe37237e0ebf4470c9990d8cb7b07e, "@payloadcms/richtext-lexical/rsc#RscEntryLexicalField": RscEntryLexicalField_44fe37237e0ebf4470c9990d8cb7b07e,
"@payloadcms/richtext-lexical/rsc#LexicalDiffComponent": LexicalDiffComponent_44fe37237e0ebf4470c9990d8cb7b07e, "@payloadcms/richtext-lexical/rsc#LexicalDiffComponent": LexicalDiffComponent_44fe37237e0ebf4470c9990d8cb7b07e,
"@payloadcms/richtext-lexical/client#InlineToolbarFeatureClient": InlineToolbarFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#HorizontalRuleFeatureClient": HorizontalRuleFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#UploadFeatureClient": UploadFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#BlockquoteFeatureClient": BlockquoteFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#RelationshipFeatureClient": RelationshipFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#LinkFeatureClient": LinkFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#ChecklistFeatureClient": ChecklistFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#OrderedListFeatureClient": OrderedListFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#UnorderedListFeatureClient": UnorderedListFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#IndentFeatureClient": IndentFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#AlignFeatureClient": AlignFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#HeadingFeatureClient": HeadingFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#ParagraphFeatureClient": ParagraphFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#InlineCodeFeatureClient": InlineCodeFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#SuperscriptFeatureClient": SuperscriptFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#SubscriptFeatureClient": SubscriptFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#StrikethroughFeatureClient": StrikethroughFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#UnderlineFeatureClient": UnderlineFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#BoldFeatureClient": BoldFeatureClient_e70f5e05f09f93e00b997edb1ef0c864, "@payloadcms/richtext-lexical/client#BoldFeatureClient": BoldFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#ItalicFeatureClient": ItalicFeatureClient_e70f5e05f09f93e00b997edb1ef0c864, "@payloadcms/richtext-lexical/client#ItalicFeatureClient": ItalicFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#UnderlineFeatureClient": UnderlineFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#StrikethroughFeatureClient": StrikethroughFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#SubscriptFeatureClient": SubscriptFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#SuperscriptFeatureClient": SuperscriptFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#InlineCodeFeatureClient": InlineCodeFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#ParagraphFeatureClient": ParagraphFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#HeadingFeatureClient": HeadingFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#AlignFeatureClient": AlignFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#IndentFeatureClient": IndentFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#UnorderedListFeatureClient": UnorderedListFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#OrderedListFeatureClient": OrderedListFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#ChecklistFeatureClient": ChecklistFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#LinkFeatureClient": LinkFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#RelationshipFeatureClient": RelationshipFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#BlockquoteFeatureClient": BlockquoteFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#UploadFeatureClient": UploadFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#HorizontalRuleFeatureClient": HorizontalRuleFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/richtext-lexical/client#InlineToolbarFeatureClient": InlineToolbarFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
"@payloadcms/plugin-import-export/rsc#ExportListMenuItem": ExportListMenuItem_cdf7e044479f899a31f804427d568b36,
"@payloadcms/plugin-import-export/rsc#ImportListMenuItem": ImportListMenuItem_cdf7e044479f899a31f804427d568b36,
"@payloadcms/plugin-import-export/rsc#FormatField": FormatField_cdf7e044479f899a31f804427d568b36,
"@payloadcms/plugin-import-export/rsc#LimitField": LimitField_cdf7e044479f899a31f804427d568b36,
"@payloadcms/plugin-import-export/rsc#Page": Page_cdf7e044479f899a31f804427d568b36,
"@payloadcms/plugin-import-export/rsc#SortBy": SortBy_cdf7e044479f899a31f804427d568b36,
"@payloadcms/plugin-import-export/rsc#SortOrder": SortOrder_cdf7e044479f899a31f804427d568b36,
"@payloadcms/plugin-import-export/rsc#LocaleField": LocaleField_cdf7e044479f899a31f804427d568b36,
"@payloadcms/plugin-import-export/rsc#SelectionToUseField": SelectionToUseField_cdf7e044479f899a31f804427d568b36,
"@payloadcms/plugin-import-export/rsc#FieldsToExport": FieldsToExport_cdf7e044479f899a31f804427d568b36,
"@payloadcms/plugin-import-export/rsc#CollectionField": CollectionField_cdf7e044479f899a31f804427d568b36,
"@payloadcms/plugin-import-export/rsc#ExportPreview": ExportPreview_cdf7e044479f899a31f804427d568b36,
"@payloadcms/plugin-import-export/rsc#ExportSaveButton": ExportSaveButton_cdf7e044479f899a31f804427d568b36,
"@payloadcms/plugin-import-export/rsc#ImportPreview": ImportPreview_cdf7e044479f899a31f804427d568b36,
"@payloadcms/plugin-import-export/rsc#ImportSaveButton": ImportSaveButton_cdf7e044479f899a31f804427d568b36,
"@payloadcms/storage-s3/client#S3ClientUploadHandler": S3ClientUploadHandler_f97aa6c64367fa259c5bc0567239ef24, "@payloadcms/storage-s3/client#S3ClientUploadHandler": S3ClientUploadHandler_f97aa6c64367fa259c5bc0567239ef24,
"@payloadcms/plugin-import-export/rsc#ImportExportProvider": ImportExportProvider_cdf7e044479f899a31f804427d568b36,
"@payloadcms/next/rsc#CollectionCards": CollectionCards_f9c02e79a4aed9a3924487c0cd4cafb1 "@payloadcms/next/rsc#CollectionCards": CollectionCards_f9c02e79a4aed9a3924487c0cd4cafb1
} }

View File

@ -0,0 +1,436 @@
import type { SerializedEditorState } from '@payloadcms/richtext-lexical/lexical'
import { slugField } from 'payload'
import type { CollectionConfig, RichTextField } from 'payload'
import {
convertLexicalToMarkdown,
editorConfigFactory,
lexicalEditor,
} from '@payloadcms/richtext-lexical'
export const Editorial: CollectionConfig = {
slug: 'editorial',
access: {
read: () => true,
},
versions: {
drafts: true,
maxPerDoc: 10
},
fields: [
{
name: 'title',
type: 'text',
localized: true
},
slugField(),
{
name: 'locale',
type: 'text',
localized: true,
defaultValue: ({locale}) => {
return locale
},
admin: {
hidden: true,
position: 'sidebar',
},
},
{
type: 'row',
fields: [
{
name: 'date',
type: 'date',
admin: {
width: '33%'
},
},
{
name: 'order',
type: 'number',
admin: {
width: '33%'
},
},
{
name: 'place',
type: 'text',
admin: {
width: '34%'
}
},
]
},
{
type: 'row',
fields: [
{
name: 'city',
type: 'text',
admin: {
width: '33%'
}
},
{
name: 'state',
type: 'text',
admin: {
width: '33%'
}
},
{
name: 'country',
type: 'select',
options: [
{label: 'Afghanistan', value: 'AF'},
{label: 'Åland Islands', value: 'AX'},
{label: 'Albania', value: 'AL'},
{label: 'Algeria', value: 'DZ'},
{label: 'American Samoa', value: 'AS'},
{label: 'AndorrA', value: 'AD'},
{label: 'Angola', value: 'AO'},
{label: 'Anguilla', value: 'AI'},
{label: 'Antarctica', value: 'AQ'},
{label: 'Antigua and Barbuda', value: 'AG'},
{label: 'Argentina', value: 'AR'},
{label: 'Armenia', value: 'AM'},
{label: 'Aruba', value: 'AW'},
{label: 'Australia', value: 'AU'},
{label: 'Austria', value: 'AT'},
{label: 'Azerbaijan', value: 'AZ'},
{label: 'Bahamas', value: 'BS'},
{label: 'Bahrain', value: 'BH'},
{label: 'Bangladesh', value: 'BD'},
{label: 'Barbados', value: 'BB'},
{label: 'Belarus', value: 'BY'},
{label: 'Belgium', value: 'BE'},
{label: 'Belize', value: 'BZ'},
{label: 'Benin', value: 'BJ'},
{label: 'Bermuda', value: 'BM'},
{label: 'Bhutan', value: 'BT'},
{label: 'Bolivia', value: 'BO'},
{label: 'Bosnia and Herzegovina', value: 'BA'},
{label: 'Botswana', value: 'BW'},
{label: 'Bouvet Island', value: 'BV'},
{label: 'Brazil', value: 'BR'},
{label: 'British Indian Ocean Territory', value: 'IO'},
{label: 'Brunei Darussalam', value: 'BN'},
{label: 'Bulgaria', value: 'BG'},
{label: 'Burkina Faso', value: 'BF'},
{label: 'Burundi', value: 'BI'},
{label: 'Cambodia', value: 'KH'},
{label: 'Cameroon', value: 'CM'},
{label: 'Canada', value: 'CA'},
{label: 'Cape Verde', value: 'CV'},
{label: 'Cayman Islands', value: 'KY'},
{label: 'Central African Republic', value: 'CF'},
{label: 'Chad', value: 'TD'},
{label: 'Chile', value: 'CL'},
{label: 'China', value: 'CN'},
{label: 'Christmas Island', value: 'CX'},
{label: 'Cocos (Keeling) Islands', value: 'CC'},
{label: 'Colombia', value: 'CO'},
{label: 'Comoros', value: 'KM'},
{label: 'Congo', value: 'CG'},
{label: 'Congo, The Democratic Republic of the', value: 'CD'},
{label: 'Cook Islands', value: 'CK'},
{label: 'Costa Rica', value: 'CR'},
{label: 'Cote D\'Ivoire', value: 'CI'},
{label: 'Croatia', value: 'HR'},
{label: 'Cuba', value: 'CU'},
{label: 'Cyprus', value: 'CY'},
{label: 'Czech Republic', value: 'CZ'},
{label: 'Denmark', value: 'DK'},
{label: 'Djibouti', value: 'DJ'},
{label: 'Dominica', value: 'DM'},
{label: 'Dominican Republic', value: 'DO'},
{label: 'Ecuador', value: 'EC'},
{label: 'Egypt', value: 'EG'},
{label: 'El Salvador', value: 'SV'},
{label: 'Equatorial Guinea', value: 'GQ'},
{label: 'Eritrea', value: 'ER'},
{label: 'Estonia', value: 'EE'},
{label: 'Ethiopia', value: 'ET'},
{label: 'Falkland Islands (Malvinas)', value: 'FK'},
{label: 'Faroe Islands', value: 'FO'},
{label: 'Fiji', value: 'FJ'},
{label: 'Finland', value: 'FI'},
{label: 'France', value: 'FR'},
{label: 'French Guiana', value: 'GF'},
{label: 'French Polynesia', value: 'PF'},
{label: 'French Southern Territories', value: 'TF'},
{label: 'Gabon', value: 'GA'},
{label: 'Gambia', value: 'GM'},
{label: 'Georgia', value: 'GE'},
{label: 'Germany', value: 'DE'},
{label: 'Ghana', value: 'GH'},
{label: 'Gibraltar', value: 'GI'},
{label: 'Greece', value: 'GR'},
{label: 'Greenland', value: 'GL'},
{label: 'Grenada', value: 'GD'},
{label: 'Guadeloupe', value: 'GP'},
{label: 'Guam', value: 'GU'},
{label: 'Guatemala', value: 'GT'},
{label: 'Guernsey', value: 'GG'},
{label: 'Guinea', value: 'GN'},
{label: 'Guinea-Bissau', value: 'GW'},
{label: 'Guyana', value: 'GY'},
{label: 'Haiti', value: 'HT'},
{label: 'Heard Island and Mcdonald Islands', value: 'HM'},
{label: 'Holy See (Vatican City State)', value: 'VA'},
{label: 'Honduras', value: 'HN'},
{label: 'Hong Kong', value: 'HK'},
{label: 'Hungary', value: 'HU'},
{label: 'Iceland', value: 'IS'},
{label: 'India', value: 'IN'},
{label: 'Indonesia', value: 'ID'},
{label: 'Iran, Islamic Republic Of', value: 'IR'},
{label: 'Iraq', value: 'IQ'},
{label: 'Ireland', value: 'IE'},
{label: 'Isle of Man', value: 'IM'},
{label: 'Israel', value: 'IL'},
{label: 'Italy', value: 'IT'},
{label: 'Jamaica', value: 'JM'},
{label: 'Japan', value: 'JP'},
{label: 'Jersey', value: 'JE'},
{label: 'Jordan', value: 'JO'},
{label: 'Kazakhstan', value: 'KZ'},
{label: 'Kenya', value: 'KE'},
{label: 'Kiribati', value: 'KI'},
{label: 'Korea, Democratic People\'S Republic of', value: 'KP'},
{label: 'Korea, Republic of', value: 'KR'},
{label: 'Kuwait', value: 'KW'},
{label: 'Kyrgyzstan', value: 'KG'},
{label: 'Lao People\'S Democratic Republic', value: 'LA'},
{label: 'Latvia', value: 'LV'},
{label: 'Lebanon', value: 'LB'},
{label: 'Lesotho', value: 'LS'},
{label: 'Liberia', value: 'LR'},
{label: 'Libyan Arab Jamahiriya', value: 'LY'},
{label: 'Liechtenstein', value: 'LI'},
{label: 'Lithuania', value: 'LT'},
{label: 'Luxembourg', value: 'LU'},
{label: 'Macao', value: 'MO'},
{label: 'Macedonia, The Former Yugoslav Republic of', value: 'MK'},
{label: 'Madagascar', value: 'MG'},
{label: 'Malawi', value: 'MW'},
{label: 'Malaysia', value: 'MY'},
{label: 'Maldives', value: 'MV'},
{label: 'Mali', value: 'ML'},
{label: 'Malta', value: 'MT'},
{label: 'Marshall Islands', value: 'MH'},
{label: 'Martinique', value: 'MQ'},
{label: 'Mauritania', value: 'MR'},
{label: 'Mauritius', value: 'MU'},
{label: 'Mayotte', value: 'YT'},
{label: 'Mexico', value: 'MX'},
{label: 'Micronesia, Federated States of', value: 'FM'},
{label: 'Moldova, Republic of', value: 'MD'},
{label: 'Monaco', value: 'MC'},
{label: 'Mongolia', value: 'MN'},
{label: 'Montserrat', value: 'MS'},
{label: 'Morocco', value: 'MA'},
{label: 'Mozambique', value: 'MZ'},
{label: 'Myanmar', value: 'MM'},
{label: 'Namibia', value: 'NA'},
{label: 'Nauru', value: 'NR'},
{label: 'Nepal', value: 'NP'},
{label: 'Netherlands', value: 'NL'},
{label: 'Netherlands Antilles', value: 'AN'},
{label: 'New Caledonia', value: 'NC'},
{label: 'New Zealand', value: 'NZ'},
{label: 'Nicaragua', value: 'NI'},
{label: 'Niger', value: 'NE'},
{label: 'Nigeria', value: 'NG'},
{label: 'Niue', value: 'NU'},
{label: 'Norfolk Island', value: 'NF'},
{label: 'Northern Mariana Islands', value: 'MP'},
{label: 'Norway', value: 'NO'},
{label: 'Oman', value: 'OM'},
{label: 'Pakistan', value: 'PK'},
{label: 'Palau', value: 'PW'},
{label: 'Palestinian Territory, Occupied', value: 'PS'},
{label: 'Panama', value: 'PA'},
{label: 'Papua New Guinea', value: 'PG'},
{label: 'Paraguay', value: 'PY'},
{label: 'Peru', value: 'PE'},
{label: 'Philippines', value: 'PH'},
{label: 'Pitcairn', value: 'PN'},
{label: 'Poland', value: 'PL'},
{label: 'Portugal', value: 'PT'},
{label: 'Puerto Rico', value: 'PR'},
{label: 'Qatar', value: 'QA'},
{label: 'Reunion', value: 'RE'},
{label: 'Romania', value: 'RO'},
{label: 'Russian Federation', value: 'RU'},
{label: 'RWANDA', value: 'RW'},
{label: 'Saint Helena', value: 'SH'},
{label: 'Saint Kitts and Nevis', value: 'KN'},
{label: 'Saint Lucia', value: 'LC'},
{label: 'Saint Pierre and Miquelon', value: 'PM'},
{label: 'Saint Vincent and the Grenadines', value: 'VC'},
{label: 'Samoa', value: 'WS'},
{label: 'San Marino', value: 'SM'},
{label: 'Sao Tome and Principe', value: 'ST'},
{label: 'Saudi Arabia', value: 'SA'},
{label: 'Senegal', value: 'SN'},
{label: 'Serbia and Montenegro', value: 'CS'},
{label: 'Seychelles', value: 'SC'},
{label: 'Sierra Leone', value: 'SL'},
{label: 'Singapore', value: 'SG'},
{label: 'Slovakia', value: 'SK'},
{label: 'Slovenia', value: 'SI'},
{label: 'Solomon Islands', value: 'SB'},
{label: 'Somalia', value: 'SO'},
{label: 'South Africa', value: 'ZA'},
{label: 'South Georgia and the South Sandwich Islands', value: 'GS'},
{label: 'Spain', value: 'ES'},
{label: 'Sri Lanka', value: 'LK'},
{label: 'Sudan', value: 'SD'},
{label: 'Surilabel', value: 'SR'},
{label: 'Svalbard and Jan Mayen', value: 'SJ'},
{label: 'Swaziland', value: 'SZ'},
{label: 'Sweden', value: 'SE'},
{label: 'Switzerland', value: 'CH'},
{label: 'Syrian Arab Republic', value: 'SY'},
{label: 'Taiwan, Province of China', value: 'TW'},
{label: 'Tajikistan', value: 'TJ'},
{label: 'Tanzania, United Republic of', value: 'TZ'},
{label: 'Thailand', value: 'TH'},
{label: 'Timor-Leste', value: 'TL'},
{label: 'Togo', value: 'TG'},
{label: 'Tokelau', value: 'TK'},
{label: 'Tonga', value: 'TO'},
{label: 'Trinidad and Tobago', value: 'TT'},
{label: 'Tunisia', value: 'TN'},
{label: 'Turkey', value: 'TR'},
{label: 'Turkmenistan', value: 'TM'},
{label: 'Turks and Caicos Islands', value: 'TC'},
{label: 'Tuvalu', value: 'TV'},
{label: 'Uganda', value: 'UG'},
{label: 'Ukraine', value: 'UA'},
{label: 'United Arab Emirates', value: 'AE'},
{label: 'United Kingdom', value: 'GB'},
{label: 'United States', value: 'US'},
{label: 'United States Minor Outlying Islands', value: 'UM'},
{label: 'Uruguay', value: 'UY'},
{label: 'Uzbekistan', value: 'UZ'},
{label: 'Vanuatu', value: 'VU'},
{label: 'Venezuela', value: 'VE'},
{label: 'Viet Nam', value: 'VN'},
{label: 'Virgin Islands, British', value: 'VG'},
{label: 'Virgin Islands, U.S.', value: 'VI'},
{label: 'Wallis and Futuna', value: 'WF'},
{label: 'Western Sahara', value: 'EH'},
{label: 'Yemen', value: 'YE'},
{label: 'Zambia', value: 'ZM'},
{label: 'Zimbabwe', value: 'ZW'}
]
}
]
},
{
name: 'thumbnail',
type: 'upload',
label: 'Thumbnail',
relationTo: 'media',
admin: {
position: 'sidebar'
}
},
{
name: 'gallery',
label: 'Image Gallery',
type: 'array',
admin: {
position: 'sidebar'
},
minRows: 1, // Optional: requires at least one image
labels: {
singular: 'Image',
plural: 'Images',
},
fields: [
{
name: 'image',
type: 'upload',
relationTo: 'media', // Must match your Media collection slug
required: true,
},
{
name: 'caption',
type: 'text', // Optional: add extra data per image
localized: true
},
],
},
{
name: 'Youtube',
type: 'text',
admin: {
position: 'sidebar'
}
},
{
name: 'Tags',
type: 'array',
admin: {
position: 'sidebar'
},
fields: [
{
name: 'Tag',
type: 'text'
}
]
},
{
name: 'content',
type: 'richText',
localized: true,
editor: lexicalEditor({
features: ({ defaultFeatures, rootFeatures }) => [
...defaultFeatures,
]
}),
},
{
name: 'body',
type: 'textarea',
localized: true,
admin: {
description: 'Automatically generated Markdown',
readOnly: true,
hidden: true,
},
hooks: {
beforeChange: [
async ({ siblingData, req }) => {
// Ensure rich text data exists before attempting conversion
if (!siblingData?.content) return undefined
try {
// Generate the necessary editor configuration framework
const editorConfig = await editorConfigFactory.default({
config: req.payload.config,
})
// Transform the Lexical JSON payload into a clean string
const markdownString = convertLexicalToMarkdown({
data: siblingData.content,
editorConfig,
})
return markdownString
} catch (error) {
req.payload.logger.error(`Markdown conversion failed: ${error}`)
return undefined
}
},
],
},
}
],
}

View File

@ -0,0 +1,28 @@
import type { SerializedEditorState } from '@payloadcms/richtext-lexical/lexical'
import type { CollectionConfig, RichTextField } from 'payload'
import {
convertLexicalToMarkdown,
editorConfigFactory,
lexicalEditor,
} from '@payloadcms/richtext-lexical'
export const Locales: CollectionConfig = {
slug: 'locales',
access: {
read: () => true,
},
admin: {
useAsTitle: 'name',
},
fields: [
{
name: 'code',
type: 'text'
},
{
name: 'name',
type: 'text'
},
]
}

View File

@ -1,4 +1,5 @@
import type { SerializedEditorState } from '@payloadcms/richtext-lexical/lexical' import type { SerializedEditorState } from '@payloadcms/richtext-lexical/lexical'
import { slugField } from 'payload'
import type { CollectionConfig, RichTextField } from 'payload' import type { CollectionConfig, RichTextField } from 'payload'
import { import {
@ -9,49 +10,343 @@ import {
export const News: CollectionConfig = { export const News: CollectionConfig = {
slug: 'news', slug: 'news',
upload: true,
access: { access: {
read: () => true, read: () => true,
}, },
versions: {
drafts: true,
maxPerDoc: 10
},
fields: [ fields: [
{
name:'thumbnail',
type: 'upload',
relationTo: 'news'
},
{ {
name: 'title', name: 'title',
type: 'text', type: 'text',
localized: true localized: true
}, },
slugField(),
{ {
name: 'date', name: 'locale',
type: 'date' type: 'text',
localized: true,
defaultValue: ({locale}) => {
return locale
},
admin: {
hidden: true,
position: 'sidebar',
},
}, },
{ {
name: 'order', type: 'row',
type: 'number' fields: [
{
name: 'date',
type: 'date',
admin: {
width: '33%'
},
},
{
name: 'order',
type: 'number',
admin: {
width: '33%'
},
},
{
name: 'place',
type: 'text',
admin: {
width: '34%'
}
},
]
}, },
{ {
name: 'city', type: 'row',
type: 'text', fields: [
{
name: 'city',
type: 'text',
admin: {
width: '33%'
}
},
{
name: 'state',
type: 'text',
admin: {
width: '33%'
}
},
{
name: 'country',
type: 'select',
options: [
{label: 'Afghanistan', value: 'AF'},
{label: 'Åland Islands', value: 'AX'},
{label: 'Albania', value: 'AL'},
{label: 'Algeria', value: 'DZ'},
{label: 'American Samoa', value: 'AS'},
{label: 'AndorrA', value: 'AD'},
{label: 'Angola', value: 'AO'},
{label: 'Anguilla', value: 'AI'},
{label: 'Antarctica', value: 'AQ'},
{label: 'Antigua and Barbuda', value: 'AG'},
{label: 'Argentina', value: 'AR'},
{label: 'Armenia', value: 'AM'},
{label: 'Aruba', value: 'AW'},
{label: 'Australia', value: 'AU'},
{label: 'Austria', value: 'AT'},
{label: 'Azerbaijan', value: 'AZ'},
{label: 'Bahamas', value: 'BS'},
{label: 'Bahrain', value: 'BH'},
{label: 'Bangladesh', value: 'BD'},
{label: 'Barbados', value: 'BB'},
{label: 'Belarus', value: 'BY'},
{label: 'Belgium', value: 'BE'},
{label: 'Belize', value: 'BZ'},
{label: 'Benin', value: 'BJ'},
{label: 'Bermuda', value: 'BM'},
{label: 'Bhutan', value: 'BT'},
{label: 'Bolivia', value: 'BO'},
{label: 'Bosnia and Herzegovina', value: 'BA'},
{label: 'Botswana', value: 'BW'},
{label: 'Bouvet Island', value: 'BV'},
{label: 'Brazil', value: 'BR'},
{label: 'British Indian Ocean Territory', value: 'IO'},
{label: 'Brunei Darussalam', value: 'BN'},
{label: 'Bulgaria', value: 'BG'},
{label: 'Burkina Faso', value: 'BF'},
{label: 'Burundi', value: 'BI'},
{label: 'Cambodia', value: 'KH'},
{label: 'Cameroon', value: 'CM'},
{label: 'Canada', value: 'CA'},
{label: 'Cape Verde', value: 'CV'},
{label: 'Cayman Islands', value: 'KY'},
{label: 'Central African Republic', value: 'CF'},
{label: 'Chad', value: 'TD'},
{label: 'Chile', value: 'CL'},
{label: 'China', value: 'CN'},
{label: 'Christmas Island', value: 'CX'},
{label: 'Cocos (Keeling) Islands', value: 'CC'},
{label: 'Colombia', value: 'CO'},
{label: 'Comoros', value: 'KM'},
{label: 'Congo', value: 'CG'},
{label: 'Congo, The Democratic Republic of the', value: 'CD'},
{label: 'Cook Islands', value: 'CK'},
{label: 'Costa Rica', value: 'CR'},
{label: 'Cote D\'Ivoire', value: 'CI'},
{label: 'Croatia', value: 'HR'},
{label: 'Cuba', value: 'CU'},
{label: 'Cyprus', value: 'CY'},
{label: 'Czech Republic', value: 'CZ'},
{label: 'Denmark', value: 'DK'},
{label: 'Djibouti', value: 'DJ'},
{label: 'Dominica', value: 'DM'},
{label: 'Dominican Republic', value: 'DO'},
{label: 'Ecuador', value: 'EC'},
{label: 'Egypt', value: 'EG'},
{label: 'El Salvador', value: 'SV'},
{label: 'Equatorial Guinea', value: 'GQ'},
{label: 'Eritrea', value: 'ER'},
{label: 'Estonia', value: 'EE'},
{label: 'Ethiopia', value: 'ET'},
{label: 'Falkland Islands (Malvinas)', value: 'FK'},
{label: 'Faroe Islands', value: 'FO'},
{label: 'Fiji', value: 'FJ'},
{label: 'Finland', value: 'FI'},
{label: 'France', value: 'FR'},
{label: 'French Guiana', value: 'GF'},
{label: 'French Polynesia', value: 'PF'},
{label: 'French Southern Territories', value: 'TF'},
{label: 'Gabon', value: 'GA'},
{label: 'Gambia', value: 'GM'},
{label: 'Georgia', value: 'GE'},
{label: 'Germany', value: 'DE'},
{label: 'Ghana', value: 'GH'},
{label: 'Gibraltar', value: 'GI'},
{label: 'Greece', value: 'GR'},
{label: 'Greenland', value: 'GL'},
{label: 'Grenada', value: 'GD'},
{label: 'Guadeloupe', value: 'GP'},
{label: 'Guam', value: 'GU'},
{label: 'Guatemala', value: 'GT'},
{label: 'Guernsey', value: 'GG'},
{label: 'Guinea', value: 'GN'},
{label: 'Guinea-Bissau', value: 'GW'},
{label: 'Guyana', value: 'GY'},
{label: 'Haiti', value: 'HT'},
{label: 'Heard Island and Mcdonald Islands', value: 'HM'},
{label: 'Holy See (Vatican City State)', value: 'VA'},
{label: 'Honduras', value: 'HN'},
{label: 'Hong Kong', value: 'HK'},
{label: 'Hungary', value: 'HU'},
{label: 'Iceland', value: 'IS'},
{label: 'India', value: 'IN'},
{label: 'Indonesia', value: 'ID'},
{label: 'Iran, Islamic Republic Of', value: 'IR'},
{label: 'Iraq', value: 'IQ'},
{label: 'Ireland', value: 'IE'},
{label: 'Isle of Man', value: 'IM'},
{label: 'Israel', value: 'IL'},
{label: 'Italy', value: 'IT'},
{label: 'Jamaica', value: 'JM'},
{label: 'Japan', value: 'JP'},
{label: 'Jersey', value: 'JE'},
{label: 'Jordan', value: 'JO'},
{label: 'Kazakhstan', value: 'KZ'},
{label: 'Kenya', value: 'KE'},
{label: 'Kiribati', value: 'KI'},
{label: 'Korea, Democratic People\'S Republic of', value: 'KP'},
{label: 'Korea, Republic of', value: 'KR'},
{label: 'Kuwait', value: 'KW'},
{label: 'Kyrgyzstan', value: 'KG'},
{label: 'Lao People\'S Democratic Republic', value: 'LA'},
{label: 'Latvia', value: 'LV'},
{label: 'Lebanon', value: 'LB'},
{label: 'Lesotho', value: 'LS'},
{label: 'Liberia', value: 'LR'},
{label: 'Libyan Arab Jamahiriya', value: 'LY'},
{label: 'Liechtenstein', value: 'LI'},
{label: 'Lithuania', value: 'LT'},
{label: 'Luxembourg', value: 'LU'},
{label: 'Macao', value: 'MO'},
{label: 'Macedonia, The Former Yugoslav Republic of', value: 'MK'},
{label: 'Madagascar', value: 'MG'},
{label: 'Malawi', value: 'MW'},
{label: 'Malaysia', value: 'MY'},
{label: 'Maldives', value: 'MV'},
{label: 'Mali', value: 'ML'},
{label: 'Malta', value: 'MT'},
{label: 'Marshall Islands', value: 'MH'},
{label: 'Martinique', value: 'MQ'},
{label: 'Mauritania', value: 'MR'},
{label: 'Mauritius', value: 'MU'},
{label: 'Mayotte', value: 'YT'},
{label: 'Mexico', value: 'MX'},
{label: 'Micronesia, Federated States of', value: 'FM'},
{label: 'Moldova, Republic of', value: 'MD'},
{label: 'Monaco', value: 'MC'},
{label: 'Mongolia', value: 'MN'},
{label: 'Montserrat', value: 'MS'},
{label: 'Morocco', value: 'MA'},
{label: 'Mozambique', value: 'MZ'},
{label: 'Myanmar', value: 'MM'},
{label: 'Namibia', value: 'NA'},
{label: 'Nauru', value: 'NR'},
{label: 'Nepal', value: 'NP'},
{label: 'Netherlands', value: 'NL'},
{label: 'Netherlands Antilles', value: 'AN'},
{label: 'New Caledonia', value: 'NC'},
{label: 'New Zealand', value: 'NZ'},
{label: 'Nicaragua', value: 'NI'},
{label: 'Niger', value: 'NE'},
{label: 'Nigeria', value: 'NG'},
{label: 'Niue', value: 'NU'},
{label: 'Norfolk Island', value: 'NF'},
{label: 'Northern Mariana Islands', value: 'MP'},
{label: 'Norway', value: 'NO'},
{label: 'Oman', value: 'OM'},
{label: 'Pakistan', value: 'PK'},
{label: 'Palau', value: 'PW'},
{label: 'Palestinian Territory, Occupied', value: 'PS'},
{label: 'Panama', value: 'PA'},
{label: 'Papua New Guinea', value: 'PG'},
{label: 'Paraguay', value: 'PY'},
{label: 'Peru', value: 'PE'},
{label: 'Philippines', value: 'PH'},
{label: 'Pitcairn', value: 'PN'},
{label: 'Poland', value: 'PL'},
{label: 'Portugal', value: 'PT'},
{label: 'Puerto Rico', value: 'PR'},
{label: 'Qatar', value: 'QA'},
{label: 'Reunion', value: 'RE'},
{label: 'Romania', value: 'RO'},
{label: 'Russian Federation', value: 'RU'},
{label: 'RWANDA', value: 'RW'},
{label: 'Saint Helena', value: 'SH'},
{label: 'Saint Kitts and Nevis', value: 'KN'},
{label: 'Saint Lucia', value: 'LC'},
{label: 'Saint Pierre and Miquelon', value: 'PM'},
{label: 'Saint Vincent and the Grenadines', value: 'VC'},
{label: 'Samoa', value: 'WS'},
{label: 'San Marino', value: 'SM'},
{label: 'Sao Tome and Principe', value: 'ST'},
{label: 'Saudi Arabia', value: 'SA'},
{label: 'Senegal', value: 'SN'},
{label: 'Serbia and Montenegro', value: 'CS'},
{label: 'Seychelles', value: 'SC'},
{label: 'Sierra Leone', value: 'SL'},
{label: 'Singapore', value: 'SG'},
{label: 'Slovakia', value: 'SK'},
{label: 'Slovenia', value: 'SI'},
{label: 'Solomon Islands', value: 'SB'},
{label: 'Somalia', value: 'SO'},
{label: 'South Africa', value: 'ZA'},
{label: 'South Georgia and the South Sandwich Islands', value: 'GS'},
{label: 'Spain', value: 'ES'},
{label: 'Sri Lanka', value: 'LK'},
{label: 'Sudan', value: 'SD'},
{label: 'Surilabel', value: 'SR'},
{label: 'Svalbard and Jan Mayen', value: 'SJ'},
{label: 'Swaziland', value: 'SZ'},
{label: 'Sweden', value: 'SE'},
{label: 'Switzerland', value: 'CH'},
{label: 'Syrian Arab Republic', value: 'SY'},
{label: 'Taiwan, Province of China', value: 'TW'},
{label: 'Tajikistan', value: 'TJ'},
{label: 'Tanzania, United Republic of', value: 'TZ'},
{label: 'Thailand', value: 'TH'},
{label: 'Timor-Leste', value: 'TL'},
{label: 'Togo', value: 'TG'},
{label: 'Tokelau', value: 'TK'},
{label: 'Tonga', value: 'TO'},
{label: 'Trinidad and Tobago', value: 'TT'},
{label: 'Tunisia', value: 'TN'},
{label: 'Turkey', value: 'TR'},
{label: 'Turkmenistan', value: 'TM'},
{label: 'Turks and Caicos Islands', value: 'TC'},
{label: 'Tuvalu', value: 'TV'},
{label: 'Uganda', value: 'UG'},
{label: 'Ukraine', value: 'UA'},
{label: 'United Arab Emirates', value: 'AE'},
{label: 'United Kingdom', value: 'GB'},
{label: 'United States', value: 'US'},
{label: 'United States Minor Outlying Islands', value: 'UM'},
{label: 'Uruguay', value: 'UY'},
{label: 'Uzbekistan', value: 'UZ'},
{label: 'Vanuatu', value: 'VU'},
{label: 'Venezuela', value: 'VE'},
{label: 'Viet Nam', value: 'VN'},
{label: 'Virgin Islands, British', value: 'VG'},
{label: 'Virgin Islands, U.S.', value: 'VI'},
{label: 'Wallis and Futuna', value: 'WF'},
{label: 'Western Sahara', value: 'EH'},
{label: 'Yemen', value: 'YE'},
{label: 'Zambia', value: 'ZM'},
{label: 'Zimbabwe', value: 'ZW'}
]
}
]
}, },
{ {
name: 'state', name: 'thumbnail',
type: 'text', type: 'upload',
}, label: 'Thumbnail',
{ relationTo: 'media',
name: 'country', admin: {
type: 'text', position: 'sidebar'
}, }
{
name: 'slug',
type: 'text',
}, },
{ {
name: 'gallery', name: 'gallery',
label: 'Image Gallery', label: 'Image Gallery',
type: 'array', type: 'array',
admin: {
position: 'sidebar'
},
minRows: 1, // Optional: requires at least one image minRows: 1, // Optional: requires at least one image
labels: { labels: {
singular: 'Image', singular: 'Image',
@ -72,48 +367,70 @@ export const News: CollectionConfig = {
], ],
}, },
{ {
name: 'content', name: 'Youtube',
type: 'richText', type: 'text',
localized: true admin: {
position: 'sidebar'
}
}, },
{ {
name: 'markdown', name: 'Tags',
type: 'array',
admin: {
position: 'sidebar'
},
fields: [
{
name: 'Tag',
type: 'text'
}
]
},
{
name: 'content',
type: 'richText',
localized: true,
editor: lexicalEditor({
features: ({ defaultFeatures, rootFeatures }) => [
...defaultFeatures,
]
}),
},
{
name: 'body',
type: 'textarea', type: 'textarea',
localized: true, localized: true,
admin: { admin: {
description: 'Automatically generated Markdown',
readOnly: true,
hidden: true, hidden: true,
}, },
hooks: { hooks: {
afterRead: [
({ siblingData, siblingFields }) => {
const data: SerializedEditorState =
siblingData['content']
if (!data) {
return ''
}
const markdown = convertLexicalToMarkdown({
data,
editorConfig: editorConfigFactory.fromField({
field: siblingFields.find(
(field) =>
'name' in field && field.name === 'content',
) as RichTextField,
}),
})
return markdown
},
],
beforeChange: [ beforeChange: [
({ siblingData }) => { async ({ siblingData, req }) => {
// Ensure that the markdown field is not saved in the database // Ensure rich text data exists before attempting conversion
delete siblingData['markdown'] if (!siblingData?.content) return undefined
return null
try {
// Generate the necessary editor configuration framework
const editorConfig = await editorConfigFactory.default({
config: req.payload.config,
})
// Transform the Lexical JSON payload into a clean string
const markdownString = convertLexicalToMarkdown({
data: siblingData.content,
editorConfig,
})
return markdownString
} catch (error) {
req.payload.logger.error(`Markdown conversion failed: ${error}`)
return undefined
}
}, },
], ],
}, },
}, }
], ],
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,9 @@
import { s3Storage } from '@payloadcms/storage-s3' import { s3Storage } from '@payloadcms/storage-s3'
import { sqliteAdapter } from '@payloadcms/db-sqlite' import { sqliteAdapter } from '@payloadcms/db-sqlite'
import { postgresAdapter } from '@payloadcms/db-postgres' import { postgresAdapter } from '@payloadcms/db-postgres'
import { lexicalEditor } from '@payloadcms/richtext-lexical' import { FixedToolbarFeature, lexicalEditor } from '@payloadcms/richtext-lexical';
import { importExportPlugin } from '@payloadcms/plugin-import-export'
import path from 'path' import path from 'path'
import { buildConfig } from 'payload' import { buildConfig } from 'payload'
import { fileURLToPath } from 'url' import { fileURLToPath } from 'url'
@ -10,6 +12,7 @@ import sharp from 'sharp'
import { Users } from './collections/Users' import { Users } from './collections/Users'
import { Media } from './collections/Media' import { Media } from './collections/Media'
import { News } from './collections/News' import { News } from './collections/News'
import { Editorial } from './collections/Editorial'
const filename = fileURLToPath(import.meta.url) const filename = fileURLToPath(import.meta.url)
const dirname = path.dirname(filename) const dirname = path.dirname(filename)
@ -21,7 +24,7 @@ export default buildConfig({
baseDir: path.resolve(dirname), baseDir: path.resolve(dirname),
}, },
}, },
collections: [Users, Media, News], collections: [Users, Media, News, Editorial],
editor: lexicalEditor(), editor: lexicalEditor(),
secret: process.env.PAYLOAD_SECRET || '', secret: process.env.PAYLOAD_SECRET || '',
typescript: { typescript: {
@ -51,13 +54,6 @@ export default buildConfig({
return `${process.env.R2_PUBLIC_URL}/${key}` return `${process.env.R2_PUBLIC_URL}/${key}`
}, },
}, },
news: {
disablePayloadAccessControl: true,
generateFileURL: ({ filename, prefix }) => {
const key = prefix ? `${prefix}/${filename}` : filename
return `${process.env.R2_PUBLIC_URL}/${key}`
},
},
}, },
bucket: process.env.R2_BUCKET, bucket: process.env.R2_BUCKET,
config: { config: {
@ -71,9 +67,30 @@ export default buildConfig({
forcePathStyle: true, forcePathStyle: true,
}, },
}), }),
importExportPlugin({
collections: [{ slug: 'news' }, { slug: 'editorial' }],
// see below for a list of available options
}),
], ],
localization: { localization: {
locales: ['es','en','fr','pt'], locales: [
{
code: 'es',
label: 'Español'
},
{
code: 'en',
label: 'English',
},
{
code: 'pt',
label: 'Portugues'
},
{
code: 'fr',
label: 'French'
},
],
defaultLocale: 'es' defaultLocale: 'es'
} }
}) })