返回 presentation-ai
steps-plugin.tsx
根目录 / src / components / notebook / presentation / editor / plugins / steps-plugin.tsx
1 import { type TElement } from "platejs";
2 import { createTPlatePlugin } from "platejs/react";
3
4 import StepsElement from "../custom-elements/steps-element";
5 import { StepsItem } from "../custom-elements/steps-item";
6 import { STEPS_GROUP, STEPS_ITEM } from "../lib";
7
8 export const StepsPlugin = createTPlatePlugin({
9 key: STEPS_GROUP,
10 node: {
11 isElement: true,
12 type: STEPS_GROUP,
13 component: StepsElement,
14 },
15 });
16
17 export const StepsItemPlugin = createTPlatePlugin({
18 key: STEPS_ITEM,
19 node: {
20 isElement: true,
21 isStrictSiblings: true,
22 type: STEPS_ITEM,
23 component: StepsItem,
24 },
25 });
26
27 export type TStepsGroupElement = TElement & {
28 type: typeof STEPS_GROUP;
29 orientation?: "horizontal" | "vertical";
30 variant?: "default" | "arrow" | "box";
31 columns?: number;
32 columnSize?: "sm" | "md" | "lg" | "xl" | string;
33 color?: string;
34 };
35
36 export type TStepsItemElement = TElement & {
37 type: typeof STEPS_ITEM;
38 };
39
39 lines Plain Text