Cotton code
27 lines · 1.1 KB · SwiftRaw
import CottonValuesimport SwiftUI/// THE PASTE CARD at a list's head (`paste` in the definition): the/// system's own Paste button, whose text becomes a record.////// The system's button and no other, because it is the one read of the/// clipboard the system never asks about: Settings › Cotton › Paste from Other/// Apps may be Ask, and a read of our own would put up its alert. A tap on/// this button IS the person's permission (Clips, 14 Oct 2026).struct ListPasteHead: View {    let paste: ListPaste    let make: ([String: RecordValue]) async -> Bool    var body: some View {        HStack(spacing: 0) {            PasteButton(payloadType: String.self) { strings in                guard let text = strings.first, !text.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty else { return }                let column = paste.column                Task { @MainActor in _ = await make([column: .text(text)]) }            }            .labelStyle(.titleAndIcon)            .accessibilityIdentifier("list-paste")            Spacer(minLength: 0)        }    }}