Refine the backspace operation in spine label editor
authordbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 30 Aug 2010 12:26:04 +0000 (12:26 +0000)
committerdbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 30 Aug 2010 12:26:04 +0000 (12:26 +0000)
Make backspace at the start of a line also move up to the previous row.

git-svn-id: svn://svn.open-ils.org/ILS/trunk@17366 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/server/cat/spine_labels.js

index f742a38..5b24e18 100644 (file)
 
                 case dojo.keys.BACKSPACE : {
                     /* Delete line if at the start of an input box */
-                    if (sel_start == 0) {
+                    if (sel_start == 0 && sel_end == sel_start) {
                         var new_label = '';
                         var chunk;
                         var x = 0;
                         generate({"acn": row_id.acn, "label": new_label});
                         $(row_id.prefix + row_id.spine).focus();
                     }
+                    if (sel_start == 0) {
+                        /* Move to the previous row */
+                        var prev_row = $(row_id.prefix + (parseInt(row_id.spine) - 1));
+                        if (prev_row) {
+                            prev_row.focus();
+                        }
+                    }
                     break;
                 }