/
controls.tsx
203 lines (177 loc) · 6.16 KB
/
controls.tsx
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
import React from 'react';
import {
IconBold,
IconItalic,
IconUnderline,
IconStrikethrough,
IconClearFormatting,
IconH1,
IconH2,
IconH3,
IconH4,
IconH5,
IconH6,
IconList,
IconListNumbers,
IconUnlink,
IconBlockquote,
IconAlignLeft,
IconAlignRight,
IconAlignCenter,
IconAlignJustified,
IconSubscript,
IconSuperscript,
IconCode,
IconHighlight,
IconLineDashed,
IconCircleOff,
} from '@tabler/icons';
import { createControl } from './ControlBase/create-control';
export const BoldControl = createControl({
label: 'boldControlLabel',
icon: (props) => <IconBold {...props} stroke={1.5} />,
isActive: { name: 'bold' },
operation: { name: 'toggleBold' },
});
export const ItalicControl = createControl({
label: 'italicControlLabel',
icon: (props) => <IconItalic {...props} stroke={1.5} />,
isActive: { name: 'italic' },
operation: { name: 'toggleItalic' },
});
export const UnderlineControl = createControl({
label: 'underlineControlLabel',
icon: (props) => <IconUnderline {...props} stroke={1.5} />,
isActive: { name: 'underline' },
operation: { name: 'toggleUnderline' },
});
export const StrikeThroughControl = createControl({
label: 'strikeControlLabel',
icon: (props) => <IconStrikethrough {...props} stroke={1.5} />,
isActive: { name: 'strike' },
operation: { name: 'toggleStrike' },
});
export const ClearFormattingControl = createControl({
label: 'clearFormattingControlLabel',
icon: (props) => <IconClearFormatting {...props} stroke={1.5} />,
operation: { name: 'unsetAllMarks' },
});
export const UnlinkControl = createControl({
label: 'unlinkControlLabel',
icon: (props) => <IconUnlink {...props} stroke={1.5} />,
operation: { name: 'unsetLink' },
});
export const BulletListControl = createControl({
label: 'bulletListControlLabel',
icon: (props) => <IconList {...props} stroke={1.5} />,
isActive: { name: 'bulletList' },
operation: { name: 'toggleBulletList' },
});
export const OrderedListControl = createControl({
label: 'orderedListControlLabel',
icon: (props) => <IconListNumbers {...props} stroke={1.5} />,
isActive: { name: 'orderedList' },
operation: { name: 'toggleOrderedList' },
});
export const H1Control = createControl({
label: 'h1ControlLabel',
icon: (props) => <IconH1 {...props} stroke={1.5} />,
isActive: { name: 'heading', attributes: { level: 1 } },
operation: { name: 'toggleHeading', attributes: { level: 1 } },
});
export const H2Control = createControl({
label: 'h2ControlLabel',
icon: (props) => <IconH2 {...props} stroke={1.5} />,
isActive: { name: 'heading', attributes: { level: 2 } },
operation: { name: 'toggleHeading', attributes: { level: 2 } },
});
export const H3Control = createControl({
label: 'h3ControlLabel',
icon: (props) => <IconH3 {...props} stroke={1.5} />,
isActive: { name: 'heading', attributes: { level: 3 } },
operation: { name: 'toggleHeading', attributes: { level: 3 } },
});
export const H4Control = createControl({
label: 'h4ControlLabel',
icon: (props) => <IconH4 {...props} stroke={1.5} />,
isActive: { name: 'heading', attributes: { level: 4 } },
operation: { name: 'toggleHeading', attributes: { level: 4 } },
});
export const H5Control = createControl({
label: 'h5ControlLabel',
icon: (props) => <IconH5 {...props} stroke={1.5} />,
isActive: { name: 'heading', attributes: { level: 5 } },
operation: { name: 'toggleHeading', attributes: { level: 5 } },
});
export const H6Control = createControl({
label: 'h6ControlLabel',
icon: (props) => <IconH6 {...props} stroke={1.5} />,
isActive: { name: 'heading', attributes: { level: 6 } },
operation: { name: 'toggleHeading', attributes: { level: 6 } },
});
export const BlockquoteControl = createControl({
label: 'blockquoteControlLabel',
icon: (props) => <IconBlockquote {...props} stroke={1.5} />,
isActive: { name: 'blockquote' },
operation: { name: 'toggleBlockquote' },
});
export const AlignLeftControl = createControl({
label: 'alignLeftControlLabel',
icon: (props) => <IconAlignLeft {...props} stroke={1.5} />,
operation: { name: 'setTextAlign', attributes: 'left' },
});
export const AlignRightControl = createControl({
label: 'alignRightControlLabel',
icon: (props) => <IconAlignRight {...props} stroke={1.5} />,
operation: { name: 'setTextAlign', attributes: 'right' },
});
export const AlignCenterControl = createControl({
label: 'alignCenterControlLabel',
icon: (props) => <IconAlignCenter {...props} stroke={1.5} />,
operation: { name: 'setTextAlign', attributes: 'center' },
});
export const AlignJustifyControl = createControl({
label: 'alignJustifyControlLabel',
icon: (props) => <IconAlignJustified {...props} stroke={1.5} />,
operation: { name: 'setTextAlign', attributes: 'justify' },
});
export const SubscriptControl = createControl({
label: 'subscriptControlLabel',
icon: (props) => <IconSubscript {...props} stroke={1.5} />,
isActive: { name: 'subscript' },
operation: { name: 'toggleSubscript' },
});
export const SuperscriptControl = createControl({
label: 'superscriptControlLabel',
icon: (props) => <IconSuperscript {...props} stroke={1.5} />,
isActive: { name: 'superscript' },
operation: { name: 'toggleSuperscript' },
});
export const CodeControl = createControl({
label: 'codeControlLabel',
icon: (props) => <IconCode {...props} stroke={1.5} />,
isActive: { name: 'code' },
operation: { name: 'toggleCode' },
});
export const CodeBlockControl = createControl({
label: 'codeBlockControlLabel',
icon: (props) => <IconCode {...props} stroke={1.5} />,
isActive: { name: 'codeBlock' },
operation: { name: 'toggleCodeBlock' },
});
export const HighlightControl = createControl({
label: 'highlightControlLabel',
icon: (props) => <IconHighlight {...props} stroke={1.5} />,
isActive: { name: 'highlight' },
operation: { name: 'toggleHighlight' },
});
export const HrControl = createControl({
label: 'highlightControlLabel',
icon: (props) => <IconLineDashed {...props} stroke={1.5} />,
operation: { name: 'setHorizontalRule' },
});
export const UnsetColorControl = createControl({
label: 'unsetColorControlLabel',
icon: (props) => <IconCircleOff {...props} stroke={1.5} />,
operation: { name: 'unsetColor' },
});