| 1 | import { type TElement } from "platejs"; |
| 2 | import { createTPlatePlugin } from "platejs/react"; |
| 3 | |
| 4 | import CompareGroup from "../custom-elements/compare"; |
| 5 | import { CompareSide } from "../custom-elements/compare-side"; |
| 6 | import { COMPARE_GROUP, COMPARE_SIDE } from "../lib"; |
| 7 | |
| 8 | export const CompareGroupPlugin = createTPlatePlugin({ |
| 9 | key: COMPARE_GROUP, |
| 10 | node: { |
| 11 | isElement: true, |
| 12 | type: COMPARE_GROUP, |
| 13 | component: CompareGroup, |
| 14 | }, |
| 15 | }); |
| 16 | |
| 17 | export const CompareSidePlugin = createTPlatePlugin({ |
| 18 | key: COMPARE_SIDE, |
| 19 | node: { |
| 20 | isElement: true, |
| 21 | isStrictSiblings: true, |
| 22 | type: COMPARE_SIDE, |
| 23 | component: CompareSide, |
| 24 | }, |
| 25 | }); |
| 26 | |
| 27 | export type TCompareGroupElement = TElement & { |
| 28 | type: typeof COMPARE_GROUP; |
| 29 | alignment?: "left" | "center" | "right"; |
| 30 | columnSize?: "sm" | "md" | "lg" | "xl"; |
| 31 | }; |
| 32 | export type TCompareSideElement = TElement & { |
| 33 | type: typeof COMPARE_SIDE; |
| 34 | alignment?: "left" | "center" | "right"; |
| 35 | }; |
| 36 |