1
0
Fork 0
mirror of synced 2024-10-06 04:54:52 +13:00
This commit is contained in:
Gerard Burns 2023-08-18 12:23:35 +01:00
parent e5f818a0ce
commit 5aea392616

View file

@ -998,12 +998,17 @@ export const getFrontendStore = () => {
const componentId = state.selectedComponentId
const screen = get(selectedScreen)
const parent = findComponentParent(screen.props, componentId)
// Check we aren't right at the top of the tree
const index = parent?._children.findIndex(x => x._id === componentId)
if (!parent || componentId === screen.props._id) {
if (componentId === 'screen') {
return null
}
if (componentId === 'navigation') {
return "screen"
}
if (parent._id === screen.props._id && index === 0) {
return "navigation"
}
// If we have siblings above us, choose the sibling or a descendant
if (index > 0) {
@ -1025,12 +1030,17 @@ export const getFrontendStore = () => {
return parent._id
},
getNext: () => {
const state = get(store)
const component = get(selectedComponent)
const componentId = component?._id
const screen = get(selectedScreen)
const parent = findComponentParent(screen.props, componentId)
const index = parent?._children.findIndex(x => x._id === componentId)
if (state.selectedComponentId === 'screen') {
return 'navigation'
}
// If we have children, select first child
if (component._children?.length) {
return component._children[0]._id