返回 presentation-ai
pros-cons-plugin.tsx
根目录 / src / components / notebook / presentation / editor / plugins / pros-cons-plugin.tsx
1 import { type TElement } from "platejs";
2 import { createTPlatePlugin } from "platejs/react";
3
4 import { ConsItem } from "../custom-elements/cons-item";
5 import ProsConsGroup from "../custom-elements/pros-cons";
6 import { ProsItem } from "../custom-elements/pros-item";
7 import { CONS_ITEM, PROS_CONS_GROUP, PROS_ITEM } from "../lib";
8
9 export const ProsConsGroupPlugin = createTPlatePlugin({
10 key: PROS_CONS_GROUP,
11 node: {
12 isElement: true,
13 type: PROS_CONS_GROUP,
14 component: ProsConsGroup,
15 },
16 });
17
18 export const ProsItemPlugin = createTPlatePlugin({
19 key: PROS_ITEM,
20 node: {
21 isElement: true,
22 isStrictSiblings: true,
23 type: PROS_ITEM,
24 component: ProsItem,
25 },
26 });
27
28 export const ConsItemPlugin = createTPlatePlugin({
29 key: CONS_ITEM,
30 node: {
31 isElement: true,
32 isStrictSiblings: true,
33 type: CONS_ITEM,
34 component: ConsItem,
35 },
36 });
37
38 export type TProsConsGroupElement = TElement & {
39 type: typeof PROS_CONS_GROUP;
40 alignment?: "left" | "center" | "right";
41 };
42 export type TProsItemElement = TElement & {
43 type: typeof PROS_ITEM;
44 alignment?: "left" | "center" | "right";
45 };
46 export type TConsItemElement = TElement & {
47 type: typeof CONS_ITEM;
48 alignment?: "left" | "center" | "right";
49 };
50
50 lines Plain Text