From 65eaddb321d552be354ff518699849bcf100e5f1 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sun, 31 May 2020 17:28:46 +0300 Subject: [PATCH] some tweaking + docs... Signed-off-by: Alex A. Naanou --- ui (gen4)/features/core.js | 5 +++++ ui (gen4)/features/location.js | 1 + ui (gen4)/features/ui-widgets.js | 21 ++++++++++++++++++++- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/ui (gen4)/features/core.js b/ui (gen4)/features/core.js index d306bc10..beba8d8b 100755 --- a/ui (gen4)/features/core.js +++ b/ui (gen4)/features/core.js @@ -487,6 +487,11 @@ var IntrospectionActions = actions.Actions({ return !!action.__event__ }), // XXX revise... + // XXX this is a bit restrictive, need to be able to setup mode + // aliases/handlers, i.e. setting {mode: 'advanced'} and either + // getting the actual value from .config or calling a mode handler... + // ...might also be nice to use a toggler as handler: + // {mode: 'toggleBrowseAdvanced'} getActionMode: ['- Interface/', doc`Get action browse mode... diff --git a/ui (gen4)/features/location.js b/ui (gen4)/features/location.js index c7cc3394..201f656a 100755 --- a/ui (gen4)/features/location.js +++ b/ui (gen4)/features/location.js @@ -352,6 +352,7 @@ var LocationActions = actions.Actions({ core.doc`Toggle index synchronization method NOTE: this will not show disabled methods.`, + {mode: 'toggleBrowseActionKeys'}, toggler.Toggler(null, function(_, state){ var dict = this.location_sync_methods diff --git a/ui (gen4)/features/ui-widgets.js b/ui (gen4)/features/ui-widgets.js index 6a3c6fc1..22fc0923 100755 --- a/ui (gen4)/features/ui-widgets.js +++ b/ui (gen4)/features/ui-widgets.js @@ -2932,7 +2932,7 @@ var BrowseActionsActions = actions.Actions({ actions.config['browse-actions-keys'] && this.dom.addClass('show-keys') - // handle '?' button to browse path... + // handle '?' -- show doc... var showDoc = this.showDoc = function(){ var action = this.select('!').attr('action') action @@ -2940,9 +2940,28 @@ var BrowseActionsActions = actions.Actions({ } this.keyboard.handler('General', '?', 'showDoc') this.menu(showDoc.bind(this)) + + // handle ctrl-a -- toggle advanced mode... + var toggleAdvanced = this.toggleAdvanced = function(){ + actions.toggleBrowseAdvanced() + this.update() + } + this.keyboard.handler('General', 'ctrl-a', 'toggleAdvanced') }) })], toggleBrowseAdvanced: ['System|Interface/-99: Advanced menu items', + core.doc`Toggle advanced menu items... + + An item can: + - define a .mode() mothod + - check .config['browse-advanced-mode'] to be 'on' / 'off' + - return 'hidden' when needed + or: + - link to an action that behaves in a desired way: + {mode: 'toggleBrowseActionKeys',} + + See .toggleBrowseActionKeys(..) for an example. + `, core.makeConfigToggler( 'browse-advanced-mode', ['off', 'on'])],