From 63e00a9b9d9305a2524f65e149b669220b1856f3 Mon Sep 17 00:00:00 2001 From: DrMint <29893320+DrMint@users.noreply.github.com> Date: Fri, 1 Mar 2024 00:26:15 +0100 Subject: [PATCH] Rename lines to content --- src/blocks/lineBlock.ts | 3 +-- src/blocks/sectionBlock.ts | 2 +- src/collections/Pages/endpoints/getBySlugEndpoint.ts | 6 +++--- src/types/collections.ts | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/blocks/lineBlock.ts b/src/blocks/lineBlock.ts index 74a86dd..e5e36f0 100644 --- a/src/blocks/lineBlock.ts +++ b/src/blocks/lineBlock.ts @@ -1,6 +1,5 @@ import { Block } from "payload/types"; import { createEditor } from "../utils/editor"; -import { cueBlock } from "./cueBlock"; export const lineBlock: Block = { slug: "lineBlock", @@ -15,7 +14,7 @@ export const lineBlock: Block = { admin: { className: "reduced-margins", }, - editor: createEditor({ inlines: true, lists: true, links: true, blocks: [cueBlock] }), + editor: createEditor({ inlines: true, lists: true, links: true }), }, ], }; diff --git a/src/blocks/sectionBlock.ts b/src/blocks/sectionBlock.ts index 9425b9e..edda8dc 100644 --- a/src/blocks/sectionBlock.ts +++ b/src/blocks/sectionBlock.ts @@ -8,7 +8,7 @@ const generateRecursiveSectionBlock = (depth = 1, maxDepth = 5): Block => ({ labels: { singular: "Section", plural: "Sections" }, fields: [ { - name: "lines", + name: "content", type: "richText", label: false, required: true, diff --git a/src/collections/Pages/endpoints/getBySlugEndpoint.ts b/src/collections/Pages/endpoints/getBySlugEndpoint.ts index 32d1c88..5fc5088 100644 --- a/src/collections/Pages/endpoints/getBySlugEndpoint.ts +++ b/src/collections/Pages/endpoints/getBySlugEndpoint.ts @@ -78,7 +78,7 @@ const handleContent = ( fields: { ...node.fields, anchorHash, - lines: handleContent(node.fields.lines, anchorHash), + content: handleContent(node.fields.content, anchorHash), }, }; } @@ -94,8 +94,8 @@ const handleToc = (content: RichTextContent, parentPrefix = ""): TableOfContentE .filter(isBlockNodeSectionBlock) .map(({ fields }, index) => ({ prefix: `${parentPrefix}${index + 1}.`, - title: fields.blockName, - children: handleToc(fields.lines, `${index + 1}.`), + title: fields.blockName ?? "", + children: handleToc(fields.content, `${index + 1}.`), })); const handleParentPages = ({ diff --git a/src/types/collections.ts b/src/types/collections.ts index 26c2051..d00cfec 100644 --- a/src/types/collections.ts +++ b/src/types/collections.ts @@ -1343,7 +1343,7 @@ export interface TranscriptBlock { * via the `definition` "SectionBlock". */ export interface SectionBlock { - lines: { + content: { root: { children: { type: string;