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
This commit is contained in:
cpradio 2014-10-24 11:23:03 -04:00
parent da3275ec20
commit e013694734

View File

@ -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});
},