From ec8011e148e4d12ca7fa88bc893d98176814898b Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Fri, 4 Oct 2013 11:02:12 +0000 Subject: [PATCH] toggle editor mode --- mail/inc/class.mail_compose.inc.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/mail/inc/class.mail_compose.inc.php b/mail/inc/class.mail_compose.inc.php index c27c24099c..e3125185a6 100644 --- a/mail/inc/class.mail_compose.inc.php +++ b/mail/inc/class.mail_compose.inc.php @@ -380,15 +380,33 @@ $CAtFStart = array2string($_content); // user might have switched desired mimetype, so we should convert if ($content['is_html'] && $content['mimeType']=='plain') { + //error_log(__METHOD__.__LINE__.$content['mail_htmltext']); $suppressSigOnTop = true; + if (stripos($content['mail_htmltext'],'
')!==false)
+			{
+				$contentArr = html::splithtmlByPRE($content['mail_htmltext']);
+				foreach ($contentArr as $k =>&$elem)
+				{
+					if (stripos($elem,'
')!==false) $elem = str_replace(array("\r\n","\n","\r"),array("
","
","
"),$elem); + } + $content['mail_htmltext'] = implode('',$contentArr); + } + $content['mail_htmltext'] = $this->_getCleanHTML($content['mail_htmltext'], false, false); + $content['mail_htmltext'] = translation::convertHTMLToText($content['mail_htmltext'],$charset=false,$stripcrl=false,$stripalltags=true); + $content['body'] = $content['mail_htmltext']; + unset($content['mail_htmltext']); $content['is_html'] = false; $content['is_plain'] = true; } if ($content['is_plain'] && $content['mimeType']=='html') { + //error_log(__METHOD__.__LINE__.$content['mail_plaintext']); $suppressSigOnTop = true; + $content['mail_plaintext'] = str_replace(array("\r\n","\n","\r"),array("
","
","
"),$content['mail_plaintext']); + //$this->replaceEmailAdresses($content['mail_plaintext']); $content['body'] = $content['mail_plaintext']; + unset($content['mail_plaintext']); $content['is_html'] = true; $content['is_plain'] = false; }