返回 presentation-ai
diagram-components-plugin.tsx
根目录 / src / components / notebook / presentation / editor / plugins / diagram-components-plugin.tsx
1 import { type TElement } from "platejs";
2 import { createTPlatePlugin } from "platejs/react";
3
4 import CircularGrid from "../custom-elements/circular-grid";
5 import { CircularGridItem } from "../custom-elements/circular-grid-item";
6 import { ConnectedCircleItem } from "../custom-elements/connected-circle-item";
7 import ConnectedCircles from "../custom-elements/connected-circles";
8 import Slope from "../custom-elements/slope";
9 import { SlopeItem } from "../custom-elements/slope-item";
10 import Snake from "../custom-elements/snake";
11 import { SnakeItem } from "../custom-elements/snake-item";
12 import {
13 CIRCULAR_GRID_GROUP,
14 CIRCULAR_GRID_ITEM,
15 CONNECTED_CIRCLES_GROUP,
16 CONNECTED_CIRCLES_ITEM,
17 SLOPE_GROUP,
18 SLOPE_ITEM,
19 SNAKE_GROUP,
20 SNAKE_ITEM,
21 } from "../lib";
22
23 export const SlopeGroupPlugin = createTPlatePlugin({
24 key: SLOPE_GROUP,
25 node: {
26 isElement: true,
27 type: SLOPE_GROUP,
28 component: Slope,
29 },
30 });
31
32 export const SlopeItemPlugin = createTPlatePlugin({
33 key: SLOPE_ITEM,
34 node: {
35 isElement: true,
36 isStrictSiblings: true,
37 type: SLOPE_ITEM,
38 component: SlopeItem,
39 },
40 });
41
42 export const ConnectedCirclesGroupPlugin = createTPlatePlugin({
43 key: CONNECTED_CIRCLES_GROUP,
44 node: {
45 isElement: true,
46 type: CONNECTED_CIRCLES_GROUP,
47 component: ConnectedCircles,
48 },
49 });
50
51 export const ConnectedCirclesItemPlugin = createTPlatePlugin({
52 key: CONNECTED_CIRCLES_ITEM,
53 node: {
54 isElement: true,
55 isStrictSiblings: true,
56 type: CONNECTED_CIRCLES_ITEM,
57 component: ConnectedCircleItem,
58 },
59 });
60
61 export const CircularGridGroupPlugin = createTPlatePlugin({
62 key: CIRCULAR_GRID_GROUP,
63 node: {
64 isElement: true,
65 type: CIRCULAR_GRID_GROUP,
66 component: CircularGrid,
67 },
68 });
69
70 export const CircularGridItemPlugin = createTPlatePlugin({
71 key: CIRCULAR_GRID_ITEM,
72 node: {
73 isElement: true,
74 isStrictSiblings: true,
75 type: CIRCULAR_GRID_ITEM,
76 component: CircularGridItem,
77 },
78 });
79
80 export const SnakeGroupPlugin = createTPlatePlugin({
81 key: SNAKE_GROUP,
82 node: {
83 isElement: true,
84 type: SNAKE_GROUP,
85 component: Snake,
86 },
87 });
88
89 export const SnakeItemPlugin = createTPlatePlugin({
90 key: SNAKE_ITEM,
91 node: {
92 isElement: true,
93 isStrictSiblings: true,
94 type: SNAKE_ITEM,
95 component: SnakeItem,
96 },
97 });
98
99 export type TSlopeGroupElement = TElement & {
100 type: typeof SLOPE_GROUP;
101 alignment?: "left" | "center" | "right";
102 };
103
104 export type TSlopeItemElement = TElement & {
105 type: typeof SLOPE_ITEM;
106 icon?: string;
107 alignment?: "left" | "center" | "right";
108 };
109
110 export type TConnectedCirclesGroupElement = TElement & {
111 type: typeof CONNECTED_CIRCLES_GROUP;
112 alignment?: "left" | "center" | "right";
113 };
114
115 export type TConnectedCirclesItemElement = TElement & {
116 type: typeof CONNECTED_CIRCLES_ITEM;
117 alignment?: "left" | "center" | "right";
118 };
119
120 export type TCircularGridGroupElement = TElement & {
121 type: typeof CIRCULAR_GRID_GROUP;
122 alignment?: "left" | "center" | "right";
123 centerText?: string;
124 };
125
126 export type TCircularGridItemElement = TElement & {
127 type: typeof CIRCULAR_GRID_ITEM;
128 alignment?: "left" | "center" | "right";
129 };
130
131 export type TSnakeGroupElement = TElement & {
132 type: typeof SNAKE_GROUP;
133 alignment?: "left" | "center" | "right";
134 };
135
136 export type TSnakeItemElement = TElement & {
137 type: typeof SNAKE_ITEM;
138 alignment?: "left" | "center" | "right";
139 };
140
140 lines Plain Text