-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathcustom-types.d.ts
104 lines (85 loc) · 2.43 KB
/
custom-types.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import { Text, createEditor, Node, Element, Editor, Descendant, BaseEditor } from '@src/components/slate-packages/slate';
import { ReactEditor } from '@src/components/slate-packages/slate-react';
import { HistoryEditor } from '@src/components/slate-packages/slate-history';
import { ELTYPE, HEADING_TYPES } from '@src/components/docs/plugins/config';
export type BlockQuoteElement = {
type: ELTYPE.BLOCK_QUOTE;
align?: string;
children: Descendant[];
};
export type OrderedListElement = {
type: ELTYPE.OLLIST;
align?: string;
children: Descendant[];
};
export type UnorderedListElement = {
type: ELTYPE.ULLIST;
align?: string;
children: Descendant[];
};
export type TodoListElement = {
type: ELTYPE.TODO_LIST;
checked: boolean;
children: Descendant[];
};
export type HeadingElement = {
type: typeof HEADING_TYPES[number];
align?: string;
children: Descendant[];
};
export type InlineImageElement = {
type: ELTYPE.INLINEIMAGE;
url: string;
children: EmptyText[];
};
export type LinkElement = { type: ELTYPE.LINK; url: string; children: Descendant[] };
export type MentionElement = {
type: ELTYPE.MENTION;
character: string;
children: EmptyText[];
};
export type ParagraphElement = {
type: ELTYPE.PARAGRAPH;
align?: string;
children: Descendant[];
};
export type TableElement = { type: ELTYPE.TABLE; row: number; col: number; hwEach: string[][]; children: TableRow[] };
export type TableCellElement = { type: ELTYPE.TABLE_CELL; children: Descendant[] };
export type TableRowElement = { type: ELTYPE.TABLE_ROW; children: TableCell[] };
export type TitleElement = { type: ELTYPE.HEADING_ONE; children: Text[] };
export type VideoElement = { type: ELTYPE.VIDEO; url: string; children: EmptyText[] };
type CustomElement =
| BlockQuoteElement
| UnorderedListElement
| OrderedListElement
| TodoListElement
| HeadingElement
| ImageElement
| InlineImageElement
| LinkElement
| MentionElement
| ParagraphElement
| TableElement
| TableRowElement
| TableCellElement
| TitleElement
| VideoElement;
export type CustomText = {
bold?: boolean;
italic?: boolean;
code?: boolean;
strikethrough?: boolean;
underline?: boolean;
text: string;
};
export type EmptyText = {
text: string;
};
export type CustomEditor = BaseEditor & ReactEditor & HistoryEditor;
declare module 'slate' {
interface CustomTypes {
Editor: CustomEditor;
Element: CustomElement;
Text: CustomText | EmptyText;
}
}