From 11ac215611c26e8d90821e7248eb33cb11371228 Mon Sep 17 00:00:00 2001 From: DrMint <29893320+DrMint@users.noreply.github.com> Date: Sun, 5 May 2024 08:21:57 +0200 Subject: [PATCH] Fix ts --- src/blocks/breakBlock.ts | 4 ++-- src/blocks/sectionBlock.ts | 6 +++--- src/blocks/transcriptBlock.ts | 4 ++-- src/utils/editor.ts | 5 +++-- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/blocks/breakBlock.ts b/src/blocks/breakBlock.ts index 7613c06..af8ef1a 100644 --- a/src/blocks/breakBlock.ts +++ b/src/blocks/breakBlock.ts @@ -1,7 +1,7 @@ -import { Block } from "payload/types"; +import { LexicalBlock } from "@payloadcms/richtext-lexical"; import { BreakBlockType } from "../constants"; -export const breakBlock: Block = { +export const breakBlock: LexicalBlock = { slug: "breakBlock", interfaceName: "BreakBlock", labels: { singular: "Break", plural: "Breaks" }, diff --git a/src/blocks/sectionBlock.ts b/src/blocks/sectionBlock.ts index f8cbcdc..6fec0e7 100644 --- a/src/blocks/sectionBlock.ts +++ b/src/blocks/sectionBlock.ts @@ -1,9 +1,9 @@ -import { Block } from "payload/types"; +import { LexicalBlock } from "@payloadcms/richtext-lexical"; import { createEditor } from "../utils/editor"; import { breakBlock } from "./breakBlock"; import { transcriptBlock } from "./transcriptBlock"; -const generateRecursiveSectionBlock = (depth = 1, maxDepth = 5): Block => ({ +const generateRecursiveSectionBlock = (depth = 1, maxDepth = 5): LexicalBlock => ({ slug: "sectionBlock", interfaceName: "SectionBlock", labels: { singular: "Section", plural: "Sections" }, @@ -33,4 +33,4 @@ const generateRecursiveSectionBlock = (depth = 1, maxDepth = 5): Block => ({ ], }); -export const sectionBlock: Block = generateRecursiveSectionBlock(); +export const sectionBlock: LexicalBlock = generateRecursiveSectionBlock(); diff --git a/src/blocks/transcriptBlock.ts b/src/blocks/transcriptBlock.ts index 085261d..835079a 100644 --- a/src/blocks/transcriptBlock.ts +++ b/src/blocks/transcriptBlock.ts @@ -1,8 +1,8 @@ -import { Block } from "payload/types"; +import { LexicalBlock } from "@payloadcms/richtext-lexical"; import { cueBlock } from "./cueBlock"; import { lineBlock } from "./lineBlock"; -export const transcriptBlock: Block = { +export const transcriptBlock: LexicalBlock = { slug: "transcriptBlock", interfaceName: "TranscriptBlock", labels: { singular: "Transcript", plural: "Transcripts" }, diff --git a/src/utils/editor.ts b/src/utils/editor.ts index fcdf858..02c26f9 100644 --- a/src/utils/editor.ts +++ b/src/utils/editor.ts @@ -8,6 +8,7 @@ import { HeadingFeature, InlineCodeTextFeature, ItalicTextFeature, + LexicalBlock, LinkFeature, // BlockQuoteFeature, OrderedListFeature, @@ -22,11 +23,11 @@ import { UploadFeature, lexicalEditor, } from "@payloadcms/richtext-lexical"; -import { Block, RichTextAdapter } from "payload/types"; +import { RichTextAdapter } from "payload/types"; interface EditorOptions { debugs: boolean; - blocks: Block[]; + blocks: LexicalBlock[]; headings: boolean; lists: boolean; inlines: boolean;