2
0
Files
bot/packages/models/features/blocks/bubbles/text.ts

27 lines
656 B
TypeScript
Raw Normal View History

import { z } from 'zod'
import { blockBaseSchema } from '../baseSchemas'
import { BubbleBlockType } from './enums'
export const defaultTextBubbleContent: TextBubbleContent = {
html: '',
richText: [],
plainText: '',
}
export const textBubbleContentSchema = z.object({
html: z.string(),
richText: z.array(z.any()),
plainText: z.string(),
})
export type TextBubbleContent = z.infer<typeof textBubbleContentSchema>
export const textBubbleBlockSchema = blockBaseSchema.merge(
z.object({
2022-06-11 07:27:38 +02:00
type: z.enum([BubbleBlockType.TEXT]),
content: textBubbleContentSchema,
})
)
2022-06-11 07:27:38 +02:00
export type TextBubbleBlock = z.infer<typeof textBubbleBlockSchema>