2022-06-11 07:27:38 +02:00
|
|
|
import { blockBaseSchema, BubbleBlockType } from '../shared'
|
2022-06-07 08:49:12 +02:00
|
|
|
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(
|
2022-06-07 08:49:12 +02:00
|
|
|
z.object({
|
2022-06-11 07:27:38 +02:00
|
|
|
type: z.enum([BubbleBlockType.TEXT]),
|
2022-06-07 08:49:12 +02:00
|
|
|
content: textBubbleContentSchema,
|
|
|
|
})
|
|
|
|
)
|
|
|
|
|
2022-06-11 07:27:38 +02:00
|
|
|
export type TextBubbleBlock = z.infer<typeof textBubbleBlockSchema>
|