Skip to content

Commit

Permalink
Add context menu item to copy filename to clipboard
Browse files Browse the repository at this point in the history
  • Loading branch information
philmcmahon committed Dec 20, 2023
1 parent 5d36306 commit 7a87fdb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion frontend/src/js/components/workspace/Workspaces.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,8 @@ class WorkspacesUnconnected extends React.Component<Props, State> {
const items = [
// or 'pencil alternate'
{ key: "rename", content: "Rename", icon: "pen square" },
{ key: "remove", content: "Remove from workspace", icon: "trash" },
{ key: "remove", content: "Remove from workspace", icon: "trash" },
{key : "copyFilename", content: "Copy filename", icon: "copy"}
];

if (entry.data.addedBy.username === currentUser.username && isWorkspaceLeaf(entry.data)) {
Expand All @@ -528,6 +529,10 @@ class WorkspacesUnconnected extends React.Component<Props, State> {
this.props.resetFocusedAndSelectedEntries();
}

if (menuItemProps.content === 'Copy filename') {
navigator.clipboard.writeText(entry.name);
}


if (menuItemProps.content === "Delete file") {
this.setState({
Expand Down

0 comments on commit 7a87fdb

Please sign in to comment.