| 1 | import { type TElement } from "platejs"; |
| 2 | import { createPlatePlugin } from "platejs/react"; |
| 3 | |
| 4 | import ButtonElement from "../custom-elements/button"; |
| 5 | import { BUTTON_ELEMENT, type PresentationElementAlignment } from "../lib"; |
| 6 | |
| 7 | export const ButtonPlugin = createPlatePlugin({ |
| 8 | key: BUTTON_ELEMENT, |
| 9 | node: { |
| 10 | isElement: true, |
| 11 | component: ButtonElement, |
| 12 | }, |
| 13 | options: { |
| 14 | variant: "filled", |
| 15 | size: "md", |
| 16 | }, |
| 17 | }); |
| 18 | |
| 19 | export type TButtonElement = TElement & { |
| 20 | alignment?: PresentationElementAlignment; |
| 21 | backgroundColor?: string; |
| 22 | color?: string; |
| 23 | textColor?: string; |
| 24 | type: typeof BUTTON_ELEMENT; |
| 25 | variant?: "filled" | "outline" | "ghost"; |
| 26 | size?: "sm" | "md" | "lg"; |
| 27 | }; |
| 28 |