Copy and Paste in context menu both incorrectly call handleDuplicate

Created on 10 April 2025, 12 days ago

Overview

Right clicking a component in the preview and then clicking Copy or Paste doesn't copy or paste the component as expected, but in fact both of those options do the same as clicking Duplicate. In the code for the context menu you can see why:

ComponentContextMenu.tsx

<UnifiedMenu.Item onClick={handleDuplicateClick} shortcut="⌘ D">
        Duplicate
</UnifiedMenu.Item>
<UnifiedMenu.Item onClick={handleDuplicateClick} shortcut="⌘ C">
        Copy
</UnifiedMenu.Item>
<UnifiedMenu.Item onClick={handleDuplicateClick} shortcut="⌘ V">
        Paste
</UnifiedMenu.Item>

Proposed resolution

Pressing the cmd+c and cmd+v keyboard shortcuts seems to work correctly, so those context menu items just need to do the same as pressing the keyboard shortcut

Canvas.tsx

useHotkeys('mod+c', () => {
  copySelectedComponent();
});

User interface changes

🐛 Bug report
Status

Active

Version

0.0

Component

Page builder

Created by

🇬🇧United Kingdom jessebaker

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024