-
Notifications
You must be signed in to change notification settings - Fork 8
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
base: 1.x
Are you sure you want to change the base?
Added paste
options to context-menu
#1117
Conversation
…text-menu-actions-paste-options' into 950-missing-tree-data-object-context-menu-actions-paste-options
assets/js/src/core/modules/data-object/actions/paste/use-paste.tsx
Outdated
Show resolved
Hide resolved
return isPasteOpenHidden(node) || | ||
node.type === 'folder' || | ||
node.isLocked | ||
// storedNode?.type !== node.type //TODO: i guess we need to compare the className aswell |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done with 3354af4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const isPasteOpenHidden = (node: Element | TreeNodeProps): boolean => { | ||
return !isTreeActionAllowed(TreePermission.Paste) || | ||
(storedNode === undefined || nodeTask !== 'copy') || | ||
!checkElementPermission(node.permissions, 'create') |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hidden: isPasteOpenHidden(node), | ||
onClick: async () => { | ||
dispatch(setNodeFetching({ treeId, nodeId: String(node.id), isFetching: true })) | ||
await paste(parseInt(node.id), { recursive: true, updateReferences: false }, storedNode) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
|
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:
assets/js/src/core/modules/data-object/actions/paste/use-paste.tsx
: Introduced a newusePaste
hook with multiple paste options, such aspasteAsChildRecursiveTreeContextMenuItem
,pasteRecursiveUpdatingReferencesTreeContextMenuItem
,pasteAsChildTreeContextMenuItem
,pasteOnlyContentsTreeContextMenuItem
, andisPasteMenuHidden
.Integration into context menu:
assets/js/src/core/modules/data-object/tree/context-menu/context-menu.tsx
: Integrated the newusePaste
hook into the data object tree context menu, adding new paste options and removing redundant paste items. [1] [2]Refactoring of
useCopyPaste
:assets/js/src/core/modules/element/actions/copy-paste/use-copy-paste.tsx
: Refactored theuseCopyPaste
hook to support the new paste options and removed the oldpasteContextMenuItem
method. [1] [2] [3] [4] [5]Translation updates:
translations/studio.en.yaml
: Added new translation keys for the new paste options.