Project

General

Profile

Bug #16795 » rtehtmlarea_bugfix_4670_trunk.patch

Administrator Admin, 2009-10-29 23:21

View differences:

typo3/sysext/rtehtmlarea/htmlarea/plugins/CopyPaste/copy-paste.js (copie de travail)
if (buttonId == id) {
// If we are handling a button, not a hotkey
this.applyBrowserCommand(buttonId);
} else if (buttonId == "Cut") {
// If we are handling the cut hotkey
var removeEmpyLinkLaterFunctRef = this.makeFunctionReference("removeEmptyLinkLater");
window.setTimeout(removeEmpyLinkLaterFunctRef, 50);
}
break;
case "Paste":
......
this.mozillaClipboardAccessException();
}
}
if (buttonId == "Cut") {
this.removeEmptyLink();
}
},
/*
* This function removes any link left over by the cut operation
*/
removeEmptyLink : function() {
var selection = this.editor._getSelection();
var range = this.editor._createRange(selection);
var parent = this.editor.getParentElement(selection, range);
if (parent.firstChild && /^(a)$/i.test(parent.firstChild.nodeName)) {
parent = parent.firstChild;
}
if (/^(a)$/i.test(parent.nodeName)) {
parent.normalize();
if (!parent.innerHTML || (parent.childNodes.length == 1 && /^(br)$/i.test(parent.firstChild.nodeName))) {
HTMLArea.removeFromParent(parent);
}
}
// Safari may leave font and span elements behind!
if (HTMLArea.is_safari) {
var selection = this.editor._getSelection();
var range = this.editor._createRange(selection);
var parent = this.editor.getParentElement(selection, range);
while (/^(font|span)$/i.test(parent.nodeName) && HTMLArea._hasClass(parent, "Apple-style-span")) {
var container = parent.parentNode;
HTMLArea.removeFromParent(parent);
parent = container;
}
}
},
/*
* This function removes any link left over by the cut operation triggered by hotkey
*/
removeEmptyLinkLater : function() {
this.removeEmptyLink();
this.editor.updateToolbar();
},
/*
* This function gets called by the main editor when a copy/cut/paste operation is to be performed
*/
applyToTable : function (buttonId, target) {
(3-3/4)