Esanders has uploaded a new change for review.

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


Change subject: Only listen for copy/paste on documentNode and pasteTarget
......................................................................

Only listen for copy/paste on documentNode and pasteTarget

As these are the only places we want to override the events.

Bug: 54375
Change-Id: I8a4e207f38508cdaf35cd869f267dd9f1059c83d
---
M modules/ve/ce/ve.ce.Surface.js
1 file changed, 7 insertions(+), 9 deletions(-)


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

diff --git a/modules/ve/ce/ve.ce.Surface.js b/modules/ve/ce/ve.ce.Surface.js
index 99c59ff..5eadc52 100644
--- a/modules/ve/ce/ve.ce.Surface.js
+++ b/modules/ve/ce/ve.ce.Surface.js
@@ -60,24 +60,22 @@
 
        $documentNode = this.documentView.getDocumentNode().$;
        $documentNode.on( {
+               'cut': ve.bind( this.onCut, this ),
+               'copy': ve.bind( this.onCopy, this ),
                'focus': ve.bind( this.documentOnFocus, this ),
                'blur': ve.bind( this.documentOnBlur, this )
        } );
+       this.$pasteTarget.on( {
+               'cut': ve.bind( this.onCut, this ),
+               'copy': ve.bind( this.onCopy, this )
+       } );
+       $documentNode.on( $.browser.msie ? 'beforepaste' : 'paste', ve.bind( 
this.onPaste, this ) );
        $documentNode.on( 'focus', 'a', function () {
                // Opera triggers 'blur' on document node before any link is
                // focused and we don't want that
                $documentNode.focus();
        } );
 
-       this.$document.on( {
-               'cut': ve.bind( this.onCut, this ),
-               'copy': ve.bind( this.onCopy, this )
-       } );
-       if ( $.browser.msie ) {
-               this.$document.on( 'beforepaste', ve.bind( this.onPaste, this ) 
);
-       } else {
-               this.$document.on( 'paste', ve.bind( this.onPaste, this ) );
-       }
        this.$.on( {
                'dragover': ve.bind( this.onDocumentDragOver, this ),
                'drop': ve.bind( this.onDocumentDrop, this )

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

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

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

Reply via email to