Merge pull request #760 from mailpoet/rendering_fix
Fix ALC/regular posts being displayed without line breaks [MAILPOET-763]
This commit is contained in:
@ -34,7 +34,7 @@ $block-text-line-height = $text-line-height
|
||||
position: relative
|
||||
line-height: $block-text-line-height
|
||||
|
||||
p, h1, h2, h3, h4, h5, h6
|
||||
h1, h2, h3, h4, h5, h6
|
||||
line-height: $block-text-line-height
|
||||
padding: 0
|
||||
margin: 0
|
||||
@ -44,9 +44,15 @@ $block-text-line-height = $text-line-height
|
||||
h1, h2, h3, h4, h5, h6
|
||||
margin-bottom: 0.3em
|
||||
|
||||
p
|
||||
p:not(.mailpoet_wp_post)
|
||||
margin-top: 0
|
||||
margin-bottom: 0
|
||||
padding: 0
|
||||
margin: 0
|
||||
|
||||
p
|
||||
line-height: $block-text-line-height
|
||||
font-style: normal
|
||||
font-weight: normal
|
||||
|
||||
ul
|
||||
|
@ -6,6 +6,7 @@ if(!defined('ABSPATH')) exit;
|
||||
class PostContentManager {
|
||||
|
||||
const MAX_EXCERPT_LENGTH = 60;
|
||||
const WP_POST_CLASS = 'mailpoet_wp_post';
|
||||
|
||||
function getContent($post, $displayType) {
|
||||
if($displayType === 'titleOnly') {
|
||||
@ -42,7 +43,7 @@ class PostContentManager {
|
||||
'<h2>', '<h3>', '<a>', '<ul>', '<ol>', '<li>', '<br>'
|
||||
);
|
||||
$content = strip_tags($content, implode('', $tags_not_being_stripped));
|
||||
$content = wpautop($content);
|
||||
$content = str_replace('<p', '<p class="' . self::WP_POST_CLASS .'"', wpautop($content));
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ class StructureTransformer {
|
||||
} else {
|
||||
return array(
|
||||
'type' => 'text',
|
||||
'text' => $item->toString(),
|
||||
'text' => $item->toString()
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace MailPoet\Newsletter\Renderer\Blocks;
|
||||
|
||||
use MailPoet\Newsletter\Editor\PostContentManager;
|
||||
use MailPoet\Newsletter\Renderer\StylesHelper;
|
||||
|
||||
class Text {
|
||||
@ -111,9 +112,16 @@ class Text {
|
||||
'<br /><br />' :
|
||||
'';
|
||||
// if this element is followed by a list, add single line break
|
||||
$line_breaks = ($next_element && preg_match('/<li>/i', $next_element->text())) ?
|
||||
$line_breaks = ($next_element && preg_match('/<li/i', $next_element->getOuterText())) ?
|
||||
'<br />' :
|
||||
$line_breaks;
|
||||
if($paragraph->hasClass(PostContentManager::WP_POST_CLASS)) {
|
||||
$paragraph->removeClass(PostContentManager::WP_POST_CLASS);
|
||||
// if this element is followed by a paragraph, add double line breaks
|
||||
$line_breaks = ($next_element && preg_match('/<p/i', $next_element->getOuterText())) ?
|
||||
'<br /><br />' :
|
||||
$line_breaks;
|
||||
}
|
||||
$paragraph->html('
|
||||
<tr>
|
||||
<td class="mailpoet_paragraph" style="word-break:break-word;word-wrap:break-word;' . $style . '">
|
||||
|
Reference in New Issue
Block a user