| 1 | import { type TElement } from "platejs"; |
| 2 | import { createTPlatePlugin } from "platejs/react"; |
| 3 | |
| 4 | import { BulletsElement } from "../custom-elements/bullet"; |
| 5 | import { BulletItem } from "../custom-elements/bullet-item"; |
| 6 | import { BULLET_GROUP, BULLET_ITEM } from "../lib"; |
| 7 | |
| 8 | // Create plugin for bullets |
| 9 | export const BulletGroupPlugin = createTPlatePlugin({ |
| 10 | key: BULLET_GROUP, |
| 11 | node: { |
| 12 | isElement: true, |
| 13 | type: BULLET_GROUP, |
| 14 | component: BulletsElement, |
| 15 | }, |
| 16 | }); |
| 17 | |
| 18 | // Create plugin for bullet item |
| 19 | export const BulletItemPlugin = createTPlatePlugin({ |
| 20 | key: BULLET_ITEM, |
| 21 | node: { |
| 22 | isElement: true, |
| 23 | isStrictSiblings: true, |
| 24 | type: BULLET_ITEM, |
| 25 | component: BulletItem, |
| 26 | }, |
| 27 | }); |
| 28 | |
| 29 | export type TBulletGroupElement = TElement & { |
| 30 | type: typeof BULLET_GROUP; |
| 31 | columnSize?: "sm" | "md" | "lg" | "xl"; |
| 32 | bulletType?: "numbered" | "basic" | "arrow"; |
| 33 | alignment?: "left" | "center" | "right"; |
| 34 | }; |
| 35 | export type TBulletItemElement = TElement & { |
| 36 | type: typeof BULLET_ITEM; |
| 37 | alignment?: "left" | "center" | "right"; |
| 38 | forceFullWidth?: boolean; |
| 39 | icon?: string; |
| 40 | }; |
| 41 |