Store columns block custom class name
[MAILPOET-2609]
This commit is contained in:
committed by
Pavel Dohnal
parent
8e71f8d3cc
commit
b51ce7c1b2
@ -88,16 +88,17 @@ const mapBlocks = (blocks, customFields = [], parent = null) => {
|
||||
if (block.attributes.labelWithinInput) {
|
||||
mapped.params.label_within = '1';
|
||||
}
|
||||
|
||||
const childrenCount = parent ? parent.innerBlocks.length : 1;
|
||||
switch (block.name) {
|
||||
case 'core/column':
|
||||
return {
|
||||
position: (index + 1).toString(),
|
||||
type: 'column',
|
||||
params: {
|
||||
class_name: block.attributes.className || null,
|
||||
vertical_alignment: block.attributes.verticalAlignment || null,
|
||||
width: block.attributes.width
|
||||
? block.attributes.width : Math.round(100 / parent.innerBlocks.length),
|
||||
? block.attributes.width : Math.round(100 / childrenCount),
|
||||
},
|
||||
body: mapBlocks(block.innerBlocks, customFields, block),
|
||||
};
|
||||
@ -107,6 +108,7 @@ const mapBlocks = (blocks, customFields = [], parent = null) => {
|
||||
type: 'columns',
|
||||
body: mapBlocks(block.innerBlocks, customFields, block),
|
||||
params: {
|
||||
class_name: block.attributes.className || null,
|
||||
text_color: block.attributes.textColor || null,
|
||||
background_color: block.attributes.backgroundColor || null,
|
||||
custom_text_color: block.attributes.customTextColor || null,
|
||||
|
@ -84,6 +84,9 @@ const mapColumnBlocks = (data, customFields = []) => {
|
||||
if (has(data.params, 'custom_background_color')) {
|
||||
mapped.attributes.customBackgroundColor = data.params.custom_background_color;
|
||||
}
|
||||
if (has(data.params, 'class_name') && data.params.class_name) {
|
||||
mapped.attributes.className = data.params.class_name;
|
||||
}
|
||||
return mapped;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user