Rename lines to content

This commit is contained in:
DrMint 2024-03-01 00:26:15 +01:00
parent 18142c7f31
commit 63e00a9b9d
4 changed files with 6 additions and 7 deletions

View File

@ -1,6 +1,5 @@
import { Block } from "payload/types"; import { Block } from "payload/types";
import { createEditor } from "../utils/editor"; import { createEditor } from "../utils/editor";
import { cueBlock } from "./cueBlock";
export const lineBlock: Block = { export const lineBlock: Block = {
slug: "lineBlock", slug: "lineBlock",
@ -15,7 +14,7 @@ export const lineBlock: Block = {
admin: { admin: {
className: "reduced-margins", className: "reduced-margins",
}, },
editor: createEditor({ inlines: true, lists: true, links: true, blocks: [cueBlock] }), editor: createEditor({ inlines: true, lists: true, links: true }),
}, },
], ],
}; };

View File

@ -8,7 +8,7 @@ const generateRecursiveSectionBlock = (depth = 1, maxDepth = 5): Block => ({
labels: { singular: "Section", plural: "Sections" }, labels: { singular: "Section", plural: "Sections" },
fields: [ fields: [
{ {
name: "lines", name: "content",
type: "richText", type: "richText",
label: false, label: false,
required: true, required: true,

View File

@ -78,7 +78,7 @@ const handleContent = (
fields: { fields: {
...node.fields, ...node.fields,
anchorHash, 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) .filter(isBlockNodeSectionBlock)
.map(({ fields }, index) => ({ .map(({ fields }, index) => ({
prefix: `${parentPrefix}${index + 1}.`, prefix: `${parentPrefix}${index + 1}.`,
title: fields.blockName, title: fields.blockName ?? "",
children: handleToc(fields.lines, `${index + 1}.`), children: handleToc(fields.content, `${index + 1}.`),
})); }));
const handleParentPages = ({ const handleParentPages = ({

View File

@ -1343,7 +1343,7 @@ export interface TranscriptBlock {
* via the `definition` "SectionBlock". * via the `definition` "SectionBlock".
*/ */
export interface SectionBlock { export interface SectionBlock {
lines: { content: {
root: { root: {
children: { children: {
type: string; type: string;