@@ -4,7 +4,8 @@ public class Layouts.QuickAdd : Adw.Bin {
4
4
5
5
private Gtk . Entry content_entry;
6
6
private Widgets . LoadingButton submit_button;
7
- private Widgets . HyperTextView description_textview;
7
+ private Widgets . Markdown . Buffer current_buffer;
8
+ private Widgets . Markdown . EditView markdown_edit_view;
8
9
private Widgets . ItemLabels item_labels;
9
10
private Widgets . ProjectPicker . ProjectPickerButton project_picker_button;
10
11
private Widgets . ScheduleButton schedule_button;
@@ -75,16 +76,16 @@ public class Layouts.QuickAdd : Adw.Bin {
75
76
76
77
content_box. append (content_entry);
77
78
78
- description_textview = new Widgets .HyperTextView (_(" Add a description…" )) {
79
- height_request = 64 ,
79
+ current_buffer = new Widgets .Markdown .Buffer ();
80
+
81
+ markdown_edit_view = new Widgets .Markdown .EditView () {
80
82
left_margin = 14 ,
81
83
right_margin = 6 ,
82
84
top_margin = 6 ,
83
- wrap_mode = Gtk . WrapMode . WORD_CHAR ,
84
- hexpand = true
85
+ connect_typing = false
85
86
};
86
-
87
- description_textview . remove_css_class ( " view " ) ;
87
+
88
+ markdown_edit_view . buffer = current_buffer ;
88
89
89
90
item_labels = new Widgets .ItemLabels (item) {
90
91
margin_start = 6 ,
@@ -127,7 +128,7 @@ public class Layouts.QuickAdd : Adw.Bin {
127
128
quick_add_content. add_css_class (" card" );
128
129
quick_add_content. add_css_class (" sidebar-card" );
129
130
quick_add_content. append (content_box);
130
- quick_add_content. append (description_textview );
131
+ quick_add_content. append (markdown_edit_view );
131
132
quick_add_content. append (item_labels);
132
133
quick_add_content. append (action_box);
133
134
@@ -280,15 +281,15 @@ public class Layouts.QuickAdd : Adw.Bin {
280
281
return false ;
281
282
});
282
283
283
- var description_controller_key = new Gtk .EventControllerKey ();
284
- description_textview.add_controller (description_controller_key );
285
- description_controller_key.key_pressed.connect ((keyval , keycode , state ) => {
286
- if ((ctrl_pressed || shift_pressed) && keyval == 65293 ) {
287
- add_item ();
288
- }
284
+ // var description_controller_key = new Gtk.EventControllerKey ();
285
+ // description_textview.add_controller (description_controller_key);
286
+ // description_controller_key.key_pressed.connect ((keyval, keycode, state) => {
287
+ // if ((ctrl_pressed || shift_pressed) && keyval == 65293) {
288
+ // add_item ();
289
+ // }
289
290
290
- return false ;
291
- });
291
+ // return false;
292
+ // });
292
293
293
294
var event_controller_key = new Gtk .EventControllerKey ();
294
295
((Gtk . Widget ) this ). add_controller (event_controller_key );
@@ -330,7 +331,7 @@ public class Layouts.QuickAdd : Adw.Bin {
330
331
}
331
332
332
333
item. content = content_entry. get_text ();
333
- item. description = description_textview . get_text ();
334
+ item. description = current_buffer . get_all_text () . chomp ();
334
335
335
336
if (item. project. backend_type == BackendType . LOCAL ) {
336
337
item. id = Util . get_default (). generate_id ();
@@ -380,7 +381,7 @@ public class Layouts.QuickAdd : Adw.Bin {
380
381
reset_item ();
381
382
382
383
content_entry. text = " " ;
383
- description_textview . set_text (" " );
384
+ current_buffer . set_text (" " );
384
385
schedule_button. reset ();
385
386
priority_button. reset ();
386
387
pin_button. reset ();
0 commit comments