Paste and drop images into every box that talks to an agent
This commit is contained in:
@@ -353,7 +353,6 @@ private struct SwitcherBox: View {
|
||||
@Environment(Store.self) private var store
|
||||
@Environment(Overlays.self) private var overlays
|
||||
@FocusState private var focused: Bool
|
||||
@State private var targeted = false
|
||||
|
||||
var body: some View {
|
||||
let (rows, empty) = model.rows()
|
||||
@@ -432,7 +431,6 @@ private struct SwitcherBox: View {
|
||||
.scrollContentBackground(.hidden)
|
||||
.writingToolsBehavior(.disabled)
|
||||
.focused($focused)
|
||||
.focusedValue(\.composer, ComposerTarget(paste: { pb in store.images.add(model.imageKey, pasteboard: pb, overlays) }))
|
||||
.padding(.horizontal, 5)
|
||||
.padding(.vertical, 6)
|
||||
}
|
||||
@@ -446,11 +444,8 @@ private struct SwitcherBox: View {
|
||||
.allowsHitTesting(false)
|
||||
}
|
||||
}
|
||||
.overlay(RoundedRectangle(cornerRadius: 6).stroke(targeted || focused ? Palette.accent : Palette.border))
|
||||
.onDrop(of: [.image, .fileURL], isTargeted: $targeted) { providers in
|
||||
store.images.add(model.imageKey, providers: providers, overlays)
|
||||
return true
|
||||
}
|
||||
.overlay(RoundedRectangle(cornerRadius: 6).stroke(focused ? Palette.accent : Palette.border))
|
||||
.imageInput(model.imageKey)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user