From 55d2dddb7080ec129f5a4adb217ae943e3722933 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Sun, 6 Jan 2019 00:33:35 -0500 Subject: [PATCH] =?UTF-8?q?Keybind=20all=20of=20=5Funiq([t(sidebar.key),?= =?UTF-8?q?=20'`',=20'=C2=B2'])=20to=20toggle=20sidebar=20(closes=20#5663)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/ui/init.js | 5 ++++- modules/ui/shortcuts.js | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/ui/init.js b/modules/ui/init.js index 29d4defaa..0ec03e0d7 100644 --- a/modules/ui/init.js +++ b/modules/ui/init.js @@ -1,3 +1,5 @@ +import _uniq from 'lodash-es/uniq'; + import { event as d3_event, select as d3_select @@ -298,9 +300,10 @@ export function uiInit(context) { var panPixels = 80; + var sidebarKeys = _uniq([t('sidebar.key'), '`', '²']); // #5663 context.keybinding() .on('⌫', function() { d3_event.preventDefault(); }) - .on(t('sidebar.key'), ui.sidebar.toggle) + .on(sidebarKeys, ui.sidebar.toggle) .on('←', pan([panPixels, 0])) .on('↑', pan([0, panPixels])) .on('→', pan([-panPixels, 0])) diff --git a/modules/ui/shortcuts.js b/modules/ui/shortcuts.js index 43ee2b0b5..99c31e9bd 100644 --- a/modules/ui/shortcuts.js +++ b/modules/ui/shortcuts.js @@ -1,3 +1,5 @@ +import _uniq from 'lodash-es/uniq'; + import { select as d3_select, selectAll as d3_selectAll @@ -177,6 +179,8 @@ export function uiShortcuts(context) { arr = ['Y']; } else if (detected.os !== 'mac' && d.text === 'shortcuts.browsing.display_options.fullscreen') { arr = ['F11']; + } else if (d.text === 'shortcuts.browsing.display_options.sidebar') { + arr = _uniq([t('sidebar.key'), '`', '²']); // #5663 } return arr.map(function(s) {