返回 presentation-ai
column-plugin.tsx
根目录 / src / components / notebook / presentation / editor / plugins / column-plugin.tsx
1 import { type TElement } from "platejs";
2 import { createTPlatePlugin } from "platejs/react";
3 import ColumnGroup from "../custom-elements/column";
4 import { ColumnItem } from "../custom-elements/column-item";
5 import { COLUMN_GROUP, COLUMN_ITEM } from "../lib";
6
7 export const ColumnGroupPlugin = createTPlatePlugin({
8 key: COLUMN_GROUP,
9 node: {
10 isElement: true,
11 type: COLUMN_GROUP,
12 component: ColumnGroup,
13 },
14 });
15
16 export const ColumnItemPlugin = createTPlatePlugin({
17 key: COLUMN_ITEM,
18 node: {
19 isElement: true,
20 type: COLUMN_ITEM,
21 component: ColumnItem,
22 },
23 });
24
25 export type TColumnGroupElement = TElement & {
26 type: typeof COLUMN_GROUP;
27 columnSize: "sm" | "md" | "lg" | "xl";
28 columnType: "outline" | "solid" | "transparent";
29 numbered: boolean;
30 alignment?: "left" | "center" | "right";
31 };
32
33 export type TColumnItemElement = TElement & {
34 type: typeof COLUMN_ITEM;
35 alignment?: "left" | "center" | "right";
36 };
37
37 lines Plain Text