Code-Ersetzung mit Teams (TXT-Import, nur neue Spieler nachladen, Auto-Reload), Codes ohne Trennzeichen, Cursor bleibt stehen; Auswerfen per diskutil mit Wiederholung direkt nach dem Kopieren
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
d39db536a0
commit
25729ebfe3
10 files changed
+615
-134
No files matched your search
@@ -72,7 +72,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),
|
||||
PMFieldRow(field: field, text: binding(field), codes: codes,
|
||||
isMixed: mixed.contains(field.id) && !dirty.contains(field.id),
|
||||
isDirty: dirty.contains(field.id),
|
||||
applied: appliedBinding(field))
|
||||
@@ -89,12 +89,8 @@ struct PMMetadataForm: View {
|
||||
|
||||
private func binding(_ f: IPTCField) -> Binding<String> {
|
||||
Binding(get: { texts[f.id] ?? "" },
|
||||
set: { new in
|
||||
var value = new
|
||||
// PM code replacement while typing: "\bvb\" expands as soon as the closing delimiter is typed.
|
||||
if let codes, !codes.table.isEmpty, new.last == codes.delimiter, new.count > (texts[f.id]?.count ?? 0) {
|
||||
value = codes.expand(new)
|
||||
}
|
||||
set: { value in
|
||||
// Code replacement happens inside the text views (cursor stays in place).
|
||||
texts[f.id] = value
|
||||
// Editing a field ticks its checkbox (PM behaviour).
|
||||
applied?.wrappedValue.insert(f.id)
|
||||
@@ -106,6 +102,7 @@ struct PMMetadataForm: View {
|
||||
struct PMFieldRow: View {
|
||||
let field: IPTCField
|
||||
@Binding var text: String
|
||||
var codes: CodeReplacements?
|
||||
let isMixed: Bool
|
||||
let isDirty: Bool
|
||||
let applied: Binding<Bool>?
|
||||
@@ -141,21 +138,16 @@ struct PMFieldRow: View {
|
||||
if field.id == "dateCreated" {
|
||||
DateFieldEditor(text: $text)
|
||||
} else if let h = height {
|
||||
TextEditor(text: $text)
|
||||
.font(.system(size: 13))
|
||||
.scrollContentBackground(.hidden)
|
||||
.padding(4)
|
||||
.background(Color(nsColor: .textBackgroundColor))
|
||||
CodeTextView(text: $text, codes: codes)
|
||||
.overlay(alignment: .topLeading) {
|
||||
if isMixed && text.isEmpty {
|
||||
Text("‹mehrere Werte›").foregroundStyle(.tertiary).padding(8).allowsHitTesting(false)
|
||||
}
|
||||
}
|
||||
.overlay(RoundedRectangle(cornerRadius: 3).stroke(Color.secondary.opacity(0.4)))
|
||||
.frame(height: h)
|
||||
} else {
|
||||
TextField(isMixed ? "‹mehrere Werte›" : "", text: $text)
|
||||
.textFieldStyle(.roundedBorder)
|
||||
CodeTextField(text: $text, codes: codes, placeholder: isMixed ? "‹mehrere Werte›" : "")
|
||||
.frame(height: 22)
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
|
||||
Reference in new issue
Block a user