Project

General

Profile

Bug #24678 » rtehtmlarea_bugfix_17160_trunk_v2.patch

Administrator Admin, 2011-01-22 00:23

View differences:

typo3/sysext/rtehtmlarea/htmlarea/plugins/TYPO3Link/typo3link.js (copie de travail)
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;
......
}
}
}
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);
......
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 {
......
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;
}
......
} 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) {
(1-1/3)