Add saving and loading of custom classes

[MAILPOET-2746]
This commit is contained in:
Rostislav Wolny
2020-03-12 14:59:37 +01:00
committed by Veljko V
parent bdd3be889c
commit 6c9d24a6ed
4 changed files with 53 additions and 1 deletions

View File

@@ -117,6 +117,7 @@ export const blocksToFormBodyFactory = (colorDefinitions, customFields = []) =>
type: 'text',
params: {
label: block.attributes.label,
class_name: block.attributes.className || null,
},
};
if (block.attributes.mandatory) {

View File

@@ -174,8 +174,12 @@ export const formBodyToBlocksFactory = (colorDefinitions, customFields = []) =>
attributes: {
labelWithinInput: false,
mandatory: false,
className: null,
},
};
if (item.params && has(item.params, 'class_name')) {
mapped.attributes.className = item.params.class_name;
}
if (item.params && has(item.params, 'required')) {
mapped.attributes.mandatory = !!item.params.required;
}
@@ -273,6 +277,7 @@ export const formBodyToBlocksFactory = (colorDefinitions, customFields = []) =>
...mapped,
name: 'mailpoet-form/html',
attributes: {
className: mapped.attributes.className,
content: item.params && item.params.text ? item.params.text : '',
nl2br: item.params && item.params.nl2br ? !!item.params.nl2br : false,
},