feat: Notitie editor in the app, dictation routed to system or editor

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-02 09:47:54 +02:00
co-authored by Claude Sonnet 5.5
parent ab7359156b
commit f390d310f4
12 changed files with 433 additions and 34 deletions
+59
View File
@@ -0,0 +1,59 @@
import AppKit
import SstData
import SstUI
import SwiftUI
struct NoteView: View {
@EnvironmentObject private var model: AppModel
@ObservedObject var note: NoteStore
@State private var confirmingClear = false
var body: some View {
VStack(spacing: Layout.panelGap) {
header
ZStack {
PaperBackground()
if SnapshotMode.isActive {
// ImageRenderer cannot draw an NSView; the snapshot shows the text instead.
Text(note.text)
.textStyle(Typography.reading)
.foregroundStyle(Palette.inkPrimary)
.padding(Space.s5)
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
} else {
NoteEditor(text: $note.text, isEditable: !note.isReadOnly)
}
}
footer
}
.confirmationDialog(Strings.clearNoteConfirm, isPresented: $confirmingClear) {
Button(Strings.clear, role: .destructive) { note.text = "" }
}
}
private var header: some View {
HStack(spacing: Space.s4) {
SilkLabel(Strings.note)
Spacer()
Text(Strings.characters(note.text.count))
.textStyle(Typography.counterSmall)
.foregroundStyle(Palette.inkSecondary)
Button(Strings.copy) {
NSPasteboard.general.clearContents()
NSPasteboard.general.setString(note.text, forType: .string)
}
.buttonStyle(KeyButtonStyle())
.disabled(note.text.isEmpty)
Button(Strings.clear) { confirmingClear = true }
.buttonStyle(KeyButtonStyle())
.disabled(note.text.isEmpty)
}
}
private var footer: some View {
Text(note.isReadOnly ? Strings.noteUnreadable : Strings.noteHint(model.hotkeyBinding.displayName))
.textStyle(Typography.label)
.foregroundStyle(Palette.inkTertiary)
.frame(maxWidth: .infinity, alignment: .leading)
}
}