Allow pasting and attaching images in question Other fields on iPhone

This commit is contained in:
Ian Gulliver
2026-10-21 22:41:00 -07:00
parent 5384c83a0f
commit 5b1015d006
2 changed files with 50 additions and 21 deletions
+28 -17
View File
@@ -84,6 +84,34 @@ struct OtherEntry: View {
var body: some View {
let focused = focus.wrappedValue == otherStop
HStack(alignment: .bottom, spacing: 8) {
entry(focused)
#if os(iOS)
ComposerMenu(key: key, photos: true)
.disabled(busy)
#endif
}
.onAppear {
text = store.drafts?.textAnswer(key) ?? ""
}
.onChange(of: text) {
if text != store.drafts?.textAnswer(key) ?? "" {
store.drafts?.setTextAnswer(key, text)
}
store.paneFocus.setDraft(key, !trimmed(text).isEmpty)
}
.onChange(of: store.drafts?.textAnswer(key)) { _, new in
if (new ?? "") != text {
text = new ?? ""
}
}
.onDisappear {
store.paneFocus.setDraft(key, false)
}
}
@ViewBuilder
private func entry(_ focused: Bool) -> some View {
Group {
if otherOpen(store, key) {
VStack(alignment: .leading, spacing: 6) {
@@ -135,23 +163,6 @@ struct OtherEntry: View {
.onHover { hover = $0 }
}
}
.onAppear {
text = store.drafts?.textAnswer(key) ?? ""
}
.onChange(of: text) {
if text != store.drafts?.textAnswer(key) ?? "" {
store.drafts?.setTextAnswer(key, text)
}
store.paneFocus.setDraft(key, !trimmed(text).isEmpty)
}
.onChange(of: store.drafts?.textAnswer(key)) { _, new in
if (new ?? "") != text {
text = new ?? ""
}
}
.onDisappear {
store.paneFocus.setDraft(key, false)
}
}
private func open() {