@@ -19,10 +19,12 @@ class MarkdownToolbar extends StatelessWidget {
19
19
final bool showPreviewButton;
20
20
final bool showEmojiSelection;
21
21
final VoidCallback ? onActionCompleted;
22
+ final String ? markdownSyntax;
22
23
23
24
MarkdownToolbar ({
24
25
Key ? key,
25
26
this .onPreviewChanged,
27
+ this .markdownSyntax,
26
28
required this .controller,
27
29
this .emojiConvert = true ,
28
30
this .unfocus,
@@ -57,6 +59,31 @@ class MarkdownToolbar extends StatelessWidget {
57
59
onPressedButton: onPreviewChanged,
58
60
tooltip: 'Show/Hide markdown preview' ,
59
61
),
62
+
63
+ // Clear the field
64
+ ToolbarItem (
65
+ key: const ValueKey <String >("toolbar_clear_action" ),
66
+ icon: FontAwesomeIcons .trashCan,
67
+ onPressedButton: () {
68
+ controller.clear ();
69
+ onActionCompleted? .call ();
70
+ },
71
+ tooltip: 'Clear the text field' ,
72
+ ),
73
+
74
+ // Reset the text field
75
+ ToolbarItem (
76
+ key: const ValueKey <String >("toolbar_reset_action" ),
77
+ icon: FontAwesomeIcons .arrowRotateLeft,
78
+ onPressedButton: () {
79
+ if (markdownSyntax != null ) {
80
+ controller.text = markdownSyntax! ;
81
+ onActionCompleted? .call ();
82
+ }
83
+ },
84
+ tooltip: 'Reset the text field to specified format' ,
85
+ ),
86
+
60
87
// select single line
61
88
ToolbarItem (
62
89
key: const ValueKey <String >("toolbar_selection_action" ),
@@ -154,7 +181,7 @@ class MarkdownToolbar extends StatelessWidget {
154
181
ToolbarItem (
155
182
key: const ValueKey <String >("checkbox" ),
156
183
icon: FontAwesomeIcons .solidSquareCheck,
157
- tooltip: 'Checked box ' ,
184
+ tooltip: 'Checked checkbox ' ,
158
185
onPressedButton: () {
159
186
toolbar.action ("- [x] " , "" );
160
187
onActionCompleted? .call ();
@@ -163,7 +190,7 @@ class MarkdownToolbar extends StatelessWidget {
163
190
ToolbarItem (
164
191
key: const ValueKey <String >("uncheckbox" ),
165
192
icon: FontAwesomeIcons .square,
166
- tooltip: 'Unchecked box ' ,
193
+ tooltip: 'Unchecked checkbox ' ,
167
194
onPressedButton: () {
168
195
toolbar.action ("- [ ] " , "" );
169
196
onActionCompleted? .call ();
@@ -175,7 +202,7 @@ class MarkdownToolbar extends StatelessWidget {
175
202
if (showEmojiSelection)
176
203
ToolbarItem (
177
204
key: const ValueKey <String >("toolbar_emoji_action" ),
178
- icon: FontAwesomeIcons .solidFaceSmile ,
205
+ icon: FontAwesomeIcons .faceSmile ,
179
206
tooltip: 'Select emoji' ,
180
207
onPressedButton: () async {
181
208
await _showModalSelectEmoji (context, controller.selection);
0 commit comments