Esanders has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/98517


Change subject: WIP Keyboard shortcuts dialog
......................................................................

WIP Keyboard shortcuts dialog

Bug: 52844
Change-Id: Ia488362f4b8c9b99b615c84a7341d97e28bdb295
---
M VisualEditor.i18n.php
M VisualEditor.php
M demos/ve/index.php
M modules/ve/init/ve.init.Target.js
M modules/ve/test/index.php
A modules/ve/ui/dialogs/ve.ui.CommandHelpDialog.js
A modules/ve/ui/styles/ve.ui.Dialog.css
M modules/ve/ui/tools/ve.ui.DialogTool.js
M modules/ve/ui/ve.ui.TriggerRegistry.js
9 files changed, 118 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor 
refs/changes/17/98517/1

diff --git a/VisualEditor.i18n.php b/VisualEditor.i18n.php
index af14f48..2442129 100644
--- a/VisualEditor.i18n.php
+++ b/VisualEditor.i18n.php
@@ -65,6 +65,7 @@
        'visualeditor-dialog-beta-welcome-action-continue' => 'Continue',
        'visualeditor-dialog-beta-welcome-content' => 'This is our new, easier 
way to edit. It\'s still in beta, which means you might find parts of the page 
you can\'t edit, or encounter issues that need to be fixed. We encourage you to 
review your changes, and we welcome reports about any issues you might 
encounter in using VisualEditor (click the "{{int:visualeditor-help-tool}}" 
button to submit feedback). You can keep using the wikitext editor by clicking 
the "$1" tab instead – unsaved changes will be lost.',
        'visualeditor-dialog-beta-welcome-title' => '{{GENDER:$1|Welcome}} to 
VisualEditor',
+       'visualeditor-dialog-command-help-title' => 'Keyboard shortcuts',
        'visualeditor-dialog-media-content-section' => 'Caption',
        'visualeditor-dialog-media-insert-button' => 'Insert media',
        'visualeditor-dialog-media-insert-title' => 'Insert media',
diff --git a/VisualEditor.php b/VisualEditor.php
index 36941bc..c603f3e 100644
--- a/VisualEditor.php
+++ b/VisualEditor.php
@@ -472,6 +472,8 @@
                        've/ui/actions/ve.ui.InspectorAction.js',
                        've/ui/actions/ve.ui.ListAction.js',
 
+                       've/ui/dialogs/ve.ui.CommandHelpDialog.js',
+
                        've/ui/widgets/ve.ui.SurfaceWidget.js',
                        've/ui/widgets/ve.ui.LinkTargetInputWidget.js',
                        've-mw/ui/widgets/ve.ui.MWLinkTargetInputWidget.js',
@@ -522,6 +524,7 @@
                        've/ce/styles/ve.ce.Surface.css',
                        // ui
                        've/ui/styles/ve.ui.Context.css',
+                       've/ui/styles/ve.ui.Dialog.css',
                        've/ui/styles/ve.ui.Inspector.css',
                        've/ui/styles/ve.ui.Surface.css',
                        've/ui/styles/ve.ui.Tool.css',
@@ -564,6 +567,7 @@
                        'visualeditor-dialog-beta-welcome-action-continue',
                        'visualeditor-dialog-beta-welcome-content',
                        'visualeditor-dialog-beta-welcome-title',
+                       'visualeditor-dialog-command-help-title',
                        'visualeditor-dialog-media-content-section',
                        'visualeditor-dialog-media-insert-button',
                        'visualeditor-dialog-media-insert-title',
diff --git a/demos/ve/index.php b/demos/ve/index.php
index 47e3d83..c7cb980 100644
--- a/demos/ve/index.php
+++ b/demos/ve/index.php
@@ -49,6 +49,7 @@
                <link rel=stylesheet 
href="../../modules/ve/ce/styles/ve.ce.Node.css">
                <link rel=stylesheet 
href="../../modules/ve/ce/styles/ve.ce.Surface.css">
                <link rel=stylesheet 
href="../../modules/ve/ui/styles/ve.ui.Context.css">
+               <link rel=stylesheet 
href="../../modules/ve/ui/styles/ve.ui.Dialog.css">
                <link rel=stylesheet 
href="../../modules/ve/ui/styles/ve.ui.Inspector.css">
                <link rel=stylesheet 
href="../../modules/ve/ui/styles/ve.ui.Surface.css">
                <link rel=stylesheet 
href="../../modules/ve/ui/styles/ve.ui.Tool.css">
@@ -235,6 +236,7 @@
                <script 
src="../../modules/ve/ui/actions/ve.ui.IndentationAction.js"></script>
                <script 
src="../../modules/ve/ui/actions/ve.ui.InspectorAction.js"></script>
                <script 
src="../../modules/ve/ui/actions/ve.ui.ListAction.js"></script>
+               <script 
src="../../modules/ve/ui/dialogs/ve.ui.CommandHelpDialog.js"></script>
                <script 
src="../../modules/ve/ui/widgets/ve.ui.SurfaceWidget.js"></script>
                <script 
src="../../modules/ve/ui/widgets/ve.ui.LinkTargetInputWidget.js"></script>
                <script 
src="../../modules/ve/ui/tools/ve.ui.AnnotationTool.js"></script>
diff --git a/modules/ve/init/ve.init.Target.js 
b/modules/ve/init/ve.init.Target.js
index abc7f9f..15c43a9 100644
--- a/modules/ve/init/ve.init.Target.js
+++ b/modules/ve/init/ve.init.Target.js
@@ -54,6 +54,7 @@
        'superscript',
        'indent',
        'outdent',
+       'commandHelp',
        'paragraph',
        'heading1',
        'heading2',
diff --git a/modules/ve/test/index.php b/modules/ve/test/index.php
index 5e69417..df64321 100644
--- a/modules/ve/test/index.php
+++ b/modules/ve/test/index.php
@@ -188,6 +188,7 @@
                <script 
src="../../ve/ui/actions/ve.ui.IndentationAction.js"></script>
                <script 
src="../../ve/ui/actions/ve.ui.InspectorAction.js"></script>
                <script src="../../ve/ui/actions/ve.ui.ListAction.js"></script>
+               <script 
src="../../ve/ui/dialogs/ve.ui.CommandHelpDialog.js"></script>
                <script 
src="../../ve/ui/widgets/ve.ui.SurfaceWidget.js"></script>
                <script 
src="../../ve/ui/widgets/ve.ui.LinkTargetInputWidget.js"></script>
                <script 
src="../../ve/ui/tools/ve.ui.AnnotationTool.js"></script>
diff --git a/modules/ve/ui/dialogs/ve.ui.CommandHelpDialog.js 
b/modules/ve/ui/dialogs/ve.ui.CommandHelpDialog.js
new file mode 100644
index 0000000..ff7f452
--- /dev/null
+++ b/modules/ve/ui/dialogs/ve.ui.CommandHelpDialog.js
@@ -0,0 +1,65 @@
+/*!
+ * VisualEditor UserInterface CommandHelpDialog class.
+ *
+ * @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
+ * @license The MIT License (MIT); see LICENSE.txt
+ */
+
+/**
+ * Dialog listing all command keyboard shortcuts.
+ *
+ * @class
+ * @extends ve.ui.Dialog
+ *
+ * @constructor
+ * @param {ve.ui.WindowSet} windowSet Window set this dialog is part of
+ * @param {Object} [config] Configuration options
+ */
+ve.ui.CommandHelpDialog = function VeUiCommandHelpDialog( windowSet, config ) {
+       // Parent constructor
+       ve.ui.Dialog.call( this, windowSet, config );
+};
+
+/* Inheritance */
+
+OO.inheritClass( ve.ui.CommandHelpDialog, ve.ui.Dialog );
+
+/* Static Properties */
+
+ve.ui.CommandHelpDialog.static.name = 'commandHelp';
+
+ve.ui.CommandHelpDialog.static.titleMessage = 
'visualeditor-dialog-command-help-title';
+
+ve.ui.CommandHelpDialog.static.icon = 'help';
+
+/* Methods */
+
+/**
+ * @inheritdoc
+ */
+ve.ui.CommandHelpDialog.prototype.initialize = function () {
+       // Parent method
+       ve.ui.Dialog.prototype.initialize.call( this );
+
+       var name,
+               $list = this.$( '<ul>' ).addClass( 
've-ui-commandHelpDialog-list' ),
+               triggers = this.surface.getTriggers();
+
+       for ( name in triggers ) {
+               $list.append(
+                       this.$( '<li>' ).text( name + ': ' + 
triggers[name].getMessage() )
+               );
+       }
+
+       this.$body.append( $list );
+};
+
+/**
+ * @inheritdoc
+ */
+ve.ui.CommandHelpDialog.prototype.setup = function ( data ) {
+};
+
+/* Registration */
+
+ve.ui.dialogFactory.register( ve.ui.CommandHelpDialog );
diff --git a/modules/ve/ui/styles/ve.ui.Dialog.css 
b/modules/ve/ui/styles/ve.ui.Dialog.css
new file mode 100644
index 0000000..7d4e0cb
--- /dev/null
+++ b/modules/ve/ui/styles/ve.ui.Dialog.css
@@ -0,0 +1,20 @@
+/*!
+ * VisualEditor UserInterface Dialog styles.
+ *
+ * @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
+ * @license The MIT License (MIT); see LICENSE.txt
+ */
+
+/* ve.ui.CommandHelpDialog */
+
+.ve-ui-commandHelpDialog-list {
+       -moz-column-count: 2;
+       -webkit-column-count: 2;
+       column-count: 2;
+       margin-top: 2em;
+}
+
+.ve-ui-commandHelpDialog-list li {
+       list-style-type: none;
+       line-height: 200%;
+}
diff --git a/modules/ve/ui/tools/ve.ui.DialogTool.js 
b/modules/ve/ui/tools/ve.ui.DialogTool.js
index 7a53cae..8691b0b 100644
--- a/modules/ve/ui/tools/ve.ui.DialogTool.js
+++ b/modules/ve/ui/tools/ve.ui.DialogTool.js
@@ -96,3 +96,24 @@
                );
        }
 };
+
+/**
+ * UserInterface command help dialog tool.
+ *
+ * @class
+ * @extends ve.ui.DialogTool
+ * @constructor
+ * @param {OO.ui.ToolGroup} toolGroup
+ * @param {Object} [config] Configuration options
+ */
+ve.ui.CommandHelpDialogTool = function VeUiCommandHelpDialogTool( toolGroup, 
config ) {
+       ve.ui.DialogTool.call( this, toolGroup, config );
+};
+OO.inheritClass( ve.ui.CommandHelpDialogTool, ve.ui.DialogTool );
+ve.ui.CommandHelpDialogTool.static.name = 'commandHelp';
+ve.ui.CommandHelpDialogTool.static.group = 'dialog';
+ve.ui.CommandHelpDialogTool.static.icon = 'help';
+ve.ui.CommandHelpDialogTool.static.titleMessage = 
'visualeditor-dialogbutton-command-help-tooltip';
+ve.ui.CommandHelpDialogTool.static.dialog = 'commandHelp';
+ve.ui.CommandHelpDialogTool.static.autoAdd = false;
+ve.ui.toolFactory.register( ve.ui.CommandHelpDialogTool );
diff --git a/modules/ve/ui/ve.ui.TriggerRegistry.js 
b/modules/ve/ui/ve.ui.TriggerRegistry.js
index 6cb1d5f..3a2f229 100644
--- a/modules/ve/ui/ve.ui.TriggerRegistry.js
+++ b/modules/ve/ui/ve.ui.TriggerRegistry.js
@@ -96,6 +96,9 @@
 ve.ui.triggerRegistry.register(
        'outdent', new ve.ui.Trigger( 'shift+tab' )
 );
+ve.ui.triggerRegistry.register(
+       'commandHelp', { 'mac': new ve.ui.Trigger( 'cmd+/' ), 'pc': new 
ve.ui.Trigger( 'ctrl+/' ) }
+);
 // Ctrl+0-7 below are not mapped to Cmd+0-7 on Mac because Chrome reserves 
those for switching tabs
 ve.ui.triggerRegistry.register(
        'paragraph', { 'mac': new ve.ui.Trigger( 'ctrl+0' ), 'pc': new 
ve.ui.Trigger ( 'ctrl+0' ) }

-- 
To view, visit https://gerrit.wikimedia.org/r/98517
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia488362f4b8c9b99b615c84a7341d97e28bdb295
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <esand...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to