fix: move away from deprecated lexicalHTML and use RichText component
This commit is contained in:
parent
bb1869ab05
commit
aefea1e538
9 changed files with 17 additions and 39 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
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 { FixedToolbarFeatureClient as FixedToolbarFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
|
||||||
import { InlineToolbarFeatureClient as InlineToolbarFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
|
import { InlineToolbarFeatureClient as InlineToolbarFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
|
||||||
import { ParagraphFeatureClient as ParagraphFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
|
import { ParagraphFeatureClient as ParagraphFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
|
||||||
import { LinkFeatureClient as LinkFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
|
import { LinkFeatureClient as LinkFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
|
||||||
|
|
@ -18,6 +19,7 @@ export const importMap = {
|
||||||
"@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#FixedToolbarFeatureClient": FixedToolbarFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
|
||||||
"@payloadcms/richtext-lexical/client#InlineToolbarFeatureClient": InlineToolbarFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
|
"@payloadcms/richtext-lexical/client#InlineToolbarFeatureClient": InlineToolbarFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
|
||||||
"@payloadcms/richtext-lexical/client#ParagraphFeatureClient": ParagraphFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
|
"@payloadcms/richtext-lexical/client#ParagraphFeatureClient": ParagraphFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
|
||||||
"@payloadcms/richtext-lexical/client#LinkFeatureClient": LinkFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
|
"@payloadcms/richtext-lexical/client#LinkFeatureClient": LinkFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ import { ParagraphBlock } from '@/collections/blocks/Paragraph'
|
||||||
import { GalleryBlock } from '@/collections/blocks/Gallery'
|
import { GalleryBlock } from '@/collections/blocks/Gallery'
|
||||||
import { ContactformBlock } from '@/collections/blocks/Contactform'
|
import { ContactformBlock } from '@/collections/blocks/Contactform'
|
||||||
import { DocumentBlock } from '@/collections/blocks/Document'
|
import { DocumentBlock } from '@/collections/blocks/Document'
|
||||||
import { lexicalHTML } from '@payloadcms/richtext-lexical'
|
|
||||||
import { DonationBlock } from '@/collections/blocks/Donation'
|
import { DonationBlock } from '@/collections/blocks/Donation'
|
||||||
import { ButtonBlock } from '@/collections/blocks/Button'
|
import { ButtonBlock } from '@/collections/blocks/Button'
|
||||||
import { YoutubePlayerBlock } from '@/collections/blocks/YoutubePlayer'
|
import { YoutubePlayerBlock } from '@/collections/blocks/YoutubePlayer'
|
||||||
|
|
@ -61,7 +60,6 @@ export const Groups: CollectionConfig = {
|
||||||
},
|
},
|
||||||
required: false,
|
required: false,
|
||||||
},
|
},
|
||||||
lexicalHTML('text', { name: 'text_html' }),
|
|
||||||
{
|
{
|
||||||
name: 'content',
|
name: 'content',
|
||||||
type: 'blocks',
|
type: 'blocks',
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import { Block } from 'payload'
|
import { Block } from 'payload'
|
||||||
import { lexicalHTML } from '@payloadcms/richtext-lexical'
|
|
||||||
|
|
||||||
export const CollapsibleImageWithTextBlock: Block = {
|
export const CollapsibleImageWithTextBlock: Block = {
|
||||||
slug: 'collapsibleImageWithText',
|
slug: 'collapsibleImageWithText',
|
||||||
|
|
@ -45,7 +44,6 @@ export const CollapsibleImageWithTextBlock: Block = {
|
||||||
de: 'Aufklappbarer Inhalt',
|
de: 'Aufklappbarer Inhalt',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
lexicalHTML('content', { name: 'content_html' }),
|
|
||||||
{
|
{
|
||||||
name: 'backgroundColor',
|
name: 'backgroundColor',
|
||||||
type: 'select',
|
type: 'select',
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import { Block } from 'payload'
|
import { Block } from 'payload'
|
||||||
import { lexicalHTML } from '@payloadcms/richtext-lexical'
|
|
||||||
|
|
||||||
export const ParagraphBlock: Block = {
|
export const ParagraphBlock: Block = {
|
||||||
slug: 'text',
|
slug: 'text',
|
||||||
|
|
@ -17,7 +16,6 @@ export const ParagraphBlock: Block = {
|
||||||
type: 'richText',
|
type: 'richText',
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
lexicalHTML('content', { name: 'content_html' }),
|
|
||||||
{
|
{
|
||||||
name: 'width',
|
name: 'width',
|
||||||
label: {
|
label: {
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,20 @@
|
||||||
import styles from "./html.module.scss"
|
import styles from "./html.module.scss"
|
||||||
import { RawHTML } from '@/components/RawHTML/RawHTML'
|
|
||||||
import classNames from 'classnames'
|
import classNames from 'classnames'
|
||||||
|
import { RichText } from '@payloadcms/richtext-lexical/react'
|
||||||
|
import { SerializedEditorState, SerializedLexicalNode } from 'lexical'
|
||||||
|
|
||||||
type HTMLTextProps = {
|
type HTMLTextProps = {
|
||||||
width: "1/2" | "3/4",
|
width: "1/2" | "3/4",
|
||||||
html: string
|
data: SerializedEditorState<SerializedLexicalNode>
|
||||||
}
|
}
|
||||||
|
|
||||||
export const HTMLText = ({width, html}: HTMLTextProps) => {
|
export const HTMLText = ({width, data}: HTMLTextProps) => {
|
||||||
return (
|
return (
|
||||||
<div className={classNames({
|
<div className={classNames({
|
||||||
[styles.half]: width === "1/2",
|
[styles.half]: width === "1/2",
|
||||||
[styles.threeFourth]: width === "3/4"
|
[styles.threeFourth]: width === "3/4"
|
||||||
})}>
|
})}>
|
||||||
<RawHTML html={html} />
|
<RichText data={data} />
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -10,8 +10,6 @@ import { DonationForm } from '@/components/DonationForm/DonationForm'
|
||||||
import { YoutubePlayer } from '@/components/YoutubePlayer/YoutubePlayer'
|
import { YoutubePlayer } from '@/components/YoutubePlayer/YoutubePlayer'
|
||||||
import { PageHeader } from '@/compositions/PageHeader/PageHeader'
|
import { PageHeader } from '@/compositions/PageHeader/PageHeader'
|
||||||
import { Title } from '@/components/Title/Title'
|
import { Title } from '@/components/Title/Title'
|
||||||
import { Row } from '@/components/Flex/Row'
|
|
||||||
import { Col } from '@/components/Flex/Col'
|
|
||||||
import { Banner } from '@/components/Banner/Banner'
|
import { Banner } from '@/components/Banner/Banner'
|
||||||
import { MainText } from '@/components/MainText/MainText'
|
import { MainText } from '@/components/MainText/MainText'
|
||||||
import { HR } from '@/components/HorizontalRule/HorizontalRule'
|
import { HR } from '@/components/HorizontalRule/HorizontalRule'
|
||||||
|
|
@ -35,10 +33,10 @@ export function Blocks({ content }: BlocksProps) {
|
||||||
<>
|
<>
|
||||||
<div>
|
<div>
|
||||||
{content.map(item => {
|
{content.map(item => {
|
||||||
if (item.blockType === 'text' && item.content_html) {
|
if (item.blockType === 'text') {
|
||||||
return (
|
return (
|
||||||
<Container key={item.id}>
|
<Container key={item.id}>
|
||||||
<HTMLText width={item.width} html={item.content_html} />
|
<HTMLText width={item.width} data={item.content} />
|
||||||
</Container>
|
</Container>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -211,8 +209,8 @@ export function Blocks({ content }: BlocksProps) {
|
||||||
backgroundColor={bg}
|
backgroundColor={bg}
|
||||||
schema={item.schema as 'base' | 'contrast' | undefined}
|
schema={item.schema as 'base' | 'contrast' | undefined}
|
||||||
content={
|
content={
|
||||||
item.content_html
|
item.content
|
||||||
? <HTMLText width={'1/2'} html={item.content_html} />
|
? <HTMLText width={'1/2'} data={item.content} />
|
||||||
: <></>
|
: <></>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -23,10 +23,10 @@ export function ParishBlocks({ content }: BlocksProps) {
|
||||||
<>
|
<>
|
||||||
<div>
|
<div>
|
||||||
{content.map(item => {
|
{content.map(item => {
|
||||||
if (item.blockType === "text" && item.content_html) {
|
if (item.blockType === "text") {
|
||||||
return (
|
return (
|
||||||
<Container key={item.id}>
|
<Container key={item.id}>
|
||||||
<HTMLText width={item.width} html={item.content_html} />
|
<HTMLText width={item.width} data={item.content} />
|
||||||
</Container>
|
</Container>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -198,7 +198,6 @@ export interface Parish {
|
||||||
};
|
};
|
||||||
[k: string]: unknown;
|
[k: string]: unknown;
|
||||||
};
|
};
|
||||||
content_html?: string | null;
|
|
||||||
width: '1/2' | '3/4';
|
width: '1/2' | '3/4';
|
||||||
id?: string | null;
|
id?: string | null;
|
||||||
blockName?: string | null;
|
blockName?: string | null;
|
||||||
|
|
@ -415,7 +414,6 @@ export interface Blog {
|
||||||
};
|
};
|
||||||
[k: string]: unknown;
|
[k: string]: unknown;
|
||||||
};
|
};
|
||||||
content_html?: string | null;
|
|
||||||
width: '1/2' | '3/4';
|
width: '1/2' | '3/4';
|
||||||
id?: string | null;
|
id?: string | null;
|
||||||
blockName?: string | null;
|
blockName?: string | null;
|
||||||
|
|
@ -565,7 +563,6 @@ export interface Group {
|
||||||
};
|
};
|
||||||
[k: string]: unknown;
|
[k: string]: unknown;
|
||||||
} | null;
|
} | null;
|
||||||
text_html?: string | null;
|
|
||||||
content?:
|
content?:
|
||||||
| (
|
| (
|
||||||
| {
|
| {
|
||||||
|
|
@ -584,7 +581,6 @@ export interface Group {
|
||||||
};
|
};
|
||||||
[k: string]: unknown;
|
[k: string]: unknown;
|
||||||
};
|
};
|
||||||
content_html?: string | null;
|
|
||||||
width: '1/2' | '3/4';
|
width: '1/2' | '3/4';
|
||||||
id?: string | null;
|
id?: string | null;
|
||||||
blockName?: string | null;
|
blockName?: string | null;
|
||||||
|
|
@ -742,7 +738,6 @@ export interface Page {
|
||||||
};
|
};
|
||||||
[k: string]: unknown;
|
[k: string]: unknown;
|
||||||
};
|
};
|
||||||
content_html?: string | null;
|
|
||||||
width: '1/2' | '3/4';
|
width: '1/2' | '3/4';
|
||||||
id?: string | null;
|
id?: string | null;
|
||||||
blockName?: string | null;
|
blockName?: string | null;
|
||||||
|
|
@ -874,7 +869,6 @@ export interface Page {
|
||||||
};
|
};
|
||||||
[k: string]: unknown;
|
[k: string]: unknown;
|
||||||
};
|
};
|
||||||
content_html?: string | null;
|
|
||||||
backgroundColor?: ('none' | 'soft' | 'off-white') | null;
|
backgroundColor?: ('none' | 'soft' | 'off-white') | null;
|
||||||
schema?: ('base' | 'contrast') | null;
|
schema?: ('base' | 'contrast') | null;
|
||||||
id?: string | null;
|
id?: string | null;
|
||||||
|
|
@ -1117,7 +1111,6 @@ export interface ParishSelect<T extends boolean = true> {
|
||||||
| T
|
| T
|
||||||
| {
|
| {
|
||||||
content?: T;
|
content?: T;
|
||||||
content_html?: T;
|
|
||||||
width?: T;
|
width?: T;
|
||||||
id?: T;
|
id?: T;
|
||||||
blockName?: T;
|
blockName?: T;
|
||||||
|
|
@ -1239,7 +1232,6 @@ export interface BlogSelect<T extends boolean = true> {
|
||||||
| T
|
| T
|
||||||
| {
|
| {
|
||||||
content?: T;
|
content?: T;
|
||||||
content_html?: T;
|
|
||||||
width?: T;
|
width?: T;
|
||||||
id?: T;
|
id?: T;
|
||||||
blockName?: T;
|
blockName?: T;
|
||||||
|
|
@ -1387,7 +1379,6 @@ export interface GroupSelect<T extends boolean = true> {
|
||||||
slug?: T;
|
slug?: T;
|
||||||
shortDescription?: T;
|
shortDescription?: T;
|
||||||
text?: T;
|
text?: T;
|
||||||
text_html?: T;
|
|
||||||
content?:
|
content?:
|
||||||
| T
|
| T
|
||||||
| {
|
| {
|
||||||
|
|
@ -1395,7 +1386,6 @@ export interface GroupSelect<T extends boolean = true> {
|
||||||
| T
|
| T
|
||||||
| {
|
| {
|
||||||
content?: T;
|
content?: T;
|
||||||
content_html?: T;
|
|
||||||
width?: T;
|
width?: T;
|
||||||
id?: T;
|
id?: T;
|
||||||
blockName?: T;
|
blockName?: T;
|
||||||
|
|
@ -1489,7 +1479,6 @@ export interface PagesSelect<T extends boolean = true> {
|
||||||
| T
|
| T
|
||||||
| {
|
| {
|
||||||
content?: T;
|
content?: T;
|
||||||
content_html?: T;
|
|
||||||
width?: T;
|
width?: T;
|
||||||
id?: T;
|
id?: T;
|
||||||
blockName?: T;
|
blockName?: T;
|
||||||
|
|
@ -1611,7 +1600,6 @@ export interface PagesSelect<T extends boolean = true> {
|
||||||
text?: T;
|
text?: T;
|
||||||
image?: T;
|
image?: T;
|
||||||
content?: T;
|
content?: T;
|
||||||
content_html?: T;
|
|
||||||
backgroundColor?: T;
|
backgroundColor?: T;
|
||||||
schema?: T;
|
schema?: T;
|
||||||
id?: T;
|
id?: T;
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import {
|
||||||
AlignFeature,
|
AlignFeature,
|
||||||
UnorderedListFeature,
|
UnorderedListFeature,
|
||||||
LinkFeature,
|
LinkFeature,
|
||||||
HTMLConverterFeature,
|
HTMLConverterFeature, FixedToolbarFeature,
|
||||||
} from '@payloadcms/richtext-lexical'
|
} from '@payloadcms/richtext-lexical'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { buildConfig } from 'payload'
|
import { buildConfig } from 'payload'
|
||||||
|
|
@ -44,6 +44,7 @@ import { Magazine } from '@/collections/Magazine'
|
||||||
import { DonationForms } from '@/collections/DonationForms'
|
import { DonationForms } from '@/collections/DonationForms'
|
||||||
import { Pages } from '@/collections/Pages'
|
import { Pages } from '@/collections/Pages'
|
||||||
import { Prayers } from '@/collections/Prayers'
|
import { Prayers } from '@/collections/Prayers'
|
||||||
|
import { siteConfig } from '@/config/site'
|
||||||
|
|
||||||
const filename = fileURLToPath(import.meta.url)
|
const filename = fileURLToPath(import.meta.url)
|
||||||
const dirname = path.dirname(filename)
|
const dirname = path.dirname(filename)
|
||||||
|
|
@ -53,18 +54,12 @@ export default buildConfig({
|
||||||
user: Users.slug,
|
user: Users.slug,
|
||||||
meta: {
|
meta: {
|
||||||
title: 'Dashboard',
|
title: 'Dashboard',
|
||||||
titleSuffix: '- Heilige Drei Könige'
|
titleSuffix: `- ${siteConfig.shortName}`
|
||||||
},
|
},
|
||||||
importMap: {
|
importMap: {
|
||||||
baseDir: dirname,
|
baseDir: dirname,
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
/*views: {
|
|
||||||
testCustomView: {
|
|
||||||
Component: '/admin/components/test/TestView',
|
|
||||||
path: '/test'
|
|
||||||
},
|
|
||||||
},*/
|
|
||||||
graphics: {
|
graphics: {
|
||||||
Logo: {
|
Logo: {
|
||||||
path: '/components/Logo/Logo',
|
path: '/components/Logo/Logo',
|
||||||
|
|
@ -125,7 +120,7 @@ export default buildConfig({
|
||||||
LinkFeature(),
|
LinkFeature(),
|
||||||
ParagraphFeature(),
|
ParagraphFeature(),
|
||||||
InlineToolbarFeature(),
|
InlineToolbarFeature(),
|
||||||
HTMLConverterFeature()
|
FixedToolbarFeature()
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue