From a0a20378139ee3d9a56982f03f38c64e09265c82 Mon Sep 17 00:00:00 2001 From: sgay Date: Tue, 11 Oct 2011 10:02:32 -0200 Subject: [PATCH] fix #30534 - extra
tags in RTE --- components/editorControls/tinyMCE3/TinyMCE.cs | 34 +- umbraco/presentation/web.config | 457 ++++++++++-------- 2 files changed, 258 insertions(+), 233 deletions(-) diff --git a/components/editorControls/tinyMCE3/TinyMCE.cs b/components/editorControls/tinyMCE3/TinyMCE.cs index 2ad013ca21..9ed2ccf766 100644 --- a/components/editorControls/tinyMCE3/TinyMCE.cs +++ b/components/editorControls/tinyMCE3/TinyMCE.cs @@ -324,28 +324,26 @@ namespace umbraco.editorControls.tinyMCE3 { parsedString = replaceMacroTags(parsedString).Trim(); - // clean macros and add paragraph element for tidy - bool removeParagraphs = false; - if (parsedString.Length > 16 && parsedString.ToLower().Substring(0, 17) == "|||?umbraco_macro") - { - removeParagraphs = true; - parsedString = "

" + parsedString + "

"; - } - - // tidy html - + // tidy html - refactored, see #30534 if (UmbracoSettings.TidyEditorContent) { - string tidyTxt = library.Tidy(parsedString, false); + // always wrap in a
- using

was a bad idea + parsedString = "

" + parsedString + "
"; + + string tidyTxt = library.Tidy(parsedString, false); if (tidyTxt != "[error]") { - // compensate for breaking macro tags by tidy - parsedString = tidyTxt.Replace("/?>", "/>"); - if (removeParagraphs) - { - if (parsedString.Length - parsedString.Replace("<", "").Length == 2) - parsedString = parsedString.Replace("

", "").Replace("

", ""); - } + parsedString = tidyTxt; + + // remove pesky \r\n, and other empty chars + parsedString = parsedString.Trim(new char[] { '\r', '\n', '\t', ' ' }); + + // compensate for breaking macro tags by tidy (?) + parsedString = parsedString.Replace("/?>", "/>"); + + // remove the wrapping
- safer to check that it is still here + if (parsedString.StartsWith("
") && parsedString.EndsWith("
")) + parsedString = parsedString.Substring("
".Length, parsedString.Length - "
".Length); } else { diff --git a/umbraco/presentation/web.config b/umbraco/presentation/web.config index 014c5926a6..6bccc8deed 100644 --- a/umbraco/presentation/web.config +++ b/umbraco/presentation/web.config @@ -1,15 +1,16 @@ - + - -
- - - -
- -
-
-
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + \ No newline at end of file