Fixed bug #17160: htmlArea RTE: Link editing problems in Internet Explorer
authorStanislas Rolland <typo3@sjbr.ca>
Sat, 22 Jan 2011 00:06:38 +0000 (00:06 +0000)
committerStanislas Rolland <typo3@sjbr.ca>
Sat, 22 Jan 2011 00:06:38 +0000 (00:06 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@10233 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/rtehtmlarea/ChangeLog
typo3/sysext/rtehtmlarea/htmlarea/plugins/TYPO3Link/typo3link.js

index 9c08666..494242a 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -61,6 +61,7 @@
        * Fixed bug #16975: htmlArea RTE: Use parentNode rather than parentElement
        * Follow-up to bug #17157: htmlArea RTE: Not enabled in various browser/system combinations
        * Fixed bug #17187: CSH tooltip does not render correctly for allowed Excludefields
+       * Fixed bug #17160: htmlArea RTE: Link editing problems in Internet Explorer
 
 2011-01-21  Susanne Moog  <typo3@susanne-moog.de>
 
index 305cbe5..8b53b50 100644 (file)
@@ -2,6 +2,7 @@
 
        * Fixed bug #16975: htmlArea RTE: Use parentNode rather than parentElement
        * Follow-up to bug #17157: htmlArea RTE: Not enabled in various browser/system combinations
+       * Fixed bug #17160: htmlArea RTE: Link editing problems in Internet Explorer
 
 2011-01-20  Stanislas Rolland  <typo3@sjbr.ca>
 
index 49e988c..bdc4e13 100644 (file)
@@ -196,6 +196,7 @@ HTMLArea.TYPO3Link = HTMLArea.Plugin.extend({
                this.editor.focus();
                this.restoreSelection();
                var node = this.editor.getParentElement();
+                       // Looking at parent
                var el = HTMLArea.getElementObject(node, 'a');
                if (el != null && /^a$/i.test(el.nodeName)) {
                        node = el;
@@ -212,8 +213,8 @@ HTMLArea.TYPO3Link = HTMLArea.Plugin.extend({
                                }
                        }
                }
-               if (node != null && /^a$/i.test(node.nodeName)) {
-                               // Update existing link
+               if (!Ext.isIE && node != null && /^a$/i.test(node.nodeName)) {
+                               // Update existing link in non-IE
                        this.editor.selectNode(node);
                        selection = this.editor._getSelection();
                        range = this.editor._createRange(selection);
@@ -227,13 +228,21 @@ HTMLArea.TYPO3Link = HTMLArea.Plugin.extend({
                        this.setLinkAttributes(node, range, cur_target, cur_class, cur_title, imageNode, addIconAfterLink, additionalValues);
                } else {
                                // Create new link
-                               // Clean existing anchors otherwise Mozilla may create nested anchors
+                               // Update links in IE
                        selection = this.editor._getSelection();
                        range = this.editor._createRange(selection);
-                               // Selection may be lost when cleaning links
-                       var bookmark = this.editor.getBookmark(range);
-                       this.cleanAllLinks(node, range);
-                       this.editor.selectRange(this.editor.moveToBookmark(bookmark));
+                       if (Ext.isIE) {
+                                       // Clean images, keep links
+                               if (HTMLArea.classesAnchorSetup) {
+                                       this.cleanAllLinks(node, range, true);
+                               }
+                       } else {
+                                       // Clean existing anchors otherwise Mozilla may create nested anchors
+                                       // Selection may be lost when cleaning links
+                               var bookmark = this.editor.getBookmark(range);
+                               this.cleanAllLinks(node, range);
+                               this.editor.selectRange(this.editor.moveToBookmark(bookmark));
+                       }
                        if (Ext.isGecko) {
                                this.editor.document.execCommand('CreateLink', false, encodeURI(theLink));
                        } else {
@@ -243,7 +252,8 @@ HTMLArea.TYPO3Link = HTMLArea.Plugin.extend({
                        selection = this.editor._getSelection();
                        range = this.editor._createRange(selection);
                        node = this.editor.getParentElement();
-                       el = HTMLArea.getElementObject(node, 'a');
+                               // Looking at parent
+                       var el = HTMLArea.getElementObject(node, 'a');
                        if (el != null && /^a$/i.test(el.nodeName)) {
                                node = el;
                        }
@@ -323,7 +333,7 @@ HTMLArea.TYPO3Link = HTMLArea.Plugin.extend({
                                } else {
                                        var nodeRange = this.editor._doc.body.createTextRange();
                                        nodeRange.moveToElementText(node);
-                                       nodeInRange = range.inRange(nodeRange) || (range.compareEndPoints("StartToStart", nodeRange) == 0) || (range.compareEndPoints("EndToEnd", nodeRange) == 0);
+                                       nodeInRange = nodeRange.inRange(range) || range.inRange(nodeRange) || (range.compareEndPoints("StartToStart", nodeRange) == 0) || (range.compareEndPoints("EndToEnd", nodeRange) == 0);
                                }
                        }
                        if (nodeInRange) {