| 1 | "use client"; |
| 2 | |
| 3 | import { type InfographicOptions } from "@antv/infographic"; |
| 4 | import { type TElement } from "platejs"; |
| 5 | import { createTPlatePlugin } from "platejs/react"; |
| 6 | |
| 7 | import { type InfographicSlideLayout } from "@/lib/presentation/infographic-layout"; |
| 8 | import { AntvInfographic } from "../custom-elements/antv-infographic"; |
| 9 | import { ANTV_INFOGRAPHIC } from "../lib"; |
| 10 | |
| 11 | export const AntvInfographicPlugin = createTPlatePlugin({ |
| 12 | key: ANTV_INFOGRAPHIC, |
| 13 | node: { |
| 14 | isElement: true, |
| 15 | isVoid: true, |
| 16 | type: ANTV_INFOGRAPHIC, |
| 17 | component: AntvInfographic, |
| 18 | }, |
| 19 | }); |
| 20 | |
| 21 | export type TAntvInfographicElement = TElement & { |
| 22 | type: typeof ANTV_INFOGRAPHIC; |
| 23 | syntax: string; |
| 24 | isLoading: boolean; |
| 25 | sourceText?: string; |
| 26 | generationPrompt?: string; |
| 27 | slideLayoutType?: InfographicSlideLayout; |
| 28 | data?: Partial<InfographicOptions>; |
| 29 | width?: number | string; |
| 30 | align?: "center" | "left" | "right"; |
| 31 | }; |
| 32 |