Skip to content

Commit

Permalink
ADD a shortcut to right-click to remove the selected item
Browse files Browse the repository at this point in the history
  • Loading branch information
ConradSun committed Oct 22, 2023
1 parent b01a808 commit cdada63
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions PasteShow/PasteboardManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,8 @@ class PasteboardManager {
pasteInfo.infoList.remove(at: itemsIndex)
pasteboard.writeObjects(pasteItems)
}

func removePasteItem(itemsIndex: Int) {
pasteInfo.infoList.remove(at: itemsIndex)
}
}
6 changes: 5 additions & 1 deletion PasteShow/SplitView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ struct SidebarView: View {
status.setIndex = 0
PasteboardManager.shared.refreshPasteItems(itemsIndex: index)
}
Button("Remove this item") {
status.setIndex = status.setIndex - 1
PasteboardManager.shared.removePasteItem(itemsIndex: index)
}
}
}
}
Expand All @@ -50,7 +54,7 @@ struct ContentView: View {
}

var body: some View {
if info.infoList.isEmpty || info.infoList[0].copiedItems.isEmpty {
if info.infoList.isEmpty {
Text("No Item")
} else {
let items = info.infoList[status.setIndex].copiedItems
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Right-click supports menus as below

- Copying the selected type (click on the type of data)
- Set the selected items to the current (click on the item in the sidebar)
- Remove the selected items (click on the item in the sidebar)

## Download

Expand Down

0 comments on commit cdada63

Please sign in to comment.