From d8de718a5dadbc9886ad8c1661574295fbd12b92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Dziewo=C5=84ski?= Date: Mon, 12 May 2014 00:54:58 +0200 Subject: [PATCH] Move shortcut keys help from "Page options" dropdown to "Help" popup Obviously it doesn't belong there. I think I'm getting the hang of this. :D Change-Id: I5933e32bb8a803d004c2e33d55d7900d1b18a44e --- .../init/targets/ve.init.mw.ViewPageTarget.js | 2 +- modules/ve-mw/ui/tools/ve.ui.MWPopupTool.js | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js index c222bcd85e..424fe720cb 100644 --- a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js +++ b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js @@ -1122,7 +1122,7 @@ ve.init.mw.ViewPageTarget.prototype.attachToolbarButtons = function () { 'type': 'list', 'icon': 'menu', 'title': ve.msg( 'visualeditor-pagemenu-tooltip' ), - 'include': [ 'meta', 'settings', 'advancedSettings', 'categories', 'languages', 'editModeSource', 'commandHelp' ] + 'include': [ 'meta', 'settings', 'advancedSettings', 'categories', 'languages', 'editModeSource' ] } ] ); diff --git a/modules/ve-mw/ui/tools/ve.ui.MWPopupTool.js b/modules/ve-mw/ui/tools/ve.ui.MWPopupTool.js index f4da44b8ec..8e8cbba751 100644 --- a/modules/ve-mw/ui/tools/ve.ui.MWPopupTool.js +++ b/modules/ve-mw/ui/tools/ve.ui.MWPopupTool.js @@ -114,6 +114,12 @@ ve.ui.MWHelpPopupTool = function VeUiMWHelpPopupTool( toolGroup, config ) { 'target': '_blank', 'label': ve.msg( 'visualeditor-help-label' ) } ); + this.keyboardShortcutsButton = new OO.ui.ButtonWidget( { + '$': this.$, + 'frameless': true, + 'icon': 'help', + 'label': ve.msg( 'visualeditor-dialog-command-help-title' ) + } ); this.feedbackButton = new OO.ui.ButtonWidget( { '$': this.$, 'frameless': true, @@ -123,6 +129,7 @@ ve.ui.MWHelpPopupTool = function VeUiMWHelpPopupTool( toolGroup, config ) { // Events this.feedbackButton.connect( this, { 'click': 'onFeedbackClick' } ); + this.keyboardShortcutsButton.connect( this, { 'click': 'onKeyboardShortcutsClick' } ); // Initialization this.$items @@ -136,6 +143,7 @@ ve.ui.MWHelpPopupTool = function VeUiMWHelpPopupTool( toolGroup, config ) { this.$( '
' ) .addClass( 've-ui-mwHelpPopupTool-item' ) .append( this.helpButton.$element ) + .append( this.keyboardShortcutsButton.$element ) .append( this.feedbackButton.$element ) ); if ( ve.version.id !== false ) { @@ -197,6 +205,16 @@ ve.ui.MWHelpPopupTool.prototype.onFeedbackClick = function () { this.feedback.launch(); }; +/** + * Handle clicks on the keyboard shortcuts button. + * + * @method + */ +ve.ui.MWHelpPopupTool.prototype.onKeyboardShortcutsClick = function () { + this.hidePopup(); + ve.ui.commandRegistry.lookup( 'commandHelp' ).execute( this.toolbar.getSurface() ); +}; + /* Registration */ ve.ui.toolFactory.register( ve.ui.MWHelpPopupTool );