From 3bcd4637a6e6d176e2ecb43df0964de2074e9cf4 Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Thu, 10 Apr 2014 12:04:22 +0200 Subject: [PATCH] Open list edit dialog on dbl-clicks --- plugins/kolab_notes/notes.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/plugins/kolab_notes/notes.js b/plugins/kolab_notes/notes.js index dc6d7d51..ef8262ce 100644 --- a/plugins/kolab_notes/notes.js +++ b/plugins/kolab_notes/notes.js @@ -106,6 +106,26 @@ function rcube_kolab_notes_ui(settings) } }); + // register dbl-click handler to open list edit dialog + $(rcmail.gui_objects.notebooks).on('dblclick', 'li:not(.virtual)', function(e){ + var id = String(this.id).replace(/^rcmliknb/, ''); + if (me.notebooks[id] && me.notebooks[id].editable) { + list_edit_dialog(id); + } + + // clear text selection (from dbl-clicking) + var sel = window.getSelection ? window.getSelection() : document.selection; + if (sel && sel.removeAllRanges) { + sel.removeAllRanges(); + } + else if (sel && sel.empty) { + sel.empty(); + } + + e.preventDefault(); + return false; + }); + // initialize notes list widget if (rcmail.gui_objects.noteslist) { noteslist = new rcube_list_widget(rcmail.gui_objects.noteslist,