Page MenuHomePhabricator

D15984.id.diff
No OneTemporary

D15984.id.diff

diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -8,7 +8,7 @@
return array(
'names' => array(
'core.pkg.css' => '2fbe65a2',
- 'core.pkg.js' => '49f8bdc0',
+ 'core.pkg.js' => '1bcca0f3',
'darkconsole.pkg.js' => 'e7393ebb',
'differential.pkg.css' => '3e81ae60',
'differential.pkg.js' => '634399e9',
@@ -491,7 +491,7 @@
'rsrc/js/core/behavior-history-install.js' => '7ee2b591',
'rsrc/js/core/behavior-hovercard.js' => 'bcaccd64',
'rsrc/js/core/behavior-keyboard-pager.js' => 'a8da01f0',
- 'rsrc/js/core/behavior-keyboard-shortcuts.js' => '7835f8c9',
+ 'rsrc/js/core/behavior-keyboard-shortcuts.js' => '01fca1f0',
'rsrc/js/core/behavior-lightbox-attachments.js' => 'f8ba29d7',
'rsrc/js/core/behavior-line-linker.js' => '1499a8cb',
'rsrc/js/core/behavior-more.js' => 'a80d0378',
@@ -654,7 +654,7 @@
'javelin-behavior-phabricator-gesture' => '3ab51e2c',
'javelin-behavior-phabricator-gesture-example' => '558829c2',
'javelin-behavior-phabricator-keyboard-pager' => 'a8da01f0',
- 'javelin-behavior-phabricator-keyboard-shortcuts' => '7835f8c9',
+ 'javelin-behavior-phabricator-keyboard-shortcuts' => '01fca1f0',
'javelin-behavior-phabricator-line-linker' => '1499a8cb',
'javelin-behavior-phabricator-nav' => '56a1ca03',
'javelin-behavior-phabricator-notification-example' => '8ce821c5',
@@ -921,6 +921,13 @@
'javelin-workflow',
'phabricator-draggable-list',
),
+ '01fca1f0' => array(
+ 'javelin-behavior',
+ 'javelin-workflow',
+ 'javelin-json',
+ 'javelin-dom',
+ 'phabricator-keyboard-shortcut',
+ ),
'031cee25' => array(
'javelin-behavior',
'javelin-request',
@@ -1499,13 +1506,6 @@
'multirow-row-manager',
'javelin-json',
),
- '7835f8c9' => array(
- 'javelin-behavior',
- 'javelin-workflow',
- 'javelin-json',
- 'javelin-dom',
- 'phabricator-keyboard-shortcut',
- ),
'7927a7d3' => array(
'javelin-behavior',
'javelin-quicksand',
diff --git a/src/view/page/menu/PhabricatorMainMenuView.php b/src/view/page/menu/PhabricatorMainMenuView.php
--- a/src/view/page/menu/PhabricatorMainMenuView.php
+++ b/src/view/page/menu/PhabricatorMainMenuView.php
@@ -186,9 +186,17 @@
}
$result = $search;
+ $keyboard_config['searchID'] = $search->getID();
}
- Javelin::initBehavior('phabricator-keyboard-shortcuts', $keyboard_config);
+ $keyboard_config['pht'] = array(
+ '/' => pht('Give keyboard focus to the search box.'),
+ '?' => pht('Show keyboard shortcut help for the current page.'),
+ );
+
+ Javelin::initBehavior(
+ 'phabricator-keyboard-shortcuts',
+ $keyboard_config);
if ($result) {
$result = id(new PHUIListItemView())
diff --git a/webroot/rsrc/js/core/behavior-keyboard-shortcuts.js b/webroot/rsrc/js/core/behavior-keyboard-shortcuts.js
--- a/webroot/rsrc/js/core/behavior-keyboard-shortcuts.js
+++ b/webroot/rsrc/js/core/behavior-keyboard-shortcuts.js
@@ -11,10 +11,10 @@
* Define global keyboard shortcuts.
*/
JX.behavior('phabricator-keyboard-shortcuts', function(config) {
+ var pht = JX.phtize(config.pht);
var workflow = null;
- var desc = 'Show keyboard shortcut help for the current page.';
- new JX.KeyboardShortcut('?', desc)
+ new JX.KeyboardShortcut('?', pht('?'))
.setHandler(function(manager) {
if (workflow) {
// Already showing the dialog.
@@ -30,4 +30,14 @@
})
.register();
+ if (config.searchID) {
+ new JX.KeyboardShortcut('/', pht('/'))
+ .setHandler(function() {
+ var search = JX.$(config.searchID);
+ search.focus();
+ search.select();
+ })
+ .register();
+ }
+
});

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 17, 10:14 PM (21 h, 31 m ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6716004
Default Alt Text
D15984.id.diff (3 KB)

Event Timeline