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
|
position: relative
|
||||||
line-height: $block-text-line-height
|
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
|
line-height: $block-text-line-height
|
||||||
padding: 0
|
padding: 0
|
||||||
margin: 0
|
margin: 0
|
||||||
@ -44,9 +44,15 @@ $block-text-line-height = $text-line-height
|
|||||||
h1, h2, h3, h4, h5, h6
|
h1, h2, h3, h4, h5, h6
|
||||||
margin-bottom: 0.3em
|
margin-bottom: 0.3em
|
||||||
|
|
||||||
p
|
p:not(.mailpoet_wp_post)
|
||||||
margin-top: 0
|
margin-top: 0
|
||||||
margin-bottom: 0
|
margin-bottom: 0
|
||||||
|
padding: 0
|
||||||
|
margin: 0
|
||||||
|
|
||||||
|
p
|
||||||
|
line-height: $block-text-line-height
|
||||||
|
font-style: normal
|
||||||
font-weight: normal
|
font-weight: normal
|
||||||
|
|
||||||
ul
|
ul
|
||||||
|
@ -6,6 +6,7 @@ if(!defined('ABSPATH')) exit;
|
|||||||
class PostContentManager {
|
class PostContentManager {
|
||||||
|
|
||||||
const MAX_EXCERPT_LENGTH = 60;
|
const MAX_EXCERPT_LENGTH = 60;
|
||||||
|
const WP_POST_CLASS = 'mailpoet_wp_post';
|
||||||
|
|
||||||
function getContent($post, $displayType) {
|
function getContent($post, $displayType) {
|
||||||
if($displayType === 'titleOnly') {
|
if($displayType === 'titleOnly') {
|
||||||
@ -42,7 +43,7 @@ class PostContentManager {
|
|||||||
'<h2>', '<h3>', '<a>', '<ul>', '<ol>', '<li>', '<br>'
|
'<h2>', '<h3>', '<a>', '<ul>', '<ol>', '<li>', '<br>'
|
||||||
);
|
);
|
||||||
$content = strip_tags($content, implode('', $tags_not_being_stripped));
|
$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;
|
return $content;
|
||||||
}
|
}
|
||||||
@ -91,4 +92,4 @@ class PostContentManager {
|
|||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -72,7 +72,7 @@ class StructureTransformer {
|
|||||||
} else {
|
} else {
|
||||||
return array(
|
return array(
|
||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
'text' => $item->toString(),
|
'text' => $item->toString()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace MailPoet\Newsletter\Renderer\Blocks;
|
namespace MailPoet\Newsletter\Renderer\Blocks;
|
||||||
|
|
||||||
|
use MailPoet\Newsletter\Editor\PostContentManager;
|
||||||
use MailPoet\Newsletter\Renderer\StylesHelper;
|
use MailPoet\Newsletter\Renderer\StylesHelper;
|
||||||
|
|
||||||
class Text {
|
class Text {
|
||||||
@ -111,9 +112,16 @@ class Text {
|
|||||||
'<br /><br />' :
|
'<br /><br />' :
|
||||||
'';
|
'';
|
||||||
// if this element is followed by a list, add single line break
|
// 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 />' :
|
'<br />' :
|
||||||
$line_breaks;
|
$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('
|
$paragraph->html('
|
||||||
<tr>
|
<tr>
|
||||||
<td class="mailpoet_paragraph" style="word-break:break-word;word-wrap:break-word;' . $style . '">
|
<td class="mailpoet_paragraph" style="word-break:break-word;word-wrap:break-word;' . $style . '">
|
||||||
|
Reference in New Issue
Block a user