Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions docs/docs/api-reference/enriched-text-input.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ interface EnrichedTextInputProps extends Omit<ViewProps, 'children'> {
onChangeHtml?: (e: NativeSyntheticEvent<OnChangeHtmlEvent>) => void;
onChangeState?: (e: NativeSyntheticEvent<OnChangeStateEvent>) => void;
onLinkDetected?: (e: OnLinkDetected) => void;
onLinkPress?: (event: OnLinkPressEvent) => void;
onMentionDetected?: (e: OnMentionDetected) => void;
onStartMention?: (indicator: string) => void;
onChangeMention?: (e: OnChangeMentionEvent) => void;
Expand Down Expand Up @@ -427,6 +428,23 @@ interface OnLinkDetected {
| --------------------------------- | ----------------- |
| `(event: OnLinkDetected) => void` | Android, iOS, Web |

### `onLinkPress` {#onlinkpress}

Called when the user clicks a link inside the editor. Receives an
`OnLinkPressEvent` containing the link's URL. If not provided, clicking a link
has no effect. See [Links](/rich-text-formatting/links) for more on how links
are created and detected.

```ts
interface OnLinkPressEvent {
url: string;
}
```

| Type | Platforms |
| ----------------------------------- | --------- |
| `(event: OnLinkPressEvent) => void` | Web |

### `onMentionDetected` {#onmentiondetected}

Called when the
Expand Down
3 changes: 2 additions & 1 deletion docs/docs/rich-text-formatting/links.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,11 @@ while editing an autolinked token breaks it.

## Handling links with events

There are two events that allow you to handle user interaction with links, one in each component.
There are a few events that allow you to handle user interaction with links.

In `EnrichedTextInput`:
- [**`onLinkDetected`**](/api-reference/enriched-text-input#onlinkdetected) fires when the cursor enters or leaves a created link.
- [**`onLinkPress`**](/api-reference/enriched-text-input#onlinkpress) fires when the user clicks a link. Available only on Web.

In `EnrichedText`:
- [**`onLinkPress`**](/api-reference/enriched-text#onlinkpress) fires when the user presses a link.
Expand Down
Loading