Various improvements

This commit is contained in:
Ilya Laktyushin
2025-06-25 12:00:37 +02:00
parent f2e96efdb5
commit cae2388f95
26 changed files with 875 additions and 162 deletions

View File

@@ -921,6 +921,31 @@ final class ComposeTodoScreenComponent: Component {
self.todoItems.removeAll(where: { $0.id == optionId })
self.state?.updated(transition: .spring(duration: 0.4))
} : nil,
paste: { [weak self] data in
guard let self else {
return
}
if case let .text(text) = data {
let lines = text.string.components(separatedBy: "\n")
if !lines.isEmpty {
var i = 0
for line in lines {
if i < self.todoItems.count {
self.todoItems[i].resetText = line
} else {
let todoItem = ComposeTodoScreenComponent.TodoItem(
id: self.nextTodoItemId
)
todoItem.resetText = line
self.todoItems.append(todoItem)
self.nextTodoItemId += 1
}
i += 1
}
self.state?.updated()
}
}
},
tag: todoItem.textFieldTag
))))