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:
Lichtkasten DevandClaude Opus 5.5 committed 2026-11-04 00:52:42 +00:00
1 parent 12f61b5d66
commit 2bf0d851aa
11 files changed
+516 -15

No files matched your search

+30 -4
View File
@@ -43,6 +43,8 @@ struct PMMetadataForm: View {
/// PM checkboxes; nil = no checkboxes (info window).
var applied: Binding<Set<String>>? = nil
var codes: CodeReplacements? = nil
/// ▾ lists (PM drop-down values)
var fieldLists: [String: [String]] = [:]
var onEdit: (String) -> Void = { _ in }
/// Extra rows (e.g. "Image Preferences → Label") inserted after Image Content.
var extraAfterContent: AnyView? = nil
@@ -72,7 +74,7 @@ struct PMMetadataForm: View {
VStack(alignment: .leading, spacing: 6) {
PMSectionHeader(title: section.rawValue)
ForEach(IPTCField.all.filter { $0.section == section }) { field in
PMFieldRow(field: field, text: binding(field), codes: codes,
PMFieldRow(field: field, text: binding(field), codes: codes, listValues: fieldLists[field.id] ?? [],
isMixed: mixed.contains(field.id) && !dirty.contains(field.id),
isDirty: dirty.contains(field.id),
applied: appliedBinding(field))
@@ -103,6 +105,7 @@ struct PMFieldRow: View {
let field: IPTCField
@Binding var text: String
var codes: CodeReplacements?
var listValues: [String] = []
let isMixed: Bool
let isDirty: Bool
let applied: Binding<Bool>?
@@ -126,9 +129,18 @@ struct PMFieldRow: View {
.font(.system(size: 12))
.foregroundStyle(isDirty ? Color.accentColor : .primary)
.help(field.label)
if let max = field.iimMaxBytes, text.utf8.count > max, !text.contains("{") {
Text("\(text.utf8.count)/\(max)").font(.caption2.monospacedDigit()).foregroundStyle(.red)
.help("IPTC-IIM-Limit in Bytes – Agenturen kürzen längere Werte.")
// IIM limit: for keywords etc. it applies to each entry, not to the whole field.
if let max = field.iimMaxBytes, !text.contains("{") {
if field.kind == .list {
let long = IPTCValues.splitList(text).filter { $0.utf8.count > max }
if !long.isEmpty {
Text("\(long.count)× > \(max)").font(.caption2.monospacedDigit()).foregroundStyle(.red)
.help("Diese Einträge sind länger als \(max) Bytes (IIM-Limit pro Eintrag): " + long.joined(separator: ", "))
}
} else if text.utf8.count > max {
Text("\(text.utf8.count)/\(max)").font(.caption2.monospacedDigit()).foregroundStyle(.red)
.help("IPTC-IIM-Limit in Bytes – Agenturen kürzen längere Werte.")
}
}
}
.frame(width: 150, alignment: .leading)
@@ -153,6 +165,20 @@ struct PMFieldRow: View {
.frame(maxWidth: .infinity)
Menu {
if !listValues.isEmpty {
Section("Werte") {
ForEach(listValues.prefix(40), id: \.self) { v in
Button(v) {
if field.kind == .list {
let items = IPTCValues.splitList(text)
if !items.contains(v) { text = (items + [v]).joined(separator: ", ") }
} else {
text = v
}
}
}
}
}
Section("Variablen") {
ForEach(VariableExpander.documented, id: \.0) { v in
Button("\(v.0) – \(v.1)") { text += v.0 }