fix: no-op unknown removal, earlier-duplicate editor check, list focus for delete/undo
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -21,6 +21,7 @@ struct DictionaryView: View {
|
||||
@State private var selection: UUID?
|
||||
@State private var editing: EditorTarget?
|
||||
@FocusState private var searchFocused: Bool
|
||||
@FocusState private var listFocused: Bool
|
||||
|
||||
var body: some View {
|
||||
VStack(spacing: Layout.panelGap) {
|
||||
@@ -77,14 +78,25 @@ struct DictionaryView: View {
|
||||
ForEach(list.visibleRows) { row in
|
||||
DictionaryRow(row: row, isSelected: selection == row.id)
|
||||
.onTapGesture(count: 2) { editing = .existing(row.id) }
|
||||
.onTapGesture { selection = row.id }
|
||||
.onTapGesture {
|
||||
selection = row.id
|
||||
listFocused = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.focusable()
|
||||
.focused($listFocused)
|
||||
.focusEffectDisabled()
|
||||
.onDeleteCommand {
|
||||
if let id = selection { list.remove(id: id) }
|
||||
if let id = selection {
|
||||
list.remove(id: id)
|
||||
selection = nil
|
||||
}
|
||||
}
|
||||
.onChange(of: list.rows) { _, rows in
|
||||
if let s = selection, !rows.contains(where: { $0.id == s }) { selection = nil }
|
||||
}
|
||||
.onKeyPress(KeyEquivalent("z"), phases: .down) { press in
|
||||
guard press.modifiers == .command, list.canUndo else { return .ignored }
|
||||
|
||||
Reference in New Issue
Block a user