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

Change subject: Fix target detection for jquery.textSelection overrides
......................................................................


Fix target detection for jquery.textSelection overrides

CM intercepted textSelection() globally but assumed
nobody will ever need to call it for anything but wpTexbox1.
Thus, attempts to get edit summary returned article text.
Lots of things can probably be fixed in this area, but here's
the beginning.

Bug: T177175
Bug: T179287

Depends-On: I113394a473e8fe534f17815676ec7014203db7d6
Change-Id: I72d7d72b2a891a0ad242a565dddc076fa6dd1bd1
---
M resources/ext.CodeMirror.js
1 file changed, 5 insertions(+), 2 deletions(-)

Approvals:
  jenkins-bot: Verified
  Kaldari: Looks good to me, approved



diff --git a/resources/ext.CodeMirror.js b/resources/ext.CodeMirror.js
index 03a84f0..4ab2a72 100644
--- a/resources/ext.CodeMirror.js
+++ b/resources/ext.CodeMirror.js
@@ -1,6 +1,6 @@
 ( function ( mw, $ ) {
        var origTextSelection, useCodeMirror, codeMirror, api, 
originHooksTextarea,
-               wikiEditorToolbarEnabled, enableContentEditable = true;
+               wikiEditorToolbarEnabled, enableContentEditable = true, textBox;
 
        if ( mw.config.get( 'wgCodeEditorCurrentLanguage' ) ) { // If the 
CodeEditor is used then just exit;
                return;
@@ -54,7 +54,9 @@
        function cmTextSelection( command, options ) {
                var fn, retval;
 
-               if ( !codeMirror ) {
+               if ( !codeMirror ||
+                       ( this[ 0 ] !== textBox && this[ 0 ] !== 
codeMirror.getWrapperElement() )
+               ) {
                        return origTextSelection.call( this, command, options );
                }
 
@@ -325,6 +327,7 @@
                        } );
 
                        $codeMirror = $( codeMirror.getWrapperElement() );
+                       textBox = $textbox1[ 0 ];
 
                        $codeMirror.resizable( {
                                handles: 'se',

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I72d7d72b2a891a0ad242a565dddc076fa6dd1bd1
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/CodeMirror
Gerrit-Branch: master
Gerrit-Owner: MaxSem <[email protected]>
Gerrit-Reviewer: Kaldari <[email protected]>
Gerrit-Reviewer: MaxSem <[email protected]>
Gerrit-Reviewer: Pastakhov <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to