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
Copy file name to clipboardExpand all lines: docs/docs/core-functionalities/handling-events.md
+53-1Lines changed: 53 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,4 +4,56 @@ sidebar_position: 3
4
4
5
5
# Handling events
6
6
7
-
<!-- TODO: write content for this page -->
7
+
Since the input is [uncontrolled](/fundamentals/core-concepts#the-input-is-uncontrolled),
8
+
events are how you observe it. You change content by calling ref methods; you
9
+
react to changes by listening to the callbacks below.
10
+
11
+
Full payload shapes of the available callbacks can be found in the `EnrichedTextInput` reference.
12
+
13
+
## Content
14
+
15
+
-**`onChangeText`** - plain-text content changed.
16
+
-**`onChangeHtml`** - the HTML changed.
17
+
18
+
:::tip
19
+
20
+
The `onChangeHtml` callbacks has to parse the content into HTML on every keystroke.
21
+
This is a heavy, computational operation, which might slow down your app's performance. Consider using the `getHTML()` ref method instead if it meets your requirements.
22
+
23
+
:::
24
+
25
+
## Selection and style state
26
+
27
+
-**`onChangeSelection`** - the cursor moved or the selection changed. Gives you
28
+
`start`, `end`, and the selected `text`. Useful for range-based methods like
29
+
[`setLink`](/rich-text-formatting/links).
30
+
-**`onChangeState`** - the active styles at the cursor changed. This is the
31
+
event that drives a toolbar by using reported `isActive`, `isBlocking`, and
32
+
`isConflicting`, plus the current `alignment`. See the
33
+
[style state model](/fundamentals/core-concepts#the-style-state-model).
34
+
35
+
## Focus
36
+
37
+
-**`onFocus`** / **`onBlur`** - the input gained or lost focus.
38
+
39
+
## Mentions
40
+
41
+
-**`onStartMention`** - a mention started being edited.
42
+
-**`onChangeMention`** - the query after the indicator changed.
43
+
-**`onEndMention`** - editing a mention stopped.
44
+
-**`onMentionDetected`** - the cursor entered or left a mention.
45
+
46
+
## Links
47
+
48
+
-**`onLinkDetected`** - the cursor entered or left a link.
49
+
50
+
## Images
51
+
52
+
-**`onPasteImages`** - the user pasted one or more images; hands you each
53
+
image's data so you can upload and insert them with
On web, the default behavior of the pressed `<a>` tag is suppressed. To navigate to the link's URL, you need to properly handle the `onLinkPress` event.
66
+
67
+
:::
68
+
69
+
## Try it out
70
+
71
+
Format some text in the editor, then press **Render** - the current HTML is read
72
+
with `getHTML()` and handed to an `EnrichedText` below.
On iOS and Android, `EnrichedText` does not sanitize HTML for you. Sanitize anything you render that
79
+
came from users or other untrusted sources. To know more about the web's built-in sanitization, visit [Web support](/core-functionalities/web-support#sanitization).
Copy file name to clipboardExpand all lines: docs/docs/core-functionalities/styling-the-input.md
+77-1Lines changed: 77 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,4 +4,80 @@ sidebar_position: 1
4
4
5
5
# Styling the input
6
6
7
-
<!-- TODO: write content for this page -->
7
+
`EnrichedTextInput` is styled through two separate props. Together they cover
8
+
everything from the container's dimensions down to the color of a bullet point.
9
+
10
+
-**`style`** - the container's layouting behavior and its base typography (`fontSize`, `color`, `fontFamily`, …). It accepts a subset of React Native's `TextStyle`, described by
11
+
`EnrichedInputStyle`.
12
+
-**`htmlStyle`** - the appearance of individual rich text elements: heading
13
+
sizes, blockquote borders, code colors, list markers, mention colors, and so
0 commit comments