Fixed bug #14202: htmlArea RTE: Tables may get lost when using remove format feature
authorStanislas Rolland <typo3@sjbr.ca>
Sat, 8 May 2010 03:06:49 +0000 (03:06 +0000)
committerStanislas Rolland <typo3@sjbr.ca>
Sat, 8 May 2010 03:06:49 +0000 (03:06 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@7565 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/rtehtmlarea/ChangeLog
typo3/sysext/rtehtmlarea/htmlarea/plugins/RemoveFormat/remove-format.js

index 24ab8f2..bf8d48c 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-05-07  Stanislas Rolland  <typo3@sjbr.ca>
+
+       * Fixed bug #14202: htmlArea RTE: Tables may get lost when using remove format feature
+
 2010-05-07  Susanne Moog  <typo3@susanne-moog.de>
 
        * Fixed bug #14293: IRRE loading indicator makes label text jump (Thanks to Lars Houmark)
 2010-05-07  Susanne Moog  <typo3@susanne-moog.de>
 
        * Fixed bug #14293: IRRE loading indicator makes label text jump (Thanks to Lars Houmark)
index 59671d0..6802601 100644 (file)
@@ -1,3 +1,7 @@
+2010-05-07  Stanislas Rolland  <typo3@sjbr.ca>
+
+       * Fixed bug #14202: htmlArea RTE: Tables may get lost when using remove format feature
+
 2010-04-19  Stanislas Rolland  <typo3@sjbr.ca>
 
        * Fixed bug #14153: htmlAreaRTE: Some Page TSConfig may break default hotkey assignments
 2010-04-19  Stanislas Rolland  <typo3@sjbr.ca>
 
        * Fixed bug #14153: htmlAreaRTE: Some Page TSConfig may break default hotkey assignments
index 1a48ac1..d787f00 100644 (file)
@@ -41,7 +41,7 @@ HTMLArea.RemoveFormat = HTMLArea.Plugin.extend({
                 * Registering plugin "About" information
                 */
                var pluginInformation = {
                 * Registering plugin "About" information
                 */
                var pluginInformation = {
-                       version         : '2.0',
+                       version         : '2.1',
                        developer       : 'Stanislas Rolland',
                        developerUrl    : 'http://www.sjbr.ca/',
                        copyrightOwner  : 'Stanislas Rolland',
                        developer       : 'Stanislas Rolland',
                        developerUrl    : 'http://www.sjbr.ca/',
                        copyrightOwner  : 'Stanislas Rolland',
@@ -217,7 +217,7 @@ HTMLArea.RemoveFormat = HTMLArea.Plugin.extend({
                                        // Remove font, b, strong, i, em, u, strike, span and other inline tags
                                html = html.replace(/<\/?(abbr|acronym|b[^a-zA-Z]|big|cite|code|em[^a-zA-Z]|font|i[^a-zA-Z]|q|s[^a-zA-Z]|samp|small|span|strike|strong|sub|sup|tt|u[^a-zA-Z]|var)[^>]*>/gi, "");
                                        // Keep tags, strip attributes
                                        // Remove font, b, strong, i, em, u, strike, span and other inline tags
                                html = html.replace(/<\/?(abbr|acronym|b[^a-zA-Z]|big|cite|code|em[^a-zA-Z]|font|i[^a-zA-Z]|q|s[^a-zA-Z]|samp|small|span|strike|strong|sub|sup|tt|u[^a-zA-Z]|var)[^>]*>/gi, "");
                                        // Keep tags, strip attributes
-                               html = html.replace(/ style=\"[^>\"]*\"/gi, "").replace(/ (class|align|cellpadding|cellspacing|frame|bgcolor)=(([^>\s\"]+)|(\"[^>\"]*\"))/gi, "");
+                               html = html.replace(/[ \t\n\r]+(style|class|align|cellpadding|cellspacing|frame|bgcolor)=\"[^>\"]*\"/gi, "");
                        }
                        if (params['spaces']) {
                                        // Replace non-breaking spaces by normal spaces
                        }
                        if (params['spaces']) {
                                        // Replace non-breaking spaces by normal spaces
@@ -229,11 +229,11 @@ HTMLArea.RemoveFormat = HTMLArea.Plugin.extend({
                        }
                        if (params['msWordFormatting']) {
                                        // Make one line
                        }
                        if (params['msWordFormatting']) {
                                        // Make one line
-                               html = html.replace(/(\r\n|\n|\r)/g, " ");
+                               html = html.replace(/[ \r\n\t]+/g, " ");
                                        // Clean up tags
                                html = html.replace(/<(b|strong|i|em|p|li|ul) [^>]*>/gi, "<$1>");
                                        // Keep tags, strip attributes
                                        // Clean up tags
                                html = html.replace(/<(b|strong|i|em|p|li|ul) [^>]*>/gi, "<$1>");
                                        // Keep tags, strip attributes
-                               html = html.replace(/ style=\"[^>\"]*\"/gi, "").replace(/ (class|align)=(([^>\s\"]+)|(\"[^>\"]*\"))/gi, "");
+                               html = html.replace(/ (style|class|align)=\"[^>\"]*\"/gi, "");
                                        // kill unwanted tags: span, div, ?xml:, st1:, [a-z]:, meta, link
                                html = html.replace(/<\/?span[^>]*>/gi, "").
                                        replace(/<\/?div[^>]*>/gi, "").
                                        // kill unwanted tags: span, div, ?xml:, st1:, [a-z]:, meta, link
                                html = html.replace(/<\/?span[^>]*>/gi, "").
                                        replace(/<\/?div[^>]*>/gi, "").
@@ -247,8 +247,8 @@ HTMLArea.RemoveFormat = HTMLArea.Plugin.extend({
                                        replace(/<title[^>]*>.*<\/title[^>]*>/gi, "");
                                        // remove comments
                                html = html.replace(/<!--[^>]*>/gi, "");
                                        replace(/<title[^>]*>.*<\/title[^>]*>/gi, "");
                                        // remove comments
                                html = html.replace(/<!--[^>]*>/gi, "");
-                                       // Remove font elements resets
-                               html = html.replace(/<\/(b|big|i|s|small|strike|tt|u)><\1>/gi, "");
+                                       // Remove inline elements resets
+                               html = html.replace(/<\/(b[^a-zA-Z]|big|i[^a-zA-Z]|s[^a-zA-Z]|small|strike|tt|u[^a-zA-Z])><\1>/gi, "");
                                        // Remove double tags
                                var oldlen = html.length + 1;
                                while(oldlen > html.length) {
                                        // Remove double tags
                                var oldlen = html.length + 1;
                                while(oldlen > html.length) {