jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/377487 )

Change subject: Capture format* inputTypes
......................................................................


Capture format* inputTypes

In the real world, this means that iOS selection tools
will trigger our internal formatting commands instead
of modifying the CE directly, and hoping we observe
the change correctly.

Change-Id: I173c779bd32079d3f5ffa490e9bebe0d882cb15f
---
M src/ce/ve.ce.Surface.js
1 file changed, 32 insertions(+), 5 deletions(-)

Approvals:
  DLynch: Looks good to me, approved
  jenkins-bot: Verified
  Jforrester: Looks good to me, but someone else must approve



diff --git a/src/ce/ve.ce.Surface.js b/src/ce/ve.ce.Surface.js
index b81f76c..85c4eb9 100644
--- a/src/ce/ve.ce.Surface.js
+++ b/src/ce/ve.ce.Surface.js
@@ -283,13 +283,36 @@
  * Values of InputEvent.inputType which map to a command
  *
  * Currently these are triggered when the user selects
- * undo/redo from the context menu in Chrome.
+ * undo/redo from the context menu in Chrome, or uses the
+ * selection formatting tools on iOS.
+ *
+ * See https://w3c.github.io/input-events/
+ *
+ * Values of null will perform no action and preventDefault.
  *
  * @type {Object}
  */
 ve.ce.Surface.static.inputTypeCommands = {
        historyUndo: 'undo',
-       historyRedo: 'redo'
+       historyRedo: 'redo',
+       formatBold: 'bold',
+       formatItalic: 'italic',
+       formatUnderline: 'underline',
+       formatStrikeThrough: 'strikethrough',
+       formatSuperscript: 'superscript',
+       formatSubscript: 'subscript',
+       formatJustifyFull: null,
+       formatJustifyCenter: null,
+       formatJustifyRight: null,
+       formatJustifyLeft: null,
+       formatIndent: 'indent',
+       formatOutdent: 'outdent',
+       formatRemove: 'clear',
+       formatSetBlockTextDirection: null,
+       formatSetInlineTextDirection: null,
+       formatBackColor: null,
+       formatFontColor: null,
+       formatFontName: null
 };
 
 /**
@@ -2453,10 +2476,14 @@
  * @param {jQuery.Event} e The input event
  */
 ve.ce.Surface.prototype.onDocumentInput = function ( e ) {
-       var inputType = e.originalEvent.inputType;
+       var inputType = e.originalEvent.inputType,
+               inputTypeCommands = this.constructor.static.inputTypeCommands;
 
-       if ( inputType && inputType in 
this.constructor.static.inputTypeCommands ) {
-               this.getSurface().executeCommand( 
this.constructor.static.inputTypeCommands[ inputType ] );
+       if ( inputType && inputTypeCommands.hasOwnProperty( inputType ) ) {
+               // Value can be null, in which case we still want to 
preventDefault.
+               if ( inputTypeCommands[ inputType ] ) {
+                       this.getSurface().executeCommand( 
this.constructor.static.inputTypeCommands[ inputType ] );
+               }
                e.preventDefault();
                return;
        }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I173c779bd32079d3f5ffa490e9bebe0d882cb15f
Gerrit-PatchSet: 2
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <esand...@wikimedia.org>
Gerrit-Reviewer: DLynch <dly...@wikimedia.org>
Gerrit-Reviewer: Divec <da...@troi.org>
Gerrit-Reviewer: Esanders <esand...@wikimedia.org>
Gerrit-Reviewer: Jforrester <jforres...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to