Skip to content

Clipboard clears after paste even when the action was "copy" (should only clear on "move"/cut) #12

@elspear

Description

@elspear

When using file manager's copy and paste (via context menu and or keyboard shortcuts), the internal clipboard is set to null immediately after pasting, regardless of whether the clipboard action was "copy" or "move"

So you can't copy a file and paste it into multiple folders without re-copying each time.

Where it happens:

case "paste":
  if (copyRef.current) {
    api.exec(
      copyRef.current.action === "copy" ? "copy-files" : "move-files",
      {
        ids: copyRef.current.ids,
        target: contextArg?.type === "folder" ? contextArg.id : path,
      }
    );
    copyRef.current = null;  // <-- clears clipboard unconditionally
  }
  break;

Suggested fix: only clear clipboard when action was cut/move

case "paste":
  if (copyRef.current) {
    api.exec(
      copyRef.current.action === "copy" ? "copy-files" : "move-files",
      {
        ids: copyRef.current.ids,
        target: contextArg?.type === "folder" ? contextArg.id : path,
      }
    );
    if (copyRef.current.action !== "copy") {
      copyRef.current = null;
    }
  }
  break;

version: 2.4.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions