返回 presentation-ai
icon-plugin.tsx
根目录 / src / components / notebook / presentation / editor / plugins / icon-plugin.tsx
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
26 lines Plain Text