Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
duplicate: ({ element }) => () => {
const state = redux.store.getState();
element = getElementWithChildren(state, element.id);
const parent = getParentElementWithChildren(state, element.id);
const position = parent.elements.findIndex(el => el.id === element.id) + 1;
const newElement = set(parent, "elements", [
...parent.elements.slice(0, position),
cloneElement(element),
...(position < parent.elements.length ? parent.elements.slice(position) : [])
]);
return redux.store.dispatch(updateElement({ element: newElement }));
}
})
Loading Editor<span>.</span>
<span>.</span>
<span>.</span>
);
}
if (!get(data, "pageBuilder.page.data")) {
return null;
}
if (!redux.store) {
redux.initStore({}, { client });
}
if (!loading) {
const { revisions, ...page } = data.pageBuilder.page.data;
if (!page.content) {
page.content = createElement("document");
}
if (pageSet !== page.id) {
pageSet = page.id;
redux.store.dispatch({
type: SETUP_EDITOR,
payload: getEmptyData(page, revisions)
});
redux.store.dispatch({ type: "@@redux-undo/INIT" });
onChildDeleted({ element }) {
if (element.elements.length === 0) {
element = set(element, "elements", [
createRow({
elements: [createColumn({ data: { width: 100 } })]
})
]);
redux.store.dispatch(updateElement({ element }));
}
}
};
return null;
}
if (!redux.store) {
redux.initStore({}, { client });
}
if (!loading) {
const { revisions, ...page } = data.pageBuilder.page.data;
if (!page.content) {
page.content = createElement("document");
}
if (pageSet !== page.id) {
pageSet = page.id;
redux.store.dispatch({
type: SETUP_EDITOR,
payload: getEmptyData(page, revisions)
});
redux.store.dispatch({ type: "@@redux-undo/INIT" });
}
}
return (
<div style="{{">
</div>