Add type casting for post content in RichText component
This commit is contained in:
@@ -7,6 +7,7 @@ import { getPayload } from 'payload'
|
|||||||
import { draftMode } from 'next/headers'
|
import { draftMode } from 'next/headers'
|
||||||
import React, { cache } from 'react'
|
import React, { cache } from 'react'
|
||||||
import RichText from '@/components/RichText'
|
import RichText from '@/components/RichText'
|
||||||
|
import type { DefaultTypedEditorState } from '@payloadcms/richtext-lexical'
|
||||||
|
|
||||||
import type { Post } from '@/payload-types'
|
import type { Post } from '@/payload-types'
|
||||||
|
|
||||||
@@ -62,7 +63,11 @@ export default async function Post({ params: paramsPromise }: Args) {
|
|||||||
|
|
||||||
<div className="flex flex-col items-center gap-4 pt-8">
|
<div className="flex flex-col items-center gap-4 pt-8">
|
||||||
<div className="container">
|
<div className="container">
|
||||||
<RichText className="max-w-[48rem] mx-auto" data={post.content} enableGutter={false} />
|
<RichText
|
||||||
|
className="max-w-[48rem] mx-auto"
|
||||||
|
data={post.content as DefaultTypedEditorState}
|
||||||
|
enableGutter={false}
|
||||||
|
/>
|
||||||
{post.relatedPosts && post.relatedPosts.length > 0 && (
|
{post.relatedPosts && post.relatedPosts.length > 0 && (
|
||||||
<RelatedPosts
|
<RelatedPosts
|
||||||
className="mt-12 max-w-[52rem] lg:grid lg:grid-cols-subgrid col-start-1 col-span-3 grid-rows-[2fr]"
|
className="mt-12 max-w-[52rem] lg:grid lg:grid-cols-subgrid col-start-1 col-span-3 grid-rows-[2fr]"
|
||||||
|
|||||||
Reference in New Issue
Block a user