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
RichText: Add a format prop to allow HTML string values to be used in RichText components (WordPress#6034)
* RichText: Add a format prop to allow HTML string values to be used in RichText components
* Don't align params and returns docs
* Add domToFormat function to factorize ternaries
* Remove useless stringToElement
* Add valueToString to avoid ternaries when converting to strings
* Avoid double isEmpty check
* Use valid HTML in unit tests
* Fix splitting
Copy file name to clipboardExpand all lines: blocks/rich-text/README.md
+10-4Lines changed: 10 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,11 +10,17 @@ a traditional `input` field, usually when the user exits the field.
10
10
11
11
## Properties
12
12
13
-
### `value: Array`
13
+
### `format: String`
14
14
15
-
*Required.*Array of React DOM to make editable. The rendered HTML should be valid, and valid with respect to the `tagName` and `inline` property.
15
+
*Optional.*Format of the RichText provided value prop. It can be `element` or `string`.
16
16
17
-
### `onChange( value: Array ): Function`
17
+
*Default: `element`*.
18
+
19
+
### `value: Array|String`
20
+
21
+
*Required.* Depending on the format prop, this value could be an array of React DOM to make editable or an HTML string. The rendered HTML should be valid, and valid with respect to the `tagName` and `inline` property.
22
+
23
+
### `onChange( value: Array|String ): Function`
18
24
19
25
*Required.* Called when the value changes.
20
26
@@ -31,7 +37,7 @@ a traditional `input` field, usually when the user exits the field.
31
37
32
38
*Optional.* By default, a line break will be inserted on <kbd>Enter</kbd>. If the editable field can contain multiple paragraphs, this property can be set to `p` to create new paragraphs on <kbd>Enter</kbd>.
0 commit comments