返回 presentation-ai
timeline-plugin.tsx
根目录 / src / components / notebook / presentation / editor / plugins / timeline-plugin.tsx
1 import { type TElement } from "platejs";
2 import { createTPlatePlugin } from "platejs/react";
3
4 import Timeline from "../custom-elements/timeline";
5 import { TimelineItem } from "../custom-elements/timeline-item";
6 import { TIMELINE_GROUP, TIMELINE_ITEM } from "../lib";
7
8 export const TimelinePlugin = createTPlatePlugin({
9 key: TIMELINE_GROUP,
10 node: {
11 component: Timeline,
12 type: TIMELINE_GROUP,
13 isElement: true,
14 isContainer: true,
15 },
16 options: {
17 orientation: "vertical",
18 sidedness: "single",
19 numbered: true,
20 showLine: true,
21 },
22 });
23 export const TimelineItemPlugin = createTPlatePlugin({
24 key: TIMELINE_ITEM,
25 node: {
26 component: TimelineItem,
27 type: TIMELINE_ITEM,
28 isElement: true,
29 isContainer: true,
30 isStrictSiblings: true,
31 },
32 });
33 export interface TTimelineGroupElement extends TElement {
34 type: typeof TIMELINE_GROUP;
35 orientation: "vertical" | "horizontal";
36 sidedness: "single" | "double";
37 numbered: boolean;
38 showLine: boolean;
39 alignment?: "left" | "center" | "right";
40 variant?: "default" | "boxes";
41 }
42
43 export interface TTimelineItemElement extends TElement {
44 type: typeof TIMELINE_ITEM;
45 alignment?: "left" | "center" | "right";
46 icon?: string;
47 }
48
48 lines Plain Text