From 889b99552aa8d5bbf61b458391f3125c31f42bb0 Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 17 Aug 2017 12:57:08 -0400 Subject: [PATCH] FEATURE: allow ctrl+shift+s to open search --- app/assets/javascripts/discourse/components/d-editor.js.es6 | 2 +- .../javascripts/discourse/lib/keyboard-shortcuts.js.es6 | 4 ++-- app/assets/javascripts/discourse/widgets/search-menu.js.es6 | 1 + config/locales/client.en.yml | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/discourse/components/d-editor.js.es6 b/app/assets/javascripts/discourse/components/d-editor.js.es6 index 574d3b49b5f..ac3c82689f5 100644 --- a/app/assets/javascripts/discourse/components/d-editor.js.es6 +++ b/app/assets/javascripts/discourse/components/d-editor.js.es6 @@ -236,7 +236,7 @@ export default Ember.Component.extend({ const shortcuts = this.get('toolbar.shortcuts'); // for some reason I am having trouble bubbling this so hack it in - mouseTrap.bind(['ctrl+/','command+/'], (event) =>{ + mouseTrap.bind(['ctrl+shift+s','command+shift+s'], (event) =>{ this.appEvents.trigger('header:keyboard-trigger', {type: 'search', event}); return true; }); diff --git a/app/assets/javascripts/discourse/lib/keyboard-shortcuts.js.es6 b/app/assets/javascripts/discourse/lib/keyboard-shortcuts.js.es6 index 1979fa984f7..6ae50d04755 100644 --- a/app/assets/javascripts/discourse/lib/keyboard-shortcuts.js.es6 +++ b/app/assets/javascripts/discourse/lib/keyboard-shortcuts.js.es6 @@ -6,8 +6,8 @@ const bindings = { '!': {postAction: 'showFlags'}, '#': {handler: 'goToPost', anonymous: true}, '/': {handler: 'toggleSearch', anonymous: true}, - 'ctrl+/': {handler: 'toggleSearch', anonymous: true}, - 'command+/': {handler: 'toggleSearch', anonymous: true}, + 'ctrl+shift+s': {handler: 'toggleSearch', anonymous: true}, + 'command+shift+s': {handler: 'toggleSearch', anonymous: true}, '=': {handler: 'toggleHamburgerMenu', anonymous: true}, '?': {handler: 'showHelpModal', anonymous: true}, '.': {click: '.alert.alert-info.clickable', anonymous: true}, // show incoming/updated topics diff --git a/app/assets/javascripts/discourse/widgets/search-menu.js.es6 b/app/assets/javascripts/discourse/widgets/search-menu.js.es6 index 3da70746744..76ff9a05274 100644 --- a/app/assets/javascripts/discourse/widgets/search-menu.js.es6 +++ b/app/assets/javascripts/discourse/widgets/search-menu.js.es6 @@ -181,6 +181,7 @@ export default createWidget('search-menu', { // add a link and focus composer this.appEvents.trigger('composer:insert-text', focused[0].href, {ensureSpace: true}); + this.appEvents.trigger('header:keyboard-trigger', {type: 'search'}); e.preventDefault(); $('#reply-control.open textarea').focus(); diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index bae43779c45..1ce75d44ed8 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -2376,7 +2376,7 @@ en: hamburger_menu: '= Open hamburger menu' user_profile_menu: 'p Open user menu' show_incoming_updated_topics: '. Show updated topics' - search: '/ or ctrl+/ Search' + search: '/ or ctrl+shift+s Search' help: '? Open keyboard help' dismiss_new_posts: 'x, r Dismiss New/Posts' dismiss_topics: 'x, t Dismiss Topics'