Allow pasting and attaching images in question Other fields on iPhone
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user