Removed spacer block
This commit is contained in:
parent
bd13e005e0
commit
1628b95589
|
@ -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 { spacerBlock } from "./spacerBlock";
|
|
||||||
import { transcriptBlock } from "./transcriptBlock";
|
import { transcriptBlock } from "./transcriptBlock";
|
||||||
|
|
||||||
const generateRecursiveSectionBlock = (depth = 1, maxDepth = 5): Block => ({
|
const generateRecursiveSectionBlock = (depth = 1, maxDepth = 5): Block => ({
|
||||||
|
@ -25,7 +24,6 @@ const generateRecursiveSectionBlock = (depth = 1, maxDepth = 5): Block => ({
|
||||||
alignment: true,
|
alignment: true,
|
||||||
blocks: [
|
blocks: [
|
||||||
...(depth < maxDepth ? [generateRecursiveSectionBlock(depth + 1, maxDepth)] : []),
|
...(depth < maxDepth ? [generateRecursiveSectionBlock(depth + 1, maxDepth)] : []),
|
||||||
spacerBlock,
|
|
||||||
transcriptBlock,
|
transcriptBlock,
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
|
|
|
@ -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,
|
|
||||||
})),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
|
@ -1,7 +1,6 @@
|
||||||
import { Block } from "payload/types";
|
import { Block } from "payload/types";
|
||||||
import { cueBlock } from "./cueBlock";
|
import { cueBlock } from "./cueBlock";
|
||||||
import { lineBlock } from "./lineBlock";
|
import { lineBlock } from "./lineBlock";
|
||||||
import { spacerBlock } from "./spacerBlock";
|
|
||||||
|
|
||||||
export const transcriptBlock: Block = {
|
export const transcriptBlock: Block = {
|
||||||
slug: "transcriptBlock",
|
slug: "transcriptBlock",
|
||||||
|
@ -14,7 +13,7 @@ export const transcriptBlock: Block = {
|
||||||
required: true,
|
required: true,
|
||||||
minRows: 1,
|
minRows: 1,
|
||||||
admin: { initCollapsed: true, className: "no-label" },
|
admin: { initCollapsed: true, className: "no-label" },
|
||||||
blocks: [lineBlock, cueBlock, spacerBlock],
|
blocks: [lineBlock, cueBlock],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import { Where } from "payload/types";
|
import { Where } from "payload/types";
|
||||||
import { sectionBlock } from "../../blocks/sectionBlock";
|
import { sectionBlock } from "../../blocks/sectionBlock";
|
||||||
import { spacerBlock } from "../../blocks/spacerBlock";
|
|
||||||
import { transcriptBlock } from "../../blocks/transcriptBlock";
|
import { transcriptBlock } from "../../blocks/transcriptBlock";
|
||||||
import { QuickFilters, publishStatusFilters } from "../../components/QuickFilters";
|
import { QuickFilters, publishStatusFilters } from "../../components/QuickFilters";
|
||||||
import { CollectionGroups, Collections, PageType } from "../../constants";
|
import { CollectionGroups, Collections, PageType } from "../../constants";
|
||||||
|
@ -142,7 +141,7 @@ export const Pages = buildVersionedCollectionConfig({
|
||||||
images: true,
|
images: true,
|
||||||
inlines: true,
|
inlines: true,
|
||||||
alignment: true,
|
alignment: true,
|
||||||
blocks: [sectionBlock, spacerBlock, transcriptBlock],
|
blocks: [sectionBlock, transcriptBlock],
|
||||||
links: true,
|
links: true,
|
||||||
lists: true,
|
lists: true,
|
||||||
}),
|
}),
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import type {
|
import type {
|
||||||
Image,
|
Image,
|
||||||
SectionBlock,
|
SectionBlock,
|
||||||
SpacerBlock,
|
|
||||||
TranscriptBlock,
|
TranscriptBlock,
|
||||||
} from "./types/collections";
|
} from "./types/collections";
|
||||||
|
|
||||||
|
@ -90,13 +89,6 @@ export enum PageType {
|
||||||
Generic = "Generic",
|
Generic = "Generic",
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum SpacerSizes {
|
|
||||||
Small = "Small",
|
|
||||||
Medium = "Medium",
|
|
||||||
Large = "Large",
|
|
||||||
XLarge = "Extra Large",
|
|
||||||
}
|
|
||||||
|
|
||||||
/* RICH TEXT */
|
/* RICH TEXT */
|
||||||
|
|
||||||
export type RichTextContent = {
|
export type RichTextContent = {
|
||||||
|
@ -210,10 +202,6 @@ export interface RichTextTranscriptBlock extends RichTextBlockNode {
|
||||||
fields: TranscriptBlock;
|
fields: TranscriptBlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RichTextSpacerBlock extends RichTextBlockNode {
|
|
||||||
fields: SpacerBlock;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const isNodeParagraphNode = (node: RichTextNode): node is RichTextParagraphNode =>
|
export const isNodeParagraphNode = (node: RichTextNode): node is RichTextParagraphNode =>
|
||||||
node.type === "paragraph";
|
node.type === "paragraph";
|
||||||
|
|
||||||
|
@ -263,9 +251,6 @@ export const isBlockNodeTranscriptBlock = (
|
||||||
node: RichTextBlockNode
|
node: RichTextBlockNode
|
||||||
): node is RichTextTranscriptBlock => node.fields.blockType === "transcriptBlock";
|
): node is RichTextTranscriptBlock => node.fields.blockType === "transcriptBlock";
|
||||||
|
|
||||||
export const isBlockNodeSpacerBlock = (node: RichTextBlockNode): node is RichTextSpacerBlock =>
|
|
||||||
node.fields.blockType === "spacerBlock";
|
|
||||||
|
|
||||||
/* BLOCKS */
|
/* BLOCKS */
|
||||||
|
|
||||||
/* TODO: TO BE REMOVED WHEN https://github.com/payloadcms/payload/issues/5216 is closed */
|
/* TODO: TO BE REMOVED WHEN https://github.com/payloadcms/payload/issues/5216 is closed */
|
||||||
|
@ -294,6 +279,3 @@ export const isBlockCueBlock = (block: GenericBlock): block is CueBlock =>
|
||||||
|
|
||||||
export const isBlockLineBlock = (block: GenericBlock): block is LineBlock =>
|
export const isBlockLineBlock = (block: GenericBlock): block is LineBlock =>
|
||||||
block.blockType === "lineBlock";
|
block.blockType === "lineBlock";
|
||||||
|
|
||||||
export const isBlockSpacerBlock = (block: GenericBlock): block is SpacerBlock =>
|
|
||||||
block.blockType === "spacerBlock";
|
|
||||||
|
|
|
@ -70,13 +70,11 @@ html[data-theme="light"] {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.lexical-block__block-pill-transcriptBlock + .section-title,
|
.lexical-block__block-pill-transcriptBlock + .section-title {
|
||||||
.lexical-block__block-pill-spacerBlock + .section-title {
|
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.blocks-field__block-pill-cueBlock + .section-title,
|
.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-pageRange + .section-title,
|
||||||
.blocks-field__block-pill-timeRange + .section-title,
|
.blocks-field__block-pill-timeRange + .section-title,
|
||||||
.blocks-field__block-pill-other + .section-title {
|
.blocks-field__block-pill-other + .section-title {
|
||||||
|
|
|
@ -762,14 +762,6 @@ export interface PayloadMigration {
|
||||||
updatedAt: string;
|
updatedAt: string;
|
||||||
createdAt: 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
|
* This interface was referenced by `Config`'s JSON-Schema
|
||||||
* via the `definition` "LineBlock".
|
* via the `definition` "LineBlock".
|
||||||
|
@ -819,7 +811,7 @@ export interface CueBlock {
|
||||||
* via the `definition` "TranscriptBlock".
|
* via the `definition` "TranscriptBlock".
|
||||||
*/
|
*/
|
||||||
export interface TranscriptBlock {
|
export interface TranscriptBlock {
|
||||||
lines: (LineBlock | CueBlock | SpacerBlock)[];
|
lines: (LineBlock | CueBlock)[];
|
||||||
id?: string | null;
|
id?: string | null;
|
||||||
blockName?: string | null;
|
blockName?: string | null;
|
||||||
blockType: 'transcriptBlock';
|
blockType: 'transcriptBlock';
|
||||||
|
|
Loading…
Reference in New Issue