You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add linkOnPaste prop to EnrichedTextInput (iOS, Android, Web)
When enabled, pasting clipboard content that is solely a URL over a
non-empty selection turns the selected text into a link pointing to that
URL instead of replacing the selection. Disabled by default.
- Recognizes a URL only when it fully matches linkRegex (or the default
link-detection patterns); scheme-less URLs get an https:// prefix.
- Falls back to a normal paste for empty/whitespace selections, non-bare-URL
clipboard text, or when the link style is blocked (inline code, code block).
- No effect when link detection is disabled via linkRegex={null}.
JS: prop on the codegen spec, types, default props, native/web wrappers.
iOS: gated branch in paste:, tryAddLinkAt:/linkURLIfEntireString: on the view,
matchesEntireLinkRegexWithConfig: on LinkStyle.
Android: gated branch in handleTextPaste, linkifySelectionOnPaste helper,
linkExactRegex companion, setLinkOnPaste ViewManager setter.
Web: handleLinkOnPaste wired into TipTap handlePaste.
Docs (INPUT_API_REFERENCE), example apps and a Playwright linkOnPaste suite
(4 cases, all green; full links suite 35 passed).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: docs/INPUT_API_REFERENCE.md
+10Lines changed: 10 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -124,6 +124,16 @@ Keep in mind that not all JS regex features are supported, for example variable-
124
124
> [!TIP]
125
125
> With this approach you can also disable link detection completely by providing a `null` value as the prop.
126
126
127
+
### `linkOnPaste`
128
+
129
+
If `true`, pasting clipboard content that consists solely of a URL while some text is selected turns the selection into a link pointing to that URL, instead of replacing the selected text with the pasted content.
130
+
131
+
The pasted content is recognized as a URL when it fully matches [`linkRegex`](#linkregex) (or the default link detection patterns when the prop is not provided). URLs without a scheme (e.g. `www.example.com`) get an `https://` prefix in the resulting link. The paste falls back to the regular behavior when the selection is empty or whitespace-only, or when the link style cannot be applied at the selection (e.g. inside inline code or a code block). Has no effect when link detection is disabled with `linkRegex={null}`.
132
+
133
+
| Type | Default Value | Platform |
134
+
| ------ | ------------- | ----------------- |
135
+
|`bool`|`false`| iOS, Android, Web |
136
+
127
137
### `onBlur`
128
138
129
139
Callback that's called whenever the input loses focus (is blurred).
0 commit comments