Index: typo3/sysext/rtehtmlarea/htmlarea/htmlarea-gecko.js
===================================================================
--- typo3/sysext/rtehtmlarea/htmlarea/htmlarea-gecko.js (révision 6401)
+++ typo3/sysext/rtehtmlarea/htmlarea/htmlarea-gecko.js (copie de travail)
@@ -445,6 +445,37 @@
this.insertNodeAtSelection(fragment);
};
+/*
+ * Clean Apple wrapping span and font tags under the specified node
+ *
+ * @param object node: the node in the subtree of which cleaning is performed
+ *
+ * @return void
+ */
+HTMLArea.prototype.cleanAppleStyleSpans = function(node) {
+ if (HTMLArea.is_safari) {
+ if (node.getElementsByClassName) {
+ var spans = node.getElementsByClassName("Apple-style-span");
+ for (var i = spans.length; --i >= 0;) {
+ this.removeMarkup(spans[i]);
+ }
+ } else {
+ var spans = node.getElementsByTagName("span");
+ for (var i = spans.length; --i >= 0;) {
+ if (HTMLArea._hasClass(spans[i], "Apple-style-span")) {
+ this.removeMarkup(spans[i]);
+ }
+ }
+ var fonts = node.getElementsByTagName("font");
+ for (i = fonts.length; --i >= 0;) {
+ if (HTMLArea._hasClass(fonts[i], "Apple-style-span")) {
+ this.removeMarkup(fonts[i]);
+ }
+ }
+ }
+ }
+};
+
/***************************************************
* EVENTS HANDLERS
***************************************************/
Index: typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js
===================================================================
--- typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js (révision 6403)
+++ typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js (copie de travail)
@@ -1881,6 +1881,23 @@
return oEl;
};
+/*
+ * This function removes the given markup element
+ *
+ * @param object element: the inline element to be removed, content being preserved
+ *
+ * @return void
+ */
+HTMLArea.prototype.removeMarkup = function(element) {
+ var bookmark = this.getBookmark(this._createRange(this._getSelection()));
+ var parent = element.parentNode;
+ while (element.firstChild) {
+ parent.insertBefore(element.firstChild, element);
+ }
+ parent.removeChild(element);
+ this.selectRange(this.moveToBookmark(bookmark));
+};
+
/***************************************************
* SELECTIONS AND RANGES
***************************************************/
@@ -2061,7 +2078,7 @@
return false;
break;
case "Paste" :
- if (HTMLArea.is_opera || (HTMLArea.is_gecko && navigator.productSub < 20080514)) {
+ if (HTMLArea.is_opera || (HTMLArea.is_gecko && navigator.productSub < 20080514) || HTMLArea.is_safari) {
if (editor._toolbarObjects.CleanWord) {
var cleanLaterFunctRef = editor.plugins.DefaultClean ? editor.plugins.DefaultClean.instance.cleanLaterFunctRef : (editor.plugins.TYPO3HtmlParser ? editor.plugins.TYPO3HtmlParser.instance.cleanLaterFunctRef : null);
if (cleanLaterFunctRef) {
Index: typo3/sysext/rtehtmlarea/htmlarea/plugins/DefaultClean/default-clean.js
===================================================================
--- typo3/sysext/rtehtmlarea/htmlarea/plugins/DefaultClean/default-clean.js (révision 6401)
+++ typo3/sysext/rtehtmlarea/htmlarea/plugins/DefaultClean/default-clean.js (copie de travail)
@@ -164,6 +164,9 @@
}
}
parseTree(this.editor._doc.body);
+ if (HTMLArea.is_safari) {
+ this.editor.cleanAppleStyleSpans(this.editor._doc.body);
+ }
}
});
Index: typo3/sysext/rtehtmlarea/htmlarea/plugins/TYPO3HtmlParser/typo3html-parser.js
===================================================================
--- typo3/sysext/rtehtmlarea/htmlarea/plugins/TYPO3HtmlParser/typo3html-parser.js (révision 6401)
+++ typo3/sysext/rtehtmlarea/htmlarea/plugins/TYPO3HtmlParser/typo3html-parser.js (copie de travail)
@@ -94,6 +94,9 @@
clean : function() {
var editor = this.editor;
+ if (HTMLArea.is_safari) {
+ editor.cleanAppleStyleSpans(editor._doc.body);
+ }
var bookmark = editor.getBookmark(editor._createRange(editor._getSelection()));
var content = {
editorNo : this.editorNumber,