From 9e5f6cc1d0ec63d410abce5acd445d5f087d3b17 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Thu, 5 Jan 2017 05:23:29 +0300 Subject: [PATCH] added .not-searchable and .not-filterd-out classes to browse items + now sections of kb binding editor will not get hidden on searches... Signed-off-by: Alex A. Naanou --- ui (gen4)/features/keyboard.js | 36 ++++++++++++++-------------------- ui (gen4)/lib/widget/browse.js | 17 ++++++++++++---- 2 files changed, 28 insertions(+), 25 deletions(-) diff --git a/ui (gen4)/features/keyboard.js b/ui (gen4)/features/keyboard.js index 849578a3..723c615a 100755 --- a/ui (gen4)/features/keyboard.js +++ b/ui (gen4)/features/keyboard.js @@ -602,26 +602,12 @@ var KeyboardActions = actions.Actions({ })], - // XXX build a dialog like this: - // - // +---------------------------------------------------+ - // +- ----------------------------- ^ v - edit -+ - // | / ^ v - edit | - // | / ^ v - edit | - // | ... | - // | [+] | - // +- ----------------------------- ^ v - edit -+ - // | / ^ v - edit | - // | ... | - // | [+] | - // +---------------------------------------------------+ - // - // * will need to sort modes - // * will need to sort actions - // * might be good to do an action editor dialog - // * add ability to disable key without deleting - // * use the same mechanics to show the keys as in .browseActions(..) - // + // XXX Things not to forget: + // * sort modes + // * sort actions + // * action editor dialog + // * mode editor dialog + // * add ability to disable key (???) // XXX do not hide modes on search... browseKeyboardBindings: ['Interface/Keyboard bindings editor (EXPERIMENTAL)...', widgets.makeUIDialog(function(path){ @@ -664,7 +650,9 @@ var KeyboardActions = actions.Actions({ .addClass('doc') .html(keys[mode].doc)) : mode) - .addClass('mode') + // XXX should sections be searchable??? + //.addClass('mode not-searchable') + .addClass('mode not-filterd-out') // bindings... Object.keys(keys[mode]) @@ -712,6 +700,12 @@ var KeyboardActions = actions.Actions({ return dialog })], + + // XXX + resetKeyBindings: ['Interface/Restore default key bindings', + function(){ + // XXX + }] }) var Keyboard = diff --git a/ui (gen4)/lib/widget/browse.js b/ui (gen4)/lib/widget/browse.js index 52eba565..c7fec966 100755 --- a/ui (gen4)/lib/widget/browse.js +++ b/ui (gen4)/lib/widget/browse.js @@ -1310,6 +1310,12 @@ var BrowserPrototype = { // disabled elements. If is false then disabled // elements will be searched too. // + // If an item has .not-searchable class set, then it will neither be + // searched nor filtered out. + // + // If an item has .not-filtered-out class set, then it will not be + // hidden on filtering (see: .filterList(..)). + // // NOTE: this will filter every item loaded regardless of visibility. // // @@ -1345,7 +1351,7 @@ var BrowserPrototype = { var that = this var browser = this.dom - var elems = browser.find('.list>div' + var elems = browser.find('.list>div:not(.not-searchable)' + (this.options.elementSeparatorClass ? ':not('+ this.options.elementSeparatorClass +')' : '') @@ -1446,6 +1452,9 @@ var BrowserPrototype = { // // Use .filterList('*') to clear filter and show all elements. // + // If an item has .not-filtered-out class set, then it will not be + // hidden on filtering. + // // NOTE: see .filter(..) for docs on actual filtering. // NOTE: this does not affect any UI modes, for list filtering mode // see: .toggleFilter(..)... @@ -1480,9 +1489,9 @@ var BrowserPrototype = { this.filter(pattern, // rejected... function(i, e){ - e - .addClass('filtered-out') - .removeClass('selected') + !e.hasClass('not-filterd-out') + && e.addClass('filtered-out') + e.removeClass('selected') }, // NOTE: setting this to true will not remove disabled // elements from view as they will neither get