Esanders has uploaded a new change for review. ( 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, 30 insertions(+), 5 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor refs/changes/87/377487/1 diff --git a/src/ce/ve.ce.Surface.js b/src/ce/ve.ce.Surface.js index b81f76c..289aad8 100644 --- a/src/ce/ve.ce.Surface.js +++ b/src/ce/ve.ce.Surface.js @@ -283,13 +283,34 @@ * 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. + * + * 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 +2474,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: newchange Gerrit-Change-Id: I173c779bd32079d3f5ffa490e9bebe0d882cb15f Gerrit-PatchSet: 1 Gerrit-Project: VisualEditor/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