Browse Source

auto nesting or not, on add component

master
Michael Shanks 6 years ago
parent
commit
3703aa2a1e
  1. 11
      packages/builder/src/builderStore/store/index.js

11
packages/builder/src/builderStore/store/index.js

@ -293,9 +293,14 @@ const addChildComponent = store => (componentToAdd, presetProps = {}) => {
state state
) )
state.currentComponentInfo._children = state.currentComponentInfo._children.concat( const currentComponent =
newComponent.props 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" state.currentFrontEndType === "page"
? _savePage(state) ? _savePage(state)

Loading…
Cancel
Save