File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed
Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ <h3>PowerNote</h3>
4343 < button id ="deselect-notes-button " type ="button " class ="btn btn-primary btn-block " data-toggle ="tooltip " data-placement ="right " title ="Import notes from clipboard (copy & paste) "> Clipboard</ button >
4444 < button id ="deselect-notes-button " type ="button " class ="btn btn-primary btn-block " data-toggle ="tooltip " data-placement ="right " title ="Undo the last action "> Undo</ button >
4545 < button id ="deselect-notes-button " type ="button " class ="btn btn-primary btn-block " data-toggle ="tooltip " data-placement ="right " title ="Redo the last undone action "> Redo</ button >
46+ < button id ="number-notes-button " type ="button " class ="btn btn-primary btn-block " data-toggle ="tooltip " data-placement ="right " title ="Convert selected notes into a numbered list "> Number</ button >
4647 </ div >
4748 <!-- </div> -->
4849 </ div >
Original file line number Diff line number Diff line change @@ -104,6 +104,7 @@ function update_buttons() {
104104 update_single_button ( selection_size > 0 , $ ( '#deselect-notes-button' ) , 'Deselect' )
105105 update_single_button ( selection_size > 0 , $ ( '#sort_az-notes-button' ) , 'Sort' , 'A → Z' )
106106 update_single_button ( selection_size > 0 , $ ( '#sort_za-notes-button' ) , 'Sort' , 'Z → A' )
107+ update_single_button ( selection_size > 0 , $ ( '#number-notes-button' ) , 'Number' )
107108
108109 // if (selection_size > 1) {
109110 // $('#merge-notes-button').text('Merge ' + selection_size);
@@ -193,6 +194,19 @@ $('#sort_za-notes-button').click(() => {
193194 sorted_list = note_elements_to_array ( selection ) . sort ( ) . reverse ( ) ;
194195 replace_note_elements ( selection , sorted_list ) ;
195196} ) ;
197+ // Reverse alphabetical sort
198+ $ ( '#number-notes-button' ) . click ( ( ) => {
199+ selection = $ ( 'li.selected' ) ;
200+ record_event ( {
201+ 'type' : 'number' ,
202+ 'items' : selection
203+ } ) ;
204+ var list = note_elements_to_array ( selection ) ;
205+ for ( var i = 0 ; i < list . length ; i ++ ) {
206+ list [ i ] = ( i + 1 ) + '. ' + list [ i ] ;
207+ }
208+ replace_note_elements ( selection , list ) ;
209+ } ) ;
196210
197211// Load test data
198212notes = testdata . split ( '\n' ) ;
You can’t perform that action at this time.
0 commit comments