Esanders has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/377471 )

Change subject: Trigger proper undo/redo when inputType=historyUndo/Redo
......................................................................

Trigger proper undo/redo when inputType=historyUndo/Redo

Bug: T175634
Change-Id: Ic0bcec267a021ccdc9285ec9713eb82dd2fb0c42
---
M src/ce/ve.ce.Surface.js
1 file changed, 21 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/71/377471/1

diff --git a/src/ce/ve.ce.Surface.js b/src/ce/ve.ce.Surface.js
index 6a7fb06..693fcf5 100644
--- a/src/ce/ve.ce.Surface.js
+++ b/src/ce/ve.ce.Surface.js
@@ -280,6 +280,19 @@
 ];
 
 /**
+ * Values of InputEvent.inputType which map to a history action
+ *
+ * These are used when the user selects undo/redo from the context
+ * menu in Chrome.
+ *
+ * @type {Object}
+ */
+ve.ce.Surface.static.historyEvents = {
+       historyUndo: 'undo',
+       historyRedo: 'redo'
+};
+
+/**
  * Cursor holder template
  *
  * @static
@@ -2439,7 +2452,14 @@
  * @method
  * @param {jQuery.Event} e The input event
  */
-ve.ce.Surface.prototype.onDocumentInput = function () {
+ve.ce.Surface.prototype.onDocumentInput = function ( e ) {
+       var inputType = e.originalEvent.inputType;
+
+       if ( inputType && inputType in this.constructor.static.historyEvents ) {
+               this.getSurface().executeCommand( 
this.constructor.static.historyEvents[ inputType ] );
+               e.preventDefault();
+               return;
+       }
        this.incRenderLock();
        try {
                this.surfaceObserver.pollOnce();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic0bcec267a021ccdc9285ec9713eb82dd2fb0c42
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

Reply via email to