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

Change subject: Save/restore selection in all browsers
......................................................................


Save/restore selection in all browsers

Previously this wasn't required due to an iFrame mode.

Change-Id: Ib89af27d5ab6b9b1b05046b32b05ce368ff47a5f
---
M extension.json
M modules/jquery.wikiEditor.js
2 files changed, 10 insertions(+), 13 deletions(-)

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



diff --git a/extension.json b/extension.json
index 2c7747b..865feb0 100644
--- a/extension.json
+++ b/extension.json
@@ -272,7 +272,6 @@
                        ],
                        "dependencies": [
                                "jquery.async",
-                               "jquery.client",
                                "jquery.cookie",
                                "jquery.suggestions",
                                "jquery.tabIndex",
diff --git a/modules/jquery.wikiEditor.js b/modules/jquery.wikiEditor.js
index dd50e05..5b098d8 100644
--- a/modules/jquery.wikiEditor.js
+++ b/modules/jquery.wikiEditor.js
@@ -191,11 +191,8 @@
         * @return {jQuery}
         */
        $.fn.wikiEditor = function () {
-               var context, profile, hasFocus, cursorPos,
+               var context, hasFocus, cursorPos,
                        args, modules, module, e, call;
-
-               // Save browser profile for detailed tests.
-               profile = $.client.profile();
 
                /* Initialization */
 
@@ -404,22 +401,23 @@
                                },
 
                                /**
-                                * Save text selection for old IE (<=10)
+                                * Save text selection
                                 */
                                saveSelection: function () {
-                                       if ( profile.name === 'msie' && 
document.selection && document.selection.createRange ) {
-                                               context.$textarea.focus();
-                                               context.savedSelection = 
document.selection.createRange();
-                                       }
+                                       context.$textarea.focus();
+                                       context.savedSelection = {
+                                               selectionStart: 
context.$textarea[ 0 ].selectionStart,
+                                               selectionEnd: 
context.$textarea[ 0 ].selectionEnd
+                                       };
                                },
 
                                /**
-                                * Restore text selection for old IE (<=10)
+                                * Restore text selection
                                 */
                                restoreSelection: function () {
-                                       if ( profile.name === 'msie' && 
context.savedSelection !== null ) {
+                                       if ( context.savedSelection ) {
                                                context.$textarea.focus();
-                                               context.savedSelection.select();
+                                               context.$textarea[ 0 
].setSelectionRange( context.savedSelection.selectionStart, 
context.savedSelection.selectionEnd );
                                                context.savedSelection = null;
                                        }
                                }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib89af27d5ab6b9b1b05046b32b05ce368ff47a5f
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/WikiEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <esand...@wikimedia.org>
Gerrit-Reviewer: Catrope <r...@wikimedia.org>
Gerrit-Reviewer: TheDJ <hartman.w...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to