TheDJ has uploaded a new change for review.

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

Change subject: textSelection: Remove references to iframe
......................................................................

textSelection: Remove references to iframe

Another attempt to solve the references to WikiEditor's 'iframe' code.
Renamed to a more suited name. The implementation still depends on
WikiEditor. Long term, we should probably move part of the WikiEditor
API into core.

Bug: 29328
Change-Id: Ibe011b2b8d045b4dace3106b8ae718a11387501e
---
M resources/src/jquery/jquery.textSelection.js
1 file changed, 6 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/90/139690/1

diff --git a/resources/src/jquery/jquery.textSelection.js 
b/resources/src/jquery/jquery.textSelection.js
index 042db91..dd190d6 100644
--- a/resources/src/jquery/jquery.textSelection.js
+++ b/resources/src/jquery/jquery.textSelection.js
@@ -25,7 +25,7 @@
        $.fn.textSelection = function ( command, options ) {
                var fn,
                        context,
-                       hasIframe,
+                       hasWikiEditorSurface, // The alt edit surface needs to 
implement the WikiEditor API
                        needSave,
                        retval;
 
@@ -531,18 +531,11 @@
                                        // Position to start selection at
                                        start: undefined,
                                        // Position to end selection at. 
Defaults to start
-                                       end: undefined,
-                                       // Element to start selection in 
(iframe only)
-                                       startContainer: undefined,
-                                       // Element to end selection in (iframe 
only). Defaults to startContainer
-                                       endContainer: undefined
+                                       end: undefined
                                }, options );
 
                                if ( options.end === undefined ) {
                                        options.end = options.start;
-                               }
-                               if ( options.endContainer === undefined ) {
-                                       options.endContainer = 
options.startContainer;
                                }
                                // FIXME: We may not need character 
position-based functions if we insert markers in the right places
                                break;
@@ -554,16 +547,16 @@
                }
 
                context = $( this ).data( 'wikiEditor-context' );
-               hasIframe = context !== undefined && context && context.$iframe 
!== undefined;
+               hasWikiEditorSurface = context !== undefined && context;
 
                // IE selection restore voodoo
                needSave = false;
-               if ( hasIframe && context.savedSelection !== null ) {
+               if ( hasWikiEditorSurface && context.savedSelection !== null ) {
                        context.fn.restoreSelection();
                        needSave = true;
                }
-               retval = ( hasIframe ? context.fn : fn )[command].call( this, 
options );
-               if ( hasIframe && needSave ) {
+               retval = ( hasAltEditSurface && context.fn[command] !== 
undefined ? context.fn : fn )[command].call( this, options );
+               if ( hasWikiEditorSurface && needSave ) {
                        context.fn.saveSelection();
                }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibe011b2b8d045b4dace3106b8ae718a11387501e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: TheDJ <hartman.w...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to