返回 presentation-ai
box-plugin.tsx
根目录 / src / components / notebook / presentation / editor / plugins / box-plugin.tsx
1 import { type TElement } from "platejs";
2 import { createTPlatePlugin } from "platejs/react";
3
4 import BoxGroup from "../custom-elements/box";
5 import { BoxItem } from "../custom-elements/box-item";
6 import { BOX_GROUP, BOX_ITEM } from "../lib";
7
8 export const BoxGroupPlugin = createTPlatePlugin({
9 key: BOX_GROUP,
10 node: {
11 isElement: true,
12 type: BOX_GROUP,
13 component: BoxGroup,
14 },
15 });
16
17 export const BoxItemPlugin = createTPlatePlugin({
18 key: BOX_ITEM,
19 node: {
20 isElement: true,
21 isStrictSiblings: true,
22 type: BOX_ITEM,
23 component: BoxItem,
24 },
25 });
26
27 export type TBoxGroupElement = TElement & {
28 type: typeof BOX_GROUP;
29 columnSize?: "sm" | "md" | "lg" | "xl";
30 boxType?:
31 | "outline"
32 | "icon"
33 | "solid"
34 | "sideline"
35 | "side-label"
36 | "top-label"
37 | "top-circle"
38 | "joined"
39 | "joined-icon"
40 | "leaf"
41 | "labeled"
42 | "alternating";
43 numbered?: boolean;
44 alignment?: "left" | "center" | "right";
45 orientation?: "horizontal" | "vertical";
46 };
47 export type TBoxItemElement = TElement & {
48 type: typeof BOX_ITEM;
49 icon?: string;
50 alignment?: "left" | "center" | "right";
51 };
52
52 lines Plain Text