Paste and drop images into every box that talks to an agent

This commit is contained in:
Ian Gulliver
2026-10-20 17:32:32 -07:00
parent 49f57b73fc
commit 15482473f7
9 changed files with 133 additions and 83 deletions
+5 -5
View File
@@ -260,10 +260,10 @@ final class Drafts {
comments[taskId]?.first { $0.anchor == anchor }
}
func toggleLineComment(_ taskId: String, _ anchor: LineAnchor) {
func toggleLineComment(_ taskId: String, _ anchor: LineAnchor, ready: (LineComment) -> Bool) {
var list = comments[taskId] ?? []
if let i = list.firstIndex(where: { $0.anchor == anchor }) {
if !trimmed(list[i].text).isEmpty {
if ready(list[i]) {
return
}
list.remove(at: i)
@@ -290,10 +290,10 @@ final class Drafts {
save()
}
func takeLineComments(_ taskId: String) -> [LineComment] {
func takeLineComments(_ taskId: String, ready isReady: (LineComment) -> Bool) -> [LineComment] {
let all = comments[taskId] ?? []
let ready = all.filter { !trimmed($0.text).isEmpty }
let rest = all.filter { trimmed($0.text).isEmpty }
let ready = all.filter(isReady)
let rest = all.filter { !isReady($0) }
comments[taskId] = rest.isEmpty ? nil : rest
dirty = true
flush()