Fixed bug #15328: htmlArea RTE: Strange behaviours inserting links in IE
authorStanislas Rolland <typo3@sjbr.ca>
Fri, 27 Aug 2010 15:49:03 +0000 (15:49 +0000)
committerStanislas Rolland <typo3@sjbr.ca>
Fri, 27 Aug 2010 15:49:03 +0000 (15:49 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@8706 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/rtehtmlarea/ChangeLog
typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js

index 1ba3c6f..8474a70 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,7 @@
        * Fixed bug #15569: htmlArea RTE: RTE not loading when ExtJS 3.2.1 is used
        * Fixed bug #15570: htmlArea RTE: Incorrect height when loaded in a hidden tab with ExtJS 3.2.1
        * Fixed bug #15415: htmlArea RTE: RTEs hidden on load not usable with multiple RTEs in a record
+       * Fixed bug #15328: htmlArea RTE: Strange behaviours inserting links in IE
 
 2010-08-26  Ingo Renner  <ingo@typo3.org>
 
index 059423c..a8d06ff 100644 (file)
@@ -3,6 +3,7 @@
        * Fixed bug #15569: htmlArea RTE: RTE not loading when ExtJS 3.2.1 is used
        * Fixed bug #15570: htmlArea RTE: Incorrect height when loaded in a hidden tab with ExtJS 3.2.1
        * Fixed bug #15415: htmlArea RTE: RTEs hidden on load not usable with multiple RTEs in a record
+       * Fixed bug #15328: htmlArea RTE: Strange behaviours inserting links in IE
 
 2010-08-26  Stanislas Rolland  <typo3@sjbr.ca>
 
index be10f17..f3f3d3e 100644 (file)
@@ -499,9 +499,9 @@ Ext.ux.form.HTMLAreaCombo = Ext.extend(Ext.form.ComboBox, {
                                // In IE, reclaim lost focus on the editor iframe and restore the bookmarked selection
                        if (Ext.isIE) {
                                editor.focus();
-                               if (!Ext.isEmpty(this.bookmark)) {
-                                       editor.selectRange(editor.moveToBookmark(this.bookmark));
-                                       this.bookmark = null;
+                               if (!Ext.isEmpty(this.savedRange)) {
+                                       editor.selectRange(this.savedRange);
+                                       this.savedRange = null;
                                }
                        }
                                // Invoke the plugin onChange handler
@@ -509,7 +509,7 @@ Ext.ux.form.HTMLAreaCombo = Ext.extend(Ext.form.ComboBox, {
                                // In IE, bookmark the updated selection as the editor will be loosing focus
                        if (Ext.isIE) { 
                                editor.focus();
-                               this.bookmark = editor.getBookmark(editor._createRange(editor._getSelection()));
+                               this.savedRange = editor._createRange(editor._getSelection());
                                this.triggered = true;
                        }
                        if (Ext.isOpera) {
@@ -544,27 +544,15 @@ Ext.ux.form.HTMLAreaCombo = Ext.extend(Ext.form.ComboBox, {
        saveSelection: function (event) {
                var editor = this.getEditor();
                if (editor.document.hasFocus()) {
-                       var selection = editor._getSelection();
-                       switch (selection.type.toLowerCase()) {
-                               case 'none':
-                               case 'text':
-                                       this.bookmark = editor.getBookmark(editor._createRange(selection));
-                                       this.controlRange = null;
-                                       break;
-                               case 'control':
-                                       this.controlRange = editor._createRange(selection);
-                                       this.bookmark = null;
-                                       break;
-                       }
+                       this.savedRange = editor._createRange(editor._getSelection());
                }
        },
        /*
         * Handler invoked in IE when the editor gets the focus back
         */
        restoreSelection: function (event) {
-               if (!Ext.isEmpty(this.bookmark) && this.triggered) {
-                       var editor = this.getEditor();
-                       editor.selectRange(this.bookmark ? editor.moveToBookmark(this.bookmark) : this.controlRange);
+               if (!Ext.isEmpty(this.savedRange) && this.triggered) {
+                       this.getEditor().selectRange(this.savedRange);
                        this.triggered = false;
                }
        },
@@ -619,8 +607,7 @@ Ext.ux.form.HTMLAreaCombo = Ext.extend(Ext.form.ComboBox, {
         * Cleanup
         */
        onBeforeDestroy: function () {
-               this.controlRange = null;
-               this.bookmark = null;
+               this.savedRange = null;
                this.getStore().removeAll();
                this.getStore().destroy();
        }
@@ -4629,18 +4616,7 @@ HTMLArea.Plugin = HTMLArea.Base.extend({
        saveSelection: function () {
                        // If IE, save the current selection
                if (Ext.isIE) {
-                       var selection = this.editor._getSelection();
-                       switch (selection.type.toLowerCase()) {
-                               case 'none':
-                               case 'text':
-                                       this.bookmark = this.editor.getBookmark(this.editor._createRange(selection));
-                                       this.controlRange = null;
-                                       break;
-                               case 'control':
-                                       this.controlRange = this.editor._createRange(selection);
-                                       this.bookmark = null;
-                                       break;
-                       }
+                       this.savedRange = this.editor._createRange(this.editor._getSelection());
                }
        },
        /*
@@ -4649,10 +4625,10 @@ HTMLArea.Plugin = HTMLArea.Base.extend({
         */
        restoreSelection: function () {
                        // If IE, restore the selection saved when the window was shown
-               if (Ext.isIE) {
+               if (Ext.isIE && this.savedRange) {
                                // Restoring the selection will not work if the inner html was replaced by the plugin
                        try {
-                               this.editor.selectRange(this.bookmark ? this.editor.moveToBookmark(this.bookmark) : this.controlRange);
+                               this.editor.selectRange(this.savedRange);
                        } catch (e) {}
                }
        },