Skip to content

Commit

Permalink
Fix click for paste action (#1835)
Browse files Browse the repository at this point in the history
  • Loading branch information
flops authored Nov 22, 2024
1 parent e8283fd commit c728cf7
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/ui/utils/getActionPanelItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ export const TYPES_TO_DIALOGS_MAP = {
[DashTabItemType.Image]: DIALOG_TYPE.IMAGE,
};

export const ITEM_PASTE_ITEM_ID = 'paste';

export const getActionPanelItems = ({
copiedData,
onPasteItem,
Expand All @@ -40,7 +42,7 @@ export const getActionPanelItems = ({

if (copiedData) {
items.push({
id: 'paste',
id: ITEM_PASTE_ITEM_ID,
icon: <Icon data={CopyPlus} />,
title: i18n('dash.main.view', 'button_edit-panel-paste'),
className: bEditPanelItem(),
Expand All @@ -59,10 +61,15 @@ export const getActionPanelItems = ({
if (filterItem && filterItem(item)) {
return result;
} else {
item.onClick = () =>
openDialog(
TYPES_TO_DIALOGS_MAP[item.dragProps?.type as keyof typeof TYPES_TO_DIALOGS_MAP],
);
if (item.id !== ITEM_PASTE_ITEM_ID) {
// eslint-disable-next-line no-param-reassign
item.onClick = () =>
openDialog(
TYPES_TO_DIALOGS_MAP[
item.dragProps?.type as keyof typeof TYPES_TO_DIALOGS_MAP
],
);
}

return [...result, item];
}
Expand Down

0 comments on commit c728cf7

Please sign in to comment.