Repository navigation
feat: configure native clipboard identity for linked selections - #962
juliusmarminge wants to merge 3 commits into
Conversation
|
@juliusmarminge thanks for the PR. The use case is valid, but I'd like to land a smaller API for it. I've updated this comment after reading how T3 Code uses the prop, so please read it again if you saw the earlier version. What I'd keep A single typed prop for the plain-text form of a copied selection: <EnrichedMarkdownText copyLinksAs="markdown" />With This applies to every link, so ordinary links would also paste as What I'd drop
The context fragment I earlier assumed the plain text carries everything a paste needs. From T3 Code's source, it only carries the reference: the records live in the Instead of adding those formats to the library, I'd add one event: <EnrichedMarkdownText
copyLinksAs="markdown"
onSelectionCopy={({ text, markdown }) => {
// add your own clipboard data here
}}
/>You already have Question Would Separately, I found that our own input component reads Markdown from a private pasteboard type that our text component's Copy doesn't write, so copy-paste between the two loses links today. That's our bug and I'll fix it on main regardless of this PR. |
|
Thanks for digging into how we use it. You read it right: the plain text only carries the
A few requests so that merge works:
Happy to drop |
What/Why?
Applications can render a shortened link or pill label while needing its canonical identity when pasted back. Add optional
selectionClipboardconfiguration for exact link URLs, escaped HTML attributes and iOS custom pasteboard types. Ordinary Copy replaces configured link text, including partially selected labels. Copy as Markdown preserves the Markdown payload; metadata is applied only when the selection contains a configured link. Configuration does not alter rendering or measurement.Android supports plain text and HTML. Custom pasteboard types are iOS only and do not overwrite existing standard formats. Web ignores the native configuration. Removing the prop restores ordinary copy behavior.
Fixes #955.
Testing
UIPasteboardoutput for canonical text, escaped HTML attributes and custom types, unconfigured selections, partial link selections and Copy as Markdown metadata.The recording shows those three states in the current build. It retains the original playback speed; it is functional proof, not a performance comparison or a separate baseline build.
Local native proof uses an isolated upstream example checkout on an iPhone 17 Pro simulator running iOS 27. Xcode used two jobs, disabled signing/index/debug symbols, and task-owned XCFrameworks retained the arm64 simulator slice to fit the host. The clipboard XCTest run used an Xcode-managed isolated test worker. These are host resource settings, not workflow or production changes. No Android device, macOS runtime, VoiceOver traversal, or full Maestro-suite pass is claimed. Standalone example typecheck remains blocked by existing React Native workspace type conflicts; library types and scoped example lint passed.
Base: b80be973. Current head: c1227447. Current-head CI is pending; earlier-head results are not claimed as verification of this commit.
PR Checklist
Model: GPT-6.1. Harness: Codex in T3 Code.