Add Copy & Delete to the context menu
Copies the item (or the selection, as plain lines) and removes it in one step — the 'take this out' gesture. No shortcut: Cmd+X belongs to the text fields, and a panel binding would steal it.
This commit is contained in:
@@ -324,6 +324,9 @@ struct PanelView: View {
|
||||
store.copyAsLines(ids: ids)
|
||||
flashCopied(item.id)
|
||||
}
|
||||
Button(multiple ? "Copy & Delete \(ids.count) Items" : "Copy & Delete") {
|
||||
copyAndDelete(item)
|
||||
}
|
||||
Divider()
|
||||
Button(item.done ? "Mark as Not Done" : "Mark as Done") {
|
||||
store.setDone(!item.done, ids: ids)
|
||||
@@ -855,6 +858,22 @@ struct PanelView: View {
|
||||
flashCopied(item.id)
|
||||
}
|
||||
|
||||
/// One gesture for "take this out": copy, then delete. A multi-selection
|
||||
/// is copied as plain lines, same as Copy as Lines. No shortcut — Cmd+X
|
||||
/// belongs to the composer/editor text fields, and a panel binding would
|
||||
/// steal Cut from them.
|
||||
private func copyAndDelete(_ item: PromptItem) {
|
||||
let ids = effectiveIDs(for: item)
|
||||
if ids.count > 1 {
|
||||
store.copyAsLines(ids: ids)
|
||||
} else {
|
||||
store.copy(item)
|
||||
}
|
||||
store.delete(ids: ids)
|
||||
selection.subtract(ids)
|
||||
lastSelectedID = nil
|
||||
}
|
||||
|
||||
private func flashCopied(_ id: UUID) {
|
||||
withAnimation { copiedID = id }
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 1.2) {
|
||||
|
||||
Reference in New Issue
Block a user