Index: typo3/sysext/rtehtmlarea/htmlarea/plugins/TYPO3Link/typo3link.js =================================================================== --- typo3/sysext/rtehtmlarea/htmlarea/plugins/TYPO3Link/typo3link.js (révision 10181) +++ typo3/sysext/rtehtmlarea/htmlarea/plugins/TYPO3Link/typo3link.js (copie de travail) @@ -196,6 +196,7 @@ 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 @@ } } } - 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 @@ 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 @@ 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 @@ } 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) {