Catrope has uploaded a new change for review.

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

Change subject: VE-MW fix commit for I4efbae614e
......................................................................

VE-MW fix commit for I4efbae614e

Local changes:
* Call bindHandlers()/unbindHandlers() in activate/deactivate
* Extend onDocumentKeyDown rather than overwriting it

Change-Id: I0739e71781c5140c54512ab421bdcb6d1df5fbbe
---
M modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
1 file changed, 10 insertions(+), 4 deletions(-)


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

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 b1e1e30..06d8f02 100644
--- a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
+++ b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
@@ -25,6 +25,10 @@
        // Parent constructor
        ve.init.mw.Target.call( this, mw.config.get( 'wgRelevantPageName' ), 
currentUri.query.oldid );
 
+       // Parent constructor bound key event handlers, but we don't want them 
bound until
+       // we activate; so unbind them again
+       this.unbindHandlers();
+
        // Properties
        this.toolbarSaveButton = null;
        this.saveDialog = null;
@@ -246,11 +250,10 @@
                this.activating = true;
                this.activatingDeferred = $.Deferred();
 
+               this.bindHandlers();
+
                this.originalEditondbclick = mw.user.options.get( 
'editondblclick' );
                mw.user.options.set( 'editondblclick', 0 );
-
-               this.onDocumentKeyDownHandler = this.onDocumentKeyDown.bind( 
this );
-               $( document ).on( 'keydown', this.onDocumentKeyDownHandler );
 
                // User interface changes
                this.transformPage();
@@ -333,7 +336,7 @@
        this.restorePage();
        this.showReadOnlyContent();
 
-       $( document ).off( 'keydown', this.onDocumentKeyDownHandler );
+       this.unbindHandlers();
 
        mw.user.options.set( 'editondblclick', this.originalEditondbclick );
        this.originalEditondbclick = undefined;
@@ -462,6 +465,9 @@
  * @param {jQuery.Event} e Keydown event
  */
 ve.init.mw.ViewPageTarget.prototype.onDocumentKeyDown = function ( e ) {
+       // Parent method
+       ve.init.mw.ViewPageTarget.super.prototype.onDocumentKeyDown.apply( 
this, arguments );
+
        if ( e.which === OO.ui.Keys.ESCAPE ) {
                this.deactivate( false, 'navigate-read' );
                e.preventDefault();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0739e71781c5140c54512ab421bdcb6d1df5fbbe
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Catrope <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to