返回 presentation-ai
sequence-arrow-plugin.tsx
根目录 / src / components / notebook / presentation / editor / plugins / sequence-arrow-plugin.tsx
1 import { type TElement } from "platejs";
2 import { createTPlatePlugin } from "platejs/react";
3
4 import SequenceArrow from "../custom-elements/sequence-arrow";
5 import { SequenceArrowItem } from "../custom-elements/sequence-arrow-item";
6 import { SEQUENCE_ARROW_GROUP, SEQUENCE_ARROW_ITEM } from "../lib";
7
8 export const SequenceArrowGroupPlugin = createTPlatePlugin({
9 key: SEQUENCE_ARROW_GROUP,
10 node: {
11 isElement: true,
12 type: SEQUENCE_ARROW_GROUP,
13 component: SequenceArrow,
14 },
15 });
16
17 export const SequenceArrowItemPlugin = createTPlatePlugin({
18 key: SEQUENCE_ARROW_ITEM,
19 node: {
20 isElement: true,
21 isStrictSiblings: true,
22 type: SEQUENCE_ARROW_ITEM,
23 component: SequenceArrowItem,
24 },
25 });
26
27 export type TSequenceArrowGroupElement = TElement & {
28 type: typeof SEQUENCE_ARROW_GROUP;
29 orientation: "vertical" | "horizontal";
30 alignment?: "left" | "center" | "right";
31 };
32 export type TSequenceArrowItemElement = TElement & {
33 type: typeof SEQUENCE_ARROW_ITEM;
34 alignment?: "left" | "center" | "right";
35 };
36
36 lines Plain Text