Does not remove padding from the last element in a column
This commit is contained in:
@@ -26,10 +26,6 @@ $block-text-line-height = $text-line-height
|
|||||||
&.mailpoet_highlight > .mailpoet_block_highlight
|
&.mailpoet_highlight > .mailpoet_block_highlight
|
||||||
border: 1px dashed $block-hover-highlight-color
|
border: 1px dashed $block-hover-highlight-color
|
||||||
|
|
||||||
|
|
||||||
.mailpoet_block:last-child
|
|
||||||
margin-bottom: 0
|
|
||||||
|
|
||||||
.mailpoet_content
|
.mailpoet_content
|
||||||
position: relative
|
position: relative
|
||||||
line-height: $block-text-line-height
|
line-height: $block-text-line-height
|
||||||
|
@@ -11,7 +11,6 @@ class Renderer {
|
|||||||
$this->getOneColumnTemplate($styles, $class) :
|
$this->getOneColumnTemplate($styles, $class) :
|
||||||
$this->getMultipleColumnsTemplate($styles, $width, $alignment, $class);
|
$this->getMultipleColumnsTemplate($styles, $width, $alignment, $class);
|
||||||
$result = array_map(function($content) use ($template) {
|
$result = array_map(function($content) use ($template) {
|
||||||
$content = Renderer::removePaddingFromLastElement($content);
|
|
||||||
return $template['content_start'] . $content . $template['content_end'];
|
return $template['content_start'] . $content . $template['content_end'];
|
||||||
}, $columns_data);
|
}, $columns_data);
|
||||||
$result = implode('', $result);
|
$result = implode('', $result);
|
||||||
@@ -79,10 +78,6 @@ class Renderer {
|
|||||||
return $template;
|
return $template;
|
||||||
}
|
}
|
||||||
|
|
||||||
function removePaddingFromLastElement($element) {
|
|
||||||
return preg_replace('/mailpoet_padded_bottom(?!.*mailpoet_padded_bottom)/ism', '', $element);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getBackgroundColor($styles) {
|
function getBackgroundColor($styles) {
|
||||||
if(!isset($styles['backgroundColor'])) return false;
|
if(!isset($styles['backgroundColor'])) return false;
|
||||||
$background_color = $styles['backgroundColor'];
|
$background_color = $styles['backgroundColor'];
|
||||||
|
@@ -113,26 +113,6 @@ class RendererTest extends \MailPoetTest {
|
|||||||
expect($rendered_column_content)->equals($column_content);
|
expect($rendered_column_content)->equals($column_content);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testItRemovesPaddingFromLastColumnElement() {
|
|
||||||
$column_content = array('
|
|
||||||
<tr><td class="mailpoet_padded_bottom"></td></tr>
|
|
||||||
<tr><td class="mailpoet_padded_bottom"></td></tr>
|
|
||||||
<tr><td class="mailpoet_padded_bottom"></td></tr>
|
|
||||||
<tr><td class="mailpoet_padded_bottom"></td></tr>'
|
|
||||||
);
|
|
||||||
$column_styles = array(
|
|
||||||
'block' => array(
|
|
||||||
'backgroundColor' => "#999999"
|
|
||||||
)
|
|
||||||
);
|
|
||||||
$rendered_column_content = $this->column_renderer->render(
|
|
||||||
$column_styles,
|
|
||||||
count($column_content),
|
|
||||||
$column_content
|
|
||||||
);
|
|
||||||
expect(substr_count($rendered_column_content, 'mailpoet_padded'))->equals(3);
|
|
||||||
}
|
|
||||||
|
|
||||||
function testItRendersHeader() {
|
function testItRendersHeader() {
|
||||||
$newsletter = $this->newsletter['body'];
|
$newsletter = $this->newsletter['body'];
|
||||||
$template = $newsletter['content']['blocks'][0]['blocks'][0]['blocks'][0];
|
$template = $newsletter['content']['blocks'][0]['blocks'][0]['blocks'][0];
|
||||||
@@ -144,7 +124,6 @@ class RendererTest extends \MailPoetTest {
|
|||||||
expect($DOM('td', 0)->attr('style'))->notEmpty();
|
expect($DOM('td', 0)->attr('style'))->notEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function testItRendersImage() {
|
function testItRendersImage() {
|
||||||
$newsletter = $this->newsletter['body'];
|
$newsletter = $this->newsletter['body'];
|
||||||
$template = $newsletter['content']['blocks'][0]['blocks'][0]['blocks'][1];
|
$template = $newsletter['content']['blocks'][0]['blocks'][0]['blocks'][1];
|
||||||
|
Reference in New Issue
Block a user