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

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

index 7f148ec..316c350 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@
 
        * Fixed bug #17140: htmlArea RTE: In WebKit, RTE inserts incorrect link if text is double-clicked
        * Updated htmlArea RTE version to 1.8.14
+       * Fixed bug #17160: htmlArea RTE: Link editing problems in Internet Explorer
 
 2011-01-11  Christian Kuhn  <lolli@schwarzbu.ch>
 
index 336684a..3d62cf9 100644 (file)
@@ -1,3 +1,7 @@
+2011-01-21  Stanislas Rolland  <typo3@sjbr.ca>
+
+       * Fixed bug #17160: htmlArea RTE: Link editing problems in Internet Explorer
+
 2011-01-20  Stanislas Rolland  <typo3@sjbr.ca>
 
        * Fixed bug #17140: htmlArea RTE: In WebKit, RTE inserts incorrect link if text is double-clicked
index ea6d781..345d606 100644 (file)
@@ -162,6 +162,7 @@ TYPO3Link = HTMLArea.Plugin.extend({
                var selection, range, anchorClass, imageNode = null, addIconAfterLink;
                this.editor.focusEditor();
                var node = this.editor.getParentElement();
+                       // Looking at parent
                var el = HTMLArea.getElementObject(node, 'a');
                if (el != null && /^a$/i.test(el.nodeName)) {
                        node = el;
@@ -178,8 +179,8 @@ TYPO3Link = HTMLArea.Plugin.extend({
                                }
                        }
                }
-               if (node != null && /^a$/i.test(node.nodeName)) {
-                               // Update existing link
+               if (!HTMLArea.is_ie && 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);
@@ -193,13 +194,21 @@ 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 (HTMLArea.is_ie) {
+                                       // 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 (HTMLArea.is_gecko && !HTMLArea.is_safari && !HTMLArea.is_opera) {
                                this.editor._doc.execCommand('CreateLink', false, encodeURI(theLink));
                        } else {
@@ -209,7 +218,8 @@ 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;
                        }
@@ -281,7 +291,7 @@ 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) {