Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added paste options to context-menu #1117

Open
wants to merge 14 commits into
base: 1.x
Choose a base branch
from

Conversation

Corepex
Copy link
Contributor

@Corepex Corepex commented Mar 12, 2025

Changes in this pull request

Partly-Resolves #950
Blocked-by: pimcore/studio-backend-bundle#890

Additional info

This pull request introduces a new usePaste hook and integrates it into the context menu for data objects, enhancing the copy-paste functionality. The main changes include the addition of new paste options and the removal of redundant code.

Enhancements to copy-paste functionality:

Integration into context menu:

Refactoring of useCopyPaste:

Translation updates:

@Corepex Corepex self-assigned this Mar 12, 2025
Corepex and others added 4 commits March 12, 2025 14:11
return isPasteOpenHidden(node) ||
node.type === 'folder' ||
node.isLocked
// storedNode?.type !== node.type //TODO: i guess we need to compare the className aswell
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes for paste only contents we need to compare the class name

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done with 3354af4

Copy link
Contributor Author

@Corepex Corepex Mar 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Funfact: in the old UI we dont check the className ... you can select paste only contentfrom acarto aevent`

image

const isPasteOpenHidden = (node: Element | TreeNodeProps): boolean => {
return !isTreeActionAllowed(TreePermission.Paste) ||
(storedNode === undefined || nodeTask !== 'copy') ||
!checkElementPermission(node.permissions, 'create')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to check the locked status too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope at least in the old UI its not respected ...

image

hidden: isPasteOpenHidden(node),
onClick: async () => {
dispatch(setNodeFetching({ treeId, nodeId: String(node.id), isFetching: true }))
await paste(parseInt(node.id), { recursive: true, updateReferences: false }, storedNode)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need to pass the storedNode?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because node is the currently clicked one and the storedNode is the copied one. Or did i miss something?

@Corepex Corepex requested a review from markus-moser March 20, 2025 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing tree data object context menu actions
2 participants