diff --git a/ui (gen4)/lib/widget/browse.js b/ui (gen4)/lib/widget/browse.js index b60264f7..33cc32e4 100755 --- a/ui (gen4)/lib/widget/browse.js +++ b/ui (gen4)/lib/widget/browse.js @@ -146,7 +146,7 @@ var BrowserPrototype = { 'select', 'deselect', - 'keydown', + //'keydown', ], }, @@ -1842,7 +1842,6 @@ PathListPrototype.options = { // setup handlers... if(!star && data !== keys && kp.length == 0 && data[k] != null){ - //console.log('>>> "'+ cur +'" -> "'+ k +'"') e.on('open', function(){ return that.options.data[k].apply(this, arguments) }) diff --git a/ui (gen4)/lib/widget/overlay.js b/ui (gen4)/lib/widget/overlay.js index 2a81a927..2b8fd298 100755 --- a/ui (gen4)/lib/widget/overlay.js +++ b/ui (gen4)/lib/widget/overlay.js @@ -9,6 +9,7 @@ console.log('>>> overlay') //var DEBUG = DEBUG != null ? DEBUG : true +var keyboard = require('../keyboard') var object = require('../../object') var widget = require('./widget') @@ -37,13 +38,23 @@ var OverlayClassPrototype = { var OverlayPrototype = { dom: null, + client: null, + options: { nonPropagatedEvents: [ - 'clik', - //'keydown', + 'click', + 'keydown', ], }, + keyboard: { + General: { + pattern: '.browse-widget', + + Esc: 'close', + }, + }, + // XXX triggering events from here and from jQuery/dom has a // different effect... trigger: widget.triggerEventWithSource, @@ -78,12 +89,14 @@ var OverlayPrototype = { parent = this.parent = $(parent || 'body') options = options || {} + this.client = client + // merge options... var opts = Object.create(this.options) Object.keys(options).forEach(function(n){ opts[n] = options[n] }) options = this.options = opts - var dom = this.dom = this.constructor.make(client, options) + var dom = this.dom = this.constructor.make(client.dom || client, options) .click(function(){ that.close() }) @@ -92,6 +105,18 @@ var OverlayPrototype = { .addClass('blur') .append(dom) + // add keyboard handler... + dom.keydown( + keyboard.makeKeyboardHandler( + this.keyboard, + options.logKeys, + this)) + + // focus the client... + if(client.focus){ + client.focus() + } + return this }, } diff --git a/ui (gen4)/ui.js b/ui (gen4)/ui.js index 28e9e453..3cdea63f 100755 --- a/ui (gen4)/ui.js +++ b/ui (gen4)/ui.js @@ -236,27 +236,36 @@ $(function(){ window.browse = browse window.overlay = overlay + actionCategoryOrder = [ + 'File', + 'Edit', + 'Navigate', + ] var makeActionLister = function(list, filter){ return function(){ var paths = a.getPath() var actions = {} + // pre-order the main categories... + actionCategoryOrder.forEach(function(k){ + actions[k] = null + }) + + // build the action list... Object.keys(paths).forEach(function(k){ var n = paths[k][0] var k = filter ? filter(k) : k actions[k] = function(){ - console.log('>>>>', n, k) return a[n]() } }) - var b = L = list(null, actions) - var o = overlay.Overlay($('body'), b.dom) + var o = overlay.Overlay($('body'), + list(null, actions) + .open(function(){ o.close() })) - b.open(function(){ o.close() }) - - b.focus() + L = o.client } }