Fixed bug #10326: htmlArea RTE: Cleaning on paste broken in older versions of Mozilla...
authorStanislas Rolland <typo3@sjbr.ca>
Mon, 2 Feb 2009 03:23:11 +0000 (03:23 +0000)
committerStanislas Rolland <typo3@sjbr.ca>
Mon, 2 Feb 2009 03:23:11 +0000 (03:23 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@4916 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/rtehtmlarea/ChangeLog
typo3/sysext/rtehtmlarea/htmlarea/plugins/DefaultClean/default-clean.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/TYPO3HtmlParser/typo3html-parser.js

index c6a5463..d004ef9 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,7 @@
        * Fixed bug #10323: htmlArea RTE: hotkey CTRL+0 is not honoured
        * Fixed bug #10324: htmlArea RTE: Configured hotkeys are not honoured in Safari
        * Added feature #10325: htmlArea RTE: Make hotkey for enableWordClean feature configurable
+       * Fixed bug #10326: htmlArea RTE: Cleaning on paste broken in older versions of Mozilla/Firefox
 
 2009-02-01  Ingo Renner  <ingo@typo3.org>
 
index cd40bdf..9ea125c 100644 (file)
@@ -3,6 +3,7 @@
        * Fixed bug #10323: htmlArea RTE: hotkey CTRL+0 is not honoured
        * Fixed bug #10324: htmlArea RTE: Configured hotkeys are not honoured in Safari
        * Added feature #10325: htmlArea RTE: Make hotkey for enableWordClean feature configurable
+       * Fixed bug #10326: htmlArea RTE: Cleaning on paste broken in older versions of Mozilla/Firefox
 
 2009-01-26  Stanislas Rolland  <typo3@sjbr.ca>
 
index 190135b..e12747e 100644 (file)
@@ -1,7 +1,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 2008 Stanislas Rolland <typo3(arobas)sjbr.ca>
+*  (c) 2008-2009 Stanislas Rolland <typo3(arobas)sjbr.ca>
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -45,7 +45,7 @@ DefaultClean = HTMLArea.Plugin.extend({
                 * Registering plugin "About" information
                 */
                var pluginInformation = {
-                       version         : "1.1",
+                       version         : "1.2",
                        developer       : "Stanislas Rolland",
                        developerUrl    : "http://www.sjbr.ca/",
                        copyrightOwner  : "Stanislas Rolland",
@@ -81,16 +81,18 @@ DefaultClean = HTMLArea.Plugin.extend({
                var buttonId = this.translateHotKey(id);
                buttonId = buttonId ? buttonId : id;
                
-               this.clean(this.editor._doc.body);
+               this.clean();
                return false;
        },
        
        onGenerate : function () {
                var doc = this.editor._doc;
+                       // Function reference used on paste with older versions of Mozilla/Firefox in which onPaste is not fired
+               this.cleanLaterFunctRef = this.makeFunctionReference("clean");
                HTMLArea._addEvents((HTMLArea.is_ie ? doc.body : doc), ["paste","dragdrop","drop"], DefaultClean.wordCleanHandler, true);
        },
        
-       clean : function (html) {
+       clean : function () {
                function clearClass(node) {
                        var newc = node.className.replace(/(^|\s)mso.*?(\s|$)/ig,' ');
                        if(newc != node.className) {
@@ -152,7 +154,7 @@ DefaultClean = HTMLArea.Plugin.extend({
                                        break;
                        }
                }
-               parseTree(html);
+               parseTree(this.editor._doc.body);
        }
 });
 
@@ -161,7 +163,7 @@ DefaultClean = HTMLArea.Plugin.extend({
  */
 DefaultClean.cleanLater = function (editorNumber) {
        var editor = RTEarea[editorNumber].editor;
-       editor.plugins.DefaultClean.instance.clean(editor._doc.body);
+       editor.getPluginInstance("Default").clean();
 };
 
 /*
index 76af13f..5f52630 100644 (file)
@@ -1,7 +1,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 2005-2008 Stanislas Rolland <typo3(arobas)sjbr.ca>
+*  (c) 2005-2009 Stanislas Rolland <typo3(arobas)sjbr.ca>
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -81,22 +81,23 @@ TYPO3HtmlParser = HTMLArea.Plugin.extend({
                        // Could be a button or its hotkey
                var buttonId = this.translateHotKey(id);
                buttonId = buttonId ? buttonId : id;
-               var bookmark = this.editor.getBookmark(this.editor._createRange(this.editor._getSelection()));
-               this.clean(this.editor._doc.body, bookmark);
+               this.clean(this.editor._doc.body);
                return false;
        },
        
        onGenerate : function () {
                var doc = this.editor._doc;
-               var cleanFunctRef = this.makeFunctionReference("wordCleanHandler");
+                       // Function reference used on paste with older versions of Mozilla/Firefox in which onPaste is not fired
+               this.cleanLaterFunctRef = this.makeFunctionReference("clean");
                HTMLArea._addEvents((HTMLArea.is_ie ? doc.body : doc), ["paste","dragdrop","drop"], TYPO3HtmlParser.wordCleanHandler, true);
        },
        
-       clean : function(body, bookmark) {
+       clean : function() {
                var editor = this.editor;
+               var bookmark = editor.getBookmark(editor._createRange(editor._getSelection()));
                var content = {
                        editorNo : this.editorNumber,
-                       content body.innerHTML
+                       content  : editor._doc.body.innerHTML
                };
                this.postData(  this.parseHtmlModulePath,
                                content,
@@ -113,8 +114,7 @@ TYPO3HtmlParser = HTMLArea.Plugin.extend({
  */
 TYPO3HtmlParser.cleanLater = function (editorNumber) {
        var editor = RTEarea[editorNumber].editor;
-       var bookmark = editor.getBookmark(editor._createRange(editor._getSelection()));
-       editor.plugins.TYPO3HtmlParser.instance.clean(editor._doc.body, bookmark);
+       editor.getPluginInstance("TYPO3HtmlParser").clean();
 };
 
 /*