From 27e53b804b595c207b24a68f757fa3584628bd50 Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Sat, 7 Dec 2024 16:53:44 +0100 Subject: [PATCH] BUGFIX: Hide paste button in the Neos Ui if its across dimensions --- .../neos-ui-redux-store/src/CR/Nodes/selectors.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/neos-ui-redux-store/src/CR/Nodes/selectors.ts b/packages/neos-ui-redux-store/src/CR/Nodes/selectors.ts index 7232166eeb..007b7a27c6 100644 --- a/packages/neos-ui-redux-store/src/CR/Nodes/selectors.ts +++ b/packages/neos-ui-redux-store/src/CR/Nodes/selectors.ts @@ -455,12 +455,25 @@ export const makeCanBeMovedAlongsideSelector = (nodeTypesRegistry: NodeTypesRegi (canBeInsertedInto, referenceIsDescendantOfSubject) => canBeInsertedInto && !referenceIsDescendantOfSubject ); +const makeNodeIsOfCurrentDimension = (_: GlobalState, {subject, reference}: {subject: NodeContextPath | null, reference: NodeContextPath | null}) => { + if (subject === null || reference === null) { + return false; + } + + // todo centralise client side NodeAddress logic + const subjectDimension = JSON.parse(subject).dimensionSpacePoint; + const referenceDimension = JSON.parse(reference).dimensionSpacePoint; + + return JSON.stringify(subjectDimension) === JSON.stringify(referenceDimension); +}; + export const makeCanBeCopiedSelector = (nodeTypesRegistry: NodeTypesRegistry) => createSelector( [ + makeNodeIsOfCurrentDimension, makeCanBeCopiedAlongsideSelector(nodeTypesRegistry), makeCanBeCopiedIntoSelector(nodeTypesRegistry) ], - (canBeInsertedAlongside, canBeInsertedInto) => (canBeInsertedAlongside || canBeInsertedInto) + (nodeIsOfCurrentDimension, canBeInsertedAlongside, canBeInsertedInto) => nodeIsOfCurrentDimension && (canBeInsertedAlongside || canBeInsertedInto) ); export const makeCanBeMovedSelector = (nodeTypesRegistry: NodeTypesRegistry) => createSelector(