feat: delete the selected note

This commit is contained in:
2026-10-19 19:43:25 +02:00
parent 0d9f7e0f00
commit 63d0387339
7 changed files with 156 additions and 8 deletions
@@ -36,6 +36,7 @@ final class ApplicationActionsController: NSViewController, NSSearchFieldDelegat
var selectNote: ((UUID) -> Void)?
var browseNotes: (() -> Void)?
var newNote: (() -> Void)?
var deleteNote: (() -> Void)?
private enum ChoiceID: Equatable {
case language(String)
case note(UUID)
@@ -84,7 +85,8 @@ final class ApplicationActionsController: NSViewController, NSSearchFieldDelegat
ActionEntry(title: "MyMemory (no key)", symbol: "checkmark", color: SunsetPalette.text),
ActionEntry(title: "OpenAI · gpt-6-luna", symbol: "checkmark", color: SunsetPalette.text),
ActionEntry(title: "Browse Notes", symbol: "list.bullet", color: SunsetPalette.text, commandKey: "P"),
ActionEntry(title: "New Note", symbol: "square.and.pencil", color: SunsetPalette.text, commandKey: "N")
ActionEntry(title: "New Note", symbol: "square.and.pencil", color: SunsetPalette.text, commandKey: "N"),
ActionEntry(title: "Delete Note", symbol: "trash", color: .systemRed)
]
view = ActionsPanelView()
view.wantsLayer = true
@@ -257,7 +259,7 @@ final class ApplicationActionsController: NSViewController, NSSearchFieldDelegat
}
func showNotesActions(relativeTo anchor: NSView) {
show(title: "Notes", relativeTo: anchor, available: [12, 13],
show(title: "Notes", relativeTo: anchor, available: [12, 13, 14],
searchAccessibilityLabel: "Search notes actions", belowAnchor: true)
}
@@ -464,7 +466,7 @@ final class ApplicationActionsController: NSViewController, NSSearchFieldDelegat
}
private func handleCommandKey(_ key: String) -> Bool {
guard isShown, availableEntries == [12, 13] else { return false }
guard isShown, availableEntries == [12, 13, 14] else { return false }
switch key {
case "p": close(); browseNotes?()
case "n": close(); newNote?()
@@ -537,6 +539,7 @@ final class ApplicationActionsController: NSViewController, NSSearchFieldDelegat
case 11: selectProvider?(true)
case 12: browseNotes?()
case 13: newNote?()
case 14: deleteNote?()
default: break
}
}