Make pasting reliable and turn items into checkboxes
Pasting still failed because the panel is a nonactivating panel: it can be key while the app is not active, and menu key equivalents are not delivered reliably in that state. Cmd+V is now dispatched to the responder chain directly, and the app no longer replaces SwiftUI's main menu — it only adds Hide Panel to it, so the Edit items that AppKit routes text shortcuts through stay intact. Rows also gained a checkbox so a workspace works as a checklist without turning the row into a button, which would swallow the checkbox's clicks.
This commit is contained in:
@@ -193,8 +193,21 @@ struct PanelView: View {
|
||||
.padding(.vertical, 48)
|
||||
}
|
||||
|
||||
/// Rows are checklists by default: a checkbox to tick an item off, with the
|
||||
/// rest of the row copying on click. The row cannot be a Button because the
|
||||
/// checkbox is one, and nested buttons do not receive clicks.
|
||||
private func row(for item: PromptItem, sectionName: String) -> some View {
|
||||
Button { handleClick(item) } label: {
|
||||
HStack(alignment: .top, spacing: 8) {
|
||||
Button {
|
||||
store.toggleDone(item.id)
|
||||
} label: {
|
||||
Image(systemName: item.done ? "checkmark.circle.fill" : "circle")
|
||||
.font(.system(size: 15))
|
||||
.foregroundStyle(item.done ? Color.accentColor : Color.secondary.opacity(0.55))
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
.help(item.done ? "Mark as not done" : "Mark as done")
|
||||
|
||||
VStack(alignment: .leading, spacing: 6) {
|
||||
if !sectionName.isEmpty {
|
||||
Text(sectionName.uppercased())
|
||||
@@ -208,29 +221,28 @@ struct PanelView: View {
|
||||
Text(sourceApp)
|
||||
}
|
||||
Text(item.createdAt, style: .time)
|
||||
if item.done {
|
||||
Image(systemName: "checkmark")
|
||||
}
|
||||
}
|
||||
.font(.caption2)
|
||||
.foregroundStyle(.tertiary)
|
||||
}
|
||||
.padding(10)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.background(rowBackground(item))
|
||||
.cornerRadius(8)
|
||||
.overlay(alignment: .topTrailing) {
|
||||
if copiedID == item.id {
|
||||
Label("Copied", systemImage: "checkmark.circle.fill")
|
||||
.font(.caption2)
|
||||
.foregroundStyle(.green)
|
||||
.padding(6)
|
||||
.transition(.opacity)
|
||||
}
|
||||
}
|
||||
.padding(10)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.background(rowBackground(item))
|
||||
.cornerRadius(8)
|
||||
.overlay(alignment: .topTrailing) {
|
||||
if copiedID == item.id {
|
||||
Label("Copied", systemImage: "checkmark.circle.fill")
|
||||
.font(.caption2)
|
||||
.foregroundStyle(.green)
|
||||
.padding(6)
|
||||
.transition(.opacity)
|
||||
}
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
.help("Click to copy · Cmd+click to select several · Shift+click for a range · right-click for more")
|
||||
.contentShape(Rectangle())
|
||||
.onTapGesture { handleClick(item) }
|
||||
.help("Click to copy · checkbox to tick off · Cmd+click to select several · Shift+click for a range · right-click for more")
|
||||
.contextMenu { contextMenu(for: item) }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user