From e013694734e5afe136e44937010106fd23d44910 Mon Sep 17 00:00:00 2001 From: cpradio Date: Fri, 24 Oct 2014 11:23:03 -0400 Subject: [PATCH] FIX: Make shortcut 'c' global for creating a topic https://meta.discourse.org/t/keyboard-shortcut-c-create-a-new-topic-does-not-work-globally/18975 --- app/assets/javascripts/discourse/lib/keyboard_shortcuts.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/discourse/lib/keyboard_shortcuts.js b/app/assets/javascripts/discourse/lib/keyboard_shortcuts.js index 8a8836bd54f..2bae4f0feb1 100644 --- a/app/assets/javascripts/discourse/lib/keyboard_shortcuts.js +++ b/app/assets/javascripts/discourse/lib/keyboard_shortcuts.js @@ -27,8 +27,6 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({ }, CLICK_BINDINGS: { - 'c': '#create-topic', // create new topic - // star topic 'f': '#topic-footer-buttons button.star, .topic-list tr.topic-list-item.selected a.star', @@ -47,6 +45,7 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({ }, FUNCTION_BINDINGS: { + 'c': 'createTopic', // create new topic 'home': 'goToFirstPost', '#': 'toggleProgress', 'end': 'goToLastPost', @@ -131,6 +130,10 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({ return showSearch ? this.showSearch(true) : true; }, + createTopic: function() { + Discourse.__container__.lookup('controller:composer').send('open', {action: Discourse.Composer.CREATE_TOPIC, draftKey: Discourse.Composer.DRAFT}); + }, + toggleProgress: function() { Discourse.__container__.lookup('controller:topic-progress').send('toggleExpansion', {highlight: true}); },