返回 presentation-ai
before-after-plugin.tsx
根目录 / src / components / notebook / presentation / editor / plugins / before-after-plugin.tsx
1 import { type TElement } from "platejs";
2 import { createTPlatePlugin } from "platejs/react";
3
4 import BeforeAfterGroup from "../custom-elements/before-after";
5 import { BeforeAfterSide } from "../custom-elements/before-after-side";
6 import { BEFORE_AFTER_GROUP, BEFORE_AFTER_SIDE } from "../lib";
7
8 export const BeforeAfterGroupPlugin = createTPlatePlugin({
9 key: BEFORE_AFTER_GROUP,
10 node: {
11 isElement: true,
12 type: BEFORE_AFTER_GROUP,
13 component: BeforeAfterGroup,
14 },
15 });
16
17 export const BeforeAfterSidePlugin = createTPlatePlugin({
18 key: BEFORE_AFTER_SIDE,
19 node: {
20 isElement: true,
21 isStrictSiblings: true,
22 type: BEFORE_AFTER_SIDE,
23 component: BeforeAfterSide,
24 },
25 });
26
27 export type TBeforeAfterGroupElement = TElement & {
28 type: typeof BEFORE_AFTER_GROUP;
29 alignment?: "left" | "center" | "right";
30 columnSize?: "sm" | "md" | "lg" | "xl";
31 };
32 export type TBeforeAfterSideElement = TElement & {
33 type: typeof BEFORE_AFTER_SIDE;
34 alignment?: "left" | "center" | "right";
35 };
36
36 lines Plain Text