@@ -108,6 +108,7 @@ function update_buttons() {
108108 update_single_button ( selection_size > 0 , $ ( '#deselect-notes-button' ) , 'Deselect' )
109109 update_single_button ( selection_size > 0 , $ ( '#sort_az-notes-button' ) , 'Sort' , 'A → Z' )
110110 update_single_button ( selection_size > 0 , $ ( '#sort_za-notes-button' ) , 'Sort' , 'Z → A' )
111+ update_single_button ( selection_size > 0 , $ ( '#sort_sl-notes-button' ) , 'Sort' , 'Short → Long' )
111112 update_single_button ( selection_size > 0 , $ ( '#number-notes-button' ) , 'Number' )
112113
113114 // if (selection_size > 1) {
@@ -215,6 +216,16 @@ $('#sort_za-notes-button').click(() => {
215216 sorted_list = note_elements_to_array ( selection ) . sort ( ) . reverse ( ) ;
216217 replace_note_elements ( selection , sorted_list ) ;
217218} ) ;
219+ // Short to long sort
220+ $ ( '#sort_sl-notes-button' ) . click ( ( ) => {
221+ selection = $ ( 'li.selected' ) ;
222+ record_event ( {
223+ 'type' : 'sort_sl' ,
224+ 'items' : selection
225+ } ) ;
226+ sorted_list = note_elements_to_array ( selection ) . sort ( ( a , b ) => a . length - b . length ) ;
227+ replace_note_elements ( selection , sorted_list ) ;
228+ } ) ;
218229// Reverse alphabetical sort
219230$ ( '#number-notes-button' ) . click ( ( ) => {
220231 selection = $ ( 'li.selected' ) ;
0 commit comments