Refactor blocks client id generating from form data

[MAILPOET-2462]
This commit is contained in:
Rostislav Wolny
2019-12-11 11:19:05 +01:00
committed by Pavel Dohnal
parent d3bc831f69
commit a577680122
3 changed files with 11 additions and 13 deletions

View File

@@ -8,7 +8,7 @@ export default (data) => {
}
return data.map((item, index) => {
const mapped = {
clientId: item.id,
clientId: `${item.id}_${index}`,
isValid: true,
innerBlocks: [],
attributes: {
@@ -68,13 +68,11 @@ export default (data) => {
return {
...mapped,
name: 'mailpoet-form/divider',
clientId: `divider_${index}`,
};
case 'html':
return {
...mapped,
name: 'mailpoet-form/custom-html',
clientId: `custom_html_${index}`,
attributes: {
content: item.params && item.params.text ? item.params.text : '',
},