| 1 | import { type TElement } from "platejs"; |
| 2 | import { createTPlatePlugin } from "platejs/react"; |
| 3 | |
| 4 | import { Icon } from "../custom-elements/icon"; |
| 5 | import { ICON_ELEMENT } from "../lib"; |
| 6 | |
| 7 | // Create plugin for d item |
| 8 | export const IconPlugin = createTPlatePlugin({ |
| 9 | key: ICON_ELEMENT, |
| 10 | node: { |
| 11 | isElement: true, |
| 12 | component: Icon, |
| 13 | }, |
| 14 | options: { |
| 15 | query: "", |
| 16 | name: "", |
| 17 | }, |
| 18 | }); |
| 19 | |
| 20 | export interface TIconElement extends TElement { |
| 21 | type: typeof ICON_ELEMENT; |
| 22 | alignment?: "left" | "center" | "right"; |
| 23 | query: string; |
| 24 | name: string; |
| 25 | } |
| 26 |