A picture off the pasteboard becomes a card's file, its hero, or the board's backdrop
⌘V grows an image-data branch, below the app's own clipboard format and refused outright while a file URL is on the pasteboard: a screenshot or a browser's Copy Image lands as "Pasted Image.png" in the anchor card's attachments/, through the very import path Finder file drops and ⇧⌘A take — one bracket, one Finder-style collision ladder, one set of banners, and the same silence a drop's arrival has. A card window's ⌘V pastes onto its own card; a focused text field still wins the selector natively. A file-shaped flavor travels byte for byte, PNG preferred when several are offered; TIFF and BMP are re-encoded to PNG, being interchange encodings rather than files anyone wants in a folder. The hero key gets the setter it was born owing: "Set as Hero" on any image row of the attachment list, "Remove Hero" on the row that holds it, with menu-bar twins so the context entry is nobody's only home. It writes as a restyle — one key, one bracket, one invertible step on the window's own stack — and replaces rather than refusing, because a card has one hero and the row that has it says Remove instead. Edit ▸ Paste as Board Background is the same payload's other destination, taking the existing background.image convention at its word: the picture into the board folder as "Pasted Background.png", the colour subkey untouched, the generator's overwrite-our-own-name rule inherited and its echo memo taught to tell the two producers apart. Claude-Session: https://claude.ai/code/session_014PtZdPwqZuqEDLc6wZMtEy
This commit is contained in:
@@ -201,6 +201,20 @@ public protocol ClipboardPasteboard: AnyObject {
|
||||
/// resulting `changeCount`.
|
||||
@discardableResult
|
||||
func write(manifest: Data, text: String) -> Int
|
||||
|
||||
/// **Every type identifier the pasteboard currently carries** — what the image-data branch
|
||||
/// classifies (04-interactions.md ▸ Clipboard, ruled 2026-08-09; `PastedImage.flavor`).
|
||||
///
|
||||
/// A list rather than a set of yes/no questions, because the *rule* is a decision over a list and
|
||||
/// belongs in one place: adding a flavor to `PastedImage.verbatimTypes` must not also mean adding
|
||||
/// a method here. It subsumes `manifestData()`'s question too, and does not replace it — the
|
||||
/// manifest is read as bytes and decoded, which a type list cannot answer.
|
||||
func availableTypes() -> [String]
|
||||
|
||||
/// The bytes under one type, whatever it is — the general read behind `manifestData()`'s
|
||||
/// specific one, added for the image branch (which knows its type only at runtime, off the
|
||||
/// classification above).
|
||||
func data(forType type: String) -> Data?
|
||||
}
|
||||
|
||||
/// The real pasteboard.
|
||||
@@ -226,6 +240,19 @@ public final class SystemPasteboard: ClipboardPasteboard {
|
||||
pasteboard.data(forType: Self.type)
|
||||
}
|
||||
|
||||
/// `NSPasteboard.types` — the **first item's** types, which is what "the clipboard's payload"
|
||||
/// means for every producer this branch cares about: a screenshot, a browser's Copy Image, a
|
||||
/// Finder copy, and this app's own write are all single-item writes. A multi-item pasteboard's
|
||||
/// later items are deliberately not consulted; pasting the second image of a five-image copy is a
|
||||
/// gesture nobody has asked for and would need a target grammar of its own.
|
||||
public func availableTypes() -> [String] {
|
||||
(pasteboard.types ?? []).map(\.rawValue)
|
||||
}
|
||||
|
||||
public func data(forType type: String) -> Data? {
|
||||
pasteboard.data(forType: NSPasteboard.PasteboardType(type))
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
public func write(manifest: Data, text: String) -> Int {
|
||||
pasteboard.clearContents()
|
||||
|
||||
Reference in New Issue
Block a user