Skip to content

Commit

Permalink
BUGFIX: Hide paste button in the Neos Ui if its across dimensions
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsdesign committed Dec 7, 2024
1 parent d9f4851 commit 27e53b8
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion packages/neos-ui-redux-store/src/CR/Nodes/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 27e53b8

Please sign in to comment.