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 @@

{{i18n 'keyboard_shortcuts_help.application.title'}}

+

{{i18n 'keyboard_shortcuts_help.composing.title'}}

+

{{i18n 'keyboard_shortcuts_help.actions.title'}}

@@ -43,10 +51,6 @@
  • {{{i18n 'keyboard_shortcuts_help.actions.pin_unpin_topic'}}}
  • {{{i18n 'keyboard_shortcuts_help.actions.share_topic'}}}
  • {{{i18n 'keyboard_shortcuts_help.actions.share_post'}}}
  • -
  • {{{i18n 'keyboard_shortcuts_help.actions.reply_as_new_topic'}}}
  • -
  • {{{i18n 'keyboard_shortcuts_help.actions.reply_topic'}}}
  • -
  • {{{i18n 'keyboard_shortcuts_help.actions.reply_post'}}}
  • -
  • {{{i18n 'keyboard_shortcuts_help.actions.quote_post'}}}
  • {{{i18n 'keyboard_shortcuts_help.actions.like'}}}
  • {{{i18n 'keyboard_shortcuts_help.actions.flag'}}}
  • {{{i18n 'keyboard_shortcuts_help.actions.bookmark'}}}
  • diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 893a5382dda..3a18722a439 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -2442,6 +2442,9 @@ en: dismiss_new_posts: 'x, r Dismiss New/Posts' dismiss_topics: 'x, t Dismiss Topics' log_out: 'shift+z shift+z Log Out' + composing: + title: 'Composing' + return: 'shift+C Return to composer' actions: title: 'Actions' bookmark_topic: 'f Toggle bookmark topic'