Removed spacer block

This commit is contained in:
DrMint 2024-03-13 04:08:23 +01:00
parent bd13e005e0
commit 1628b95589
7 changed files with 5 additions and 57 deletions

View File

@ -1,6 +1,5 @@
import { Block } from "payload/types";
import { createEditor } from "../utils/editor";
import { spacerBlock } from "./spacerBlock";
import { transcriptBlock } from "./transcriptBlock";
const generateRecursiveSectionBlock = (depth = 1, maxDepth = 5): Block => ({
@ -25,7 +24,6 @@ const generateRecursiveSectionBlock = (depth = 1, maxDepth = 5): Block => ({
alignment: true,
blocks: [
...(depth < maxDepth ? [generateRecursiveSectionBlock(depth + 1, maxDepth)] : []),
spacerBlock,
transcriptBlock,
],
}),

View File

@ -1,20 +0,0 @@
import { Block } from "payload/types";
import { SpacerSizes } from "../constants";
export const spacerBlock: Block = {
slug: "spacerBlock",
interfaceName: "SpacerBlock",
labels: { singular: "Spacer", plural: "Spacers" },
fields: [
{
name: "size",
type: "radio",
defaultValue: "medium",
required: true,
options: Object.entries(SpacerSizes).map(([_, value]) => ({
label: value,
value: value,
})),
},
],
};

View File

@ -1,7 +1,6 @@
import { Block } from "payload/types";
import { cueBlock } from "./cueBlock";
import { lineBlock } from "./lineBlock";
import { spacerBlock } from "./spacerBlock";
export const transcriptBlock: Block = {
slug: "transcriptBlock",
@ -14,7 +13,7 @@ export const transcriptBlock: Block = {
required: true,
minRows: 1,
admin: { initCollapsed: true, className: "no-label" },
blocks: [lineBlock, cueBlock, spacerBlock],
blocks: [lineBlock, cueBlock],
},
],
};

View File

@ -1,6 +1,5 @@
import { Where } from "payload/types";
import { sectionBlock } from "../../blocks/sectionBlock";
import { spacerBlock } from "../../blocks/spacerBlock";
import { transcriptBlock } from "../../blocks/transcriptBlock";
import { QuickFilters, publishStatusFilters } from "../../components/QuickFilters";
import { CollectionGroups, Collections, PageType } from "../../constants";
@ -142,7 +141,7 @@ export const Pages = buildVersionedCollectionConfig({
images: true,
inlines: true,
alignment: true,
blocks: [sectionBlock, spacerBlock, transcriptBlock],
blocks: [sectionBlock, transcriptBlock],
links: true,
lists: true,
}),

View File

@ -1,7 +1,6 @@
import type {
Image,
SectionBlock,
SpacerBlock,
TranscriptBlock,
} from "./types/collections";
@ -90,13 +89,6 @@ export enum PageType {
Generic = "Generic",
}
export enum SpacerSizes {
Small = "Small",
Medium = "Medium",
Large = "Large",
XLarge = "Extra Large",
}
/* RICH TEXT */
export type RichTextContent = {
@ -210,10 +202,6 @@ export interface RichTextTranscriptBlock extends RichTextBlockNode {
fields: TranscriptBlock;
}
export interface RichTextSpacerBlock extends RichTextBlockNode {
fields: SpacerBlock;
}
export const isNodeParagraphNode = (node: RichTextNode): node is RichTextParagraphNode =>
node.type === "paragraph";
@ -263,9 +251,6 @@ export const isBlockNodeTranscriptBlock = (
node: RichTextBlockNode
): node is RichTextTranscriptBlock => node.fields.blockType === "transcriptBlock";
export const isBlockNodeSpacerBlock = (node: RichTextBlockNode): node is RichTextSpacerBlock =>
node.fields.blockType === "spacerBlock";
/* BLOCKS */
/* TODO: TO BE REMOVED WHEN https://github.com/payloadcms/payload/issues/5216 is closed */
@ -293,7 +278,4 @@ export const isBlockCueBlock = (block: GenericBlock): block is CueBlock =>
block.blockType === "cueBlock";
export const isBlockLineBlock = (block: GenericBlock): block is LineBlock =>
block.blockType === "lineBlock";
export const isBlockSpacerBlock = (block: GenericBlock): block is SpacerBlock =>
block.blockType === "spacerBlock";
block.blockType === "lineBlock";

View File

@ -70,13 +70,11 @@ html[data-theme="light"] {
display: none;
}
.lexical-block__block-pill-transcriptBlock + .section-title,
.lexical-block__block-pill-spacerBlock + .section-title {
.lexical-block__block-pill-transcriptBlock + .section-title {
display: none;
}
.blocks-field__block-pill-cueBlock + .section-title,
.blocks-field__block-pill-spacerBlock + .section-title,
.blocks-field__block-pill-pageRange + .section-title,
.blocks-field__block-pill-timeRange + .section-title,
.blocks-field__block-pill-other + .section-title {

View File

@ -762,14 +762,6 @@ export interface PayloadMigration {
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "SpacerBlock".
*/
export interface SpacerBlock {
size: 'Small' | 'Medium' | 'Large' | 'Extra Large';
blockType: 'spacerBlock';
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "LineBlock".
@ -819,7 +811,7 @@ export interface CueBlock {
* via the `definition` "TranscriptBlock".
*/
export interface TranscriptBlock {
lines: (LineBlock | CueBlock | SpacerBlock)[];
lines: (LineBlock | CueBlock)[];
id?: string | null;
blockName?: string | null;
blockType: 'transcriptBlock';