diff --git a/src/Components/Editor/Actions/ContextMenuActions.ts b/src/Components/Editor/Actions/ContextMenuActions.ts index 64f37fc..72863b0 100644 --- a/src/Components/Editor/Actions/ContextMenuActions.ts +++ b/src/Components/Editor/Actions/ContextMenuActions.ts @@ -32,8 +32,25 @@ export function GetAction( } /* eslint-disable @typescript-eslint/naming-convention */ + let prev; + let next; + if (container.parent !== undefined && + container.parent !== null && + container.parent.children.length > 1 + ) { + const index = container.parent.children.indexOf(container); + if (index > 0) { + prev = container.parent.children[index - 1]; + } + if (index < container.parent.children.length - 1) { + next = container.parent.children[index + 1]; + } + } + const request: ISetContainerListRequest = { Container: container, + PreviousContainer: prev, + NextContainer: next, Action: action.Action, ApplicationState: currentState }; diff --git a/src/Interfaces/ISetContainerListRequest.ts b/src/Interfaces/ISetContainerListRequest.ts index 496c7bb..3c03913 100644 --- a/src/Interfaces/ISetContainerListRequest.ts +++ b/src/Interfaces/ISetContainerListRequest.ts @@ -9,6 +9,12 @@ export interface ISetContainerListRequest { /** Selected container */ Container: IContainerModel + /** The previous sibling container */ + PreviousContainer: IContainerModel | undefined + + /** The next sibling container */ + NextContainer: IContainerModel | undefined + /** Current application state */ ApplicationState: IHistoryState }