Add blocks to default state
[MAILPOET-2451]
This commit is contained in:
committed by
Jack Kitterhing
parent
c9d73f6970
commit
a848731fec
@@ -8,12 +8,18 @@ import createReducer from './reducer.jsx';
|
|||||||
import selectors from './selectors.jsx';
|
import selectors from './selectors.jsx';
|
||||||
import controls from './controls.jsx';
|
import controls from './controls.jsx';
|
||||||
import validateForm from './form_validator.jsx';
|
import validateForm from './form_validator.jsx';
|
||||||
|
import formBodyToBlocks from './form_body_to_blocks.jsx';
|
||||||
|
|
||||||
|
export default () => {
|
||||||
|
const formData = { ...window.mailpoet_form_data };
|
||||||
|
const formBlocks = formBodyToBlocks(formData.body);
|
||||||
|
delete formData.body;
|
||||||
const defaultState = {
|
const defaultState = {
|
||||||
|
formBlocks,
|
||||||
|
formData,
|
||||||
sidebarOpened: true,
|
sidebarOpened: true,
|
||||||
formData: window.mailpoet_form_data,
|
|
||||||
formExports: window.mailpoet_form_exports,
|
formExports: window.mailpoet_form_exports,
|
||||||
formErrors: validateForm(window.mailpoet_form_data),
|
formErrors: validateForm(formData, formBlocks),
|
||||||
segments: window.mailpoet_form_segments,
|
segments: window.mailpoet_form_segments,
|
||||||
pages: window.mailpoet_form_pages,
|
pages: window.mailpoet_form_pages,
|
||||||
isFormSaving: false,
|
isFormSaving: false,
|
||||||
@@ -32,4 +38,4 @@ const config = {
|
|||||||
resolvers: {},
|
resolvers: {},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default () => (registerStore('mailpoet-form-editor', config));
|
};
|
||||||
|
Reference in New Issue
Block a user