Workaround TinyMCE issue with <p>&nbsp;</p> sequence (#1490463)

pull/289/head
Aleksander Machniak 11 years ago
parent 4b72a1f498
commit d5f6d655da

@ -1145,8 +1145,24 @@ function rcmail_create_draft_body($body, $bodyIsHtml)
if ($bodyIsHtml) {
$body = rcmail_wash_html($body, array('safe' => 1), $cid_map);
// remove comments (produced by washtml)
$body = preg_replace('/<!--[^>]+-->/', '', $body);
// cleanup
$body = preg_replace(array(
// remove comments (produced by washtml)
'/<!--[^>]+-->/',
// remove <body> tags
'/<body([^>]*)>/i',
'/<\/body>/i',
// convert TinyMCE's empty-line sequence (#1490463)
'/<p>\xC2\xA0<\/p>/',
),
array(
'',
'',
'',
'<p><br /></p>',
),
$body
);
// replace cid with href in inline images links
if (!empty($cid_map)) {

@ -297,16 +297,22 @@ if (!$savedraft) {
$message_body = preg_replace(
array(
// remove empty signature div
'/<div id="_rc_sig">(&nbsp;)?<\/div>[\s\r\n]*$/',
// remove signature's div ID
'/\s*id="_rc_sig"/',
// add inline css for blockquotes and container
'/<blockquote>/',
'/<div class="pre">/'
'/<div class="pre">/',
// convert TinyMCE's new-line sequences (#1490463)
'/<p>&nbsp;<\/p>/',
),
array(
'',
'',
'<blockquote type="cite" style="'.$b_style.'">',
'<div class="pre" style="'.$pre_style.'">'
'<div class="pre" style="'.$pre_style.'">',
'<p><br /></p>',
),
$message_body);
}

Loading…
Cancel
Save