Added support for upload node

This commit is contained in:
DrMint 2024-03-13 02:26:47 +01:00
parent 7b97bd77c1
commit 493b3601b8
2 changed files with 18 additions and 1 deletions

View File

@ -47,6 +47,6 @@
"prettier": "3.2.5",
"ts-node": "10.9.2",
"ts-unused-exports": "10.0.1",
"typescript": "5.3.3"
"typescript": "5.4.2"
}
}

View File

@ -1,5 +1,6 @@
import type {
CueBlock,
Image,
LineBlock,
SectionBlock,
SpacerBlock,
@ -152,6 +153,16 @@ export interface RichTextLinebreakNode extends RichTextNode {
type: "linebreak";
}
export interface RichTextUploadNode extends RichTextNode {
type: "upload";
relationTo: string;
}
export interface RichTextUploadImageNode extends RichTextUploadNode {
relationTo: "images" | "background-images";
value: Image;
}
export interface RichTextTextNode extends RichTextNode {
type: "text";
format: number;
@ -211,6 +222,12 @@ export interface RichTextSpacerBlock extends RichTextBlockNode {
export const isNodeParagraphNode = (node: RichTextNode): node is RichTextParagraphNode =>
node.type === "paragraph";
export const isNodeUploadNode = (node: RichTextNode): node is RichTextUploadNode =>
node.type === "upload";
export const isUploadNodeImageNode = (node: RichTextUploadNode): node is RichTextUploadImageNode =>
node.relationTo === "images" || node.relationTo === "background-images";
export const isNodeListNode = (node: RichTextNode): node is RichTextListNode =>
node.type === "list";