forked from worktile/slate-angular
-
Notifications
You must be signed in to change notification settings - Fork 0
/
custom-types.d.ts
112 lines (90 loc) · 2.83 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
105
106
107
108
109
110
111
112
import {
Descendant,
BaseEditor,
} from 'slate'
import { AngularEditor } from 'slate-angular';
export type BlockQuoteElement = { type: 'block-quote'; children: Descendant[] }
export type BulletedListElement = {
type: 'bulleted-list'
children: Descendant[]
}
export type NumberedListElement = {
type: 'numbered-list'
children: Descendant[]
}
export type CheckListItemElement = {
type: 'check-list-item'
checked: boolean
children: Descendant[]
}
export type EditableVoidElement = {
type: 'editable-void'
children: EmptyText[]
}
export type HeadingOneElement = { type: 'heading-one'; children: Descendant[] }
export type HeadingTwoElement = { type: 'heading-two'; children: Descendant[] }
export type HeadingThreeElement = { type: 'heading-three'; children: Descendant[] }
export type HeadingFourElement = { type: 'heading-four'; children: Descendant[] }
export type HeadingFiveElement = { type: 'heading-five'; children: Descendant[] }
export type HeadingSixElement = { type: 'heading-six'; children: Descendant[] }
export type ImageElement = {
type: 'image'
url: string
children: EmptyText[]
}
export type LinkElement = { type: 'link'; url: string; children: Descendant[] }
export type ButtonElement = { type: 'button'; children: Descendant[] }
export type ListItemElement = { type: 'list-item'; children: Descendant[] }
export type MentionElement = {
type: 'mention'
character: string
children: CustomText[]
}
export type ParagraphElement = { type: 'paragraph'; children: Descendant[] }
export type TableElement = { type: 'table'; children: TableRowElement[] }
export type TableCellElement = { type: 'table-cell'; children: Descendant[] }
export type TableRowElement = { type: 'table-row'; children: TableCellElement[] }
export type TitleElement = { type: 'title'; children: Descendant[] }
export type VideoElement = { type: 'video'; url: string; children: EmptyText[] }
type CustomElement =
| BlockQuoteElement
| NumberedListElement
| BulletedListElement
| CheckListItemElement
| EditableVoidElement
| HeadingOneElement
| HeadingTwoElement
| HeadingThreeElement
| HeadingFourElement
| HeadingFiveElement
| HeadingSixElement
| ImageElement
| LinkElement
| ListItemElement
| MentionElement
| ParagraphElement
| TableElement
| TableRowElement
| TableCellElement
| TitleElement
| VideoElement
| ButtonElement;
export type CustomText = {
placeholder?: string
bold?: boolean
italic?: boolean
code?: boolean
text: string
'code-line'?: boolean
}
export type EmptyText = {
text: string
}
export type CustomEditor = BaseEditor & AngularEditor
declare module 'slate' {
interface CustomTypes {
Editor: CustomEditor
Element: CustomElement
Text: CustomText | EmptyText
}
}