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

26 lines
624 B
TypeScript
Raw Normal View History

2022-06-11 07:27:38 +02:00
import { blockBaseSchema, BubbleBlockType } from '../shared'
import { z } from 'zod'
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>
2022-06-11 07:27:38 +02:00
export const textBubbleBlockSchema = blockBaseSchema.and(
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>