File tree Expand file tree Collapse file tree 1 file changed +23
-2
lines changed
Expand file tree Collapse file tree 1 file changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -68,7 +68,9 @@ function load_note(text) {
6868// Convert list of note elements to an array of their contents
6969function note_elements_to_array ( selection ) {
7070 note_list = [ ] ;
71- selection . each ( ( i ) => note_list . push ( selection [ i ] . innerText ) ) ;
71+ for ( var i = 0 ; i < selection . length ; i ++ ) {
72+ note_list . push ( selection [ i ] . innerText ) ;
73+ }
7274 return note_list ;
7375}
7476
@@ -79,7 +81,9 @@ function replace_note_elements(selection, sorted_list) {
7981 item . insertBefore ( selection [ 0 ] ) ;
8082 Sortable . utils . select ( item [ 0 ] ) ;
8183 }
82- selection . remove ( )
84+ for ( var i = 0 ; i < selection . length ; i ++ ) {
85+ selection [ i ] . remove ( )
86+ }
8387}
8488
8589function update_single_button ( condition , element , button_text , suffix ) {
@@ -156,6 +160,23 @@ $('#merge-notes-button').click(() => {
156160
157161 update_buttons ( ) ;
158162} ) ;
163+ // Unmerge (split by newline)
164+ $ ( '#unmerge-notes-button' ) . click ( ( ) => {
165+ record_event ( {
166+ 'type' : 'unmerge' ,
167+ 'items' : $ ( 'li' )
168+ } ) ;
169+ selection = $ ( 'li.selected' ) ;
170+
171+ for ( var i = 0 ; i < selection . length ; i ++ ) {
172+ replace_note_elements (
173+ [ selection [ i ] ] ,
174+ note_elements_to_array ( [ selection [ i ] ] ) [ 0 ] . split ( '\n' )
175+ ) ;
176+ }
177+
178+ update_buttons ( ) ;
179+ } ) ;
159180// Select all
160181$ ( '#select-notes-button' ) . click ( ( ) => {
161182 record_event ( {
You can’t perform that action at this time.
0 commit comments