Paste and drop images into every box that talks to an agent
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user