diff --git a/app/assets/javascripts/discourse/components/d-editor.js.es6 b/app/assets/javascripts/discourse/components/d-editor.js.es6 index 3d357ec2255..819beb5fa53 100644 --- a/app/assets/javascripts/discourse/components/d-editor.js.es6 +++ b/app/assets/javascripts/discourse/components/d-editor.js.es6 @@ -254,6 +254,7 @@ export default Ember.Component.extend({ @on('willDestroyElement') _shutDown() { if (this.get('composerEvents')) { + this.appEvents.off('composer:insert-block'); this.appEvents.off('composer:insert-text'); this.appEvents.off('composer:replace-text'); } diff --git a/app/assets/javascripts/discourse/lib/keyboard-shortcuts.js.es6 b/app/assets/javascripts/discourse/lib/keyboard-shortcuts.js.es6 index c3a7ecd27ca..3537ec1d975 100644 --- a/app/assets/javascripts/discourse/lib/keyboard-shortcuts.js.es6 +++ b/app/assets/javascripts/discourse/lib/keyboard-shortcuts.js.es6 @@ -12,6 +12,7 @@ const bindings = { '.': {click: '.alert.alert-info.clickable', anonymous: true}, // show incoming/updated topics 'b': {handler: 'toggleBookmark'}, 'c': {handler: 'createTopic'}, + 'C': {handler: 'focusComposer'}, 'ctrl+f': {handler: 'showPageSearch', anonymous: true}, 'command+f': {handler: 'showPageSearch', anonymous: true}, 'ctrl+p': {handler: 'printTopic', anonymous: true}, @@ -174,6 +175,15 @@ export default { } }, + focusComposer() { + const composer = this.container.lookup('controller:composer'); + if (composer.get('model.viewOpen')) { + setTimeout(() => $('textarea.d-editor-input').focus(), 0); + } else { + composer.send('openIfDraft'); + } + }, + pinUnpinTopic() { this.container.lookup('controller:topic').togglePinnedState(); }, diff --git a/app/assets/javascripts/discourse/templates/modal/keyboard-shortcuts-help.hbs b/app/assets/javascripts/discourse/templates/modal/keyboard-shortcuts-help.hbs index 1ffb3e2c337..c426e91d038 100644 --- a/app/assets/javascripts/discourse/templates/modal/keyboard-shortcuts-help.hbs +++ b/app/assets/javascripts/discourse/templates/modal/keyboard-shortcuts-help.hbs @@ -25,7 +25,6 @@