| 1 | import { type TElement } from "platejs"; |
| 2 | import { createTPlatePlugin } from "platejs/react"; |
| 3 | |
| 4 | import { type ImageCropSettings } from "../../utils/types"; |
| 5 | import { IconList } from "../custom-elements/icon-list"; |
| 6 | import { IconListElement } from "../custom-elements/icon-list-item"; |
| 7 | import { ICON_LIST, ICON_LIST_ITEM } from "../lib"; |
| 8 | |
| 9 | export const IconListPlugin = createTPlatePlugin({ |
| 10 | key: ICON_LIST, |
| 11 | node: { |
| 12 | isElement: true, |
| 13 | type: ICON_LIST, |
| 14 | component: IconList, |
| 15 | }, |
| 16 | }); |
| 17 | |
| 18 | export const IconListItemPlugin = createTPlatePlugin({ |
| 19 | key: ICON_LIST_ITEM, |
| 20 | node: { |
| 21 | isElement: true, |
| 22 | isStrictSiblings: true, |
| 23 | type: ICON_LIST_ITEM, |
| 24 | component: IconListElement, |
| 25 | }, |
| 26 | }); |
| 27 | |
| 28 | export interface TIconListItemElement extends TElement { |
| 29 | type: typeof ICON_LIST_ITEM; |
| 30 | alignment?: "left" | "center" | "right"; |
| 31 | icon?: string; |
| 32 | cropSettings?: ImageCropSettings; |
| 33 | imageGenerationStatus?: "failed"; |
| 34 | imageSource?: "generate" | "search" | "gif" | "upload"; |
| 35 | prompt?: string; |
| 36 | query?: string; |
| 37 | stockImageProvider?: "unsplash" | "pixabay" | "google"; |
| 38 | url?: string; |
| 39 | } |
| 40 | export interface TIconListElement extends TElement { |
| 41 | type: typeof ICON_LIST; |
| 42 | alignment?: "left" | "center" | "right"; |
| 43 | columnSize?: "sm" | "md" | "lg" | "xl"; |
| 44 | mediaSize?: number; |
| 45 | orientation?: "side" | "top"; |
| 46 | variant?: "icon" | "image"; |
| 47 | } |
| 48 |