auto nesting or not, on add component

This commit is contained in:
Michael Shanks 2020-08-12 17:00:05 +01:00
parent c95363dd66
commit 3703aa2a1e
1 changed files with 8 additions and 3 deletions

View File

@ -293,9 +293,14 @@ const addChildComponent = store => (componentToAdd, presetProps = {}) => {
state
)
state.currentComponentInfo._children = state.currentComponentInfo._children.concat(
newComponent.props
)
const currentComponent =
state.components[state.currentComponentInfo._component]
const targetParent = currentComponent.children
? state.currentComponentInfo
: getParent(state.currentPreviewItem.props, state.currentComponentInfo)
targetParent._children = targetParent._children.concat(newComponent.props)
state.currentFrontEndType === "page"
? _savePage(state)