PM-Einstellungen komplett importieren (Vorlagen, Code-Dateien, Trennzeichen, Feld-Listen, Ingest), ▾-Wertelisten, Info-Fenster ⌘B/⌘N + Pfeiltasten, Keyword-Limit pro Eintrag
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012bGzgsxrmbBhDzeMV2L57D
This commit is contained in:
1 parent
12f61b5d66
commit
2bf0d851aa
11 files changed
+516
-15
No files matched your search
@@ -87,6 +87,7 @@ final class AppState: ObservableObject {
|
||||
@Published var showTemplatePicker = false
|
||||
@Published var showTemplateManager = false
|
||||
@Published var showIngest = false
|
||||
@Published var showPMImport = false
|
||||
@Published var windowRequest: WindowRequest?
|
||||
/// Card(s) that triggered the ingest window.
|
||||
@Published var pendingIngestSources: [URL] = []
|
||||
@@ -682,9 +683,21 @@ final class AppState: ObservableObject {
|
||||
Task { await applyIPTCAndWait(draft, fields: fields, to: targets) }
|
||||
}
|
||||
|
||||
/// Remembers used values for the ▾ list of each field (most recent first, like PM's recent values).
|
||||
func rememberFieldValues(_ values: IPTCValues, fields: [IPTCField]) {
|
||||
for f in fields where f.kind != .list && f.kind != .multiline {
|
||||
guard let v = values.text[f.id]?.trimmingCharacters(in: .whitespaces), !v.isEmpty, !v.contains("{") else { continue }
|
||||
var list = settings.fieldLists[f.id] ?? []
|
||||
list.removeAll { $0 == v }
|
||||
list.insert(v, at: 0)
|
||||
settings.fieldLists[f.id] = Array(list.prefix(60))
|
||||
}
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
func applyIPTCAndWait(_ draft: IPTCValues, fields: [IPTCField], to targets: [PhotoItem]) async -> Bool {
|
||||
guard !targets.isEmpty, !fields.isEmpty, let w = writer else { return false }
|
||||
rememberFieldValues(draft, fields: fields)
|
||||
statusText = "Schreibe IPTC in \(targets.count) Bild(er) …"
|
||||
var count = 0
|
||||
for t in targets {
|
||||
|
||||
@@ -83,6 +83,8 @@ struct AppSettings: Codable {
|
||||
var recentFolders: [String] = []
|
||||
var favoriteFolders: [String] = []
|
||||
var lastTemplateID: UUID?
|
||||
/// PM ▾ drop-down lists per IPTC field (imported from PM + recently used values)
|
||||
var fieldLists: [String: [String]] = [:]
|
||||
|
||||
init() {}
|
||||
|
||||
@@ -105,6 +107,7 @@ struct AppSettings: Codable {
|
||||
recentFolders = (try? c.decode([String].self, forKey: .recentFolders)) ?? d.recentFolders
|
||||
favoriteFolders = (try? c.decode([String].self, forKey: .favoriteFolders)) ?? d.favoriteFolders
|
||||
lastTemplateID = try? c.decode(UUID.self, forKey: .lastTemplateID)
|
||||
fieldLists = (try? c.decode([String: [String]].self, forKey: .fieldLists)) ?? [:]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user