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: README.md
+19-8Lines changed: 19 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -194,7 +194,7 @@ output === "You are owner in this workspace."
194
194
195
195
`ditto-react` integrates with Ditto Plurals to support pluralized text. Learn how to create and configure Ditto Plurals here: https://www.dittowords.com/docs/pluralization.
196
196
197
-
*Note: Pluralization will only work if the source file is in the `structured` format.*
197
+
_Note: Pluralization will only work if the source file is in the `structured` format._
198
198
199
199
When a text item has plural forms, the default plural form will be used when that text item is rendered normally:
200
200
@@ -245,13 +245,22 @@ To see a working React app utilizing the [Ditto CLI](https://github.com/dittowor
245
245
246
246
## Rich Text
247
247
248
-
Ditto's [rich text](https://www.dittowords.com/docs/rich-text) functionality is currently available for Ditto Components in `ditto-react`. By using the `richText` property on `<Ditto />` or `<DittoComponent />`, `ditto-react` will automatically render the rich text versions of the components.
248
+
Ditto's [rich text](https://www.dittowords.com/docs/rich-text) functionality can be enabled on `<Ditto />`, `<DittoText />` or `<DittoComponent />` via the `richText` property. Once enabled, `ditto-react` will automatically render the rich text versions of the text item/component.
|`componentId`| string | The API ID of a component in your component library. If a `variant` prop is passed to an ancestor `DittoProvider`, will attempt to display the specified variant's value for the passed `componentId`; otherwise, will default to displaying base text. |
293
-
|`variables`| object (optional) | A map of variable key-value pairs to interpolate in your text. |
294
-
|`count`| number (optional) | This value is used to specify which plural case you wish to use |
|`componentId`| string | The API ID of a component in your component library. If a `variant` prop is passed to an ancestor `DittoProvider`, will attempt to display the specified variant's value for the passed `componentId`; otherwise, will default to displaying base text. |
302
+
|`variables`| object (optional) | A map of variable key-value pairs to interpolate in your text. |
303
+
|`count`| number (optional) | This value is used to specify which plural case you wish to use |
304
+
|`richText`| boolean (optional) | This value is used to enable rich text rendering |
295
305
296
306
##### Example
297
307
@@ -314,6 +324,7 @@ Which method you use depends on how you've configured your CLI options. Please r
314
324
|`filters`| object (optional) | object of filters for text items returned. Currently supports a single parameter: tags, an array of tag strings | { tags: ["SELECTS"]} |
315
325
|`variables`| object (optional) | A map of variable key-value pairs to interpolate in your text. | { email: "support@dittowords.com" } |
316
326
|`count`| number (optional) | This value is used to specify which plural case you wish to use | 1 |
327
+
|`richText`| boolean (optional) | This value is used to enable rich text rendering |
Copy file name to clipboardExpand all lines: example/src/ditto/ditto-component-library__base.json
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
"role": {
3
3
"name": "Role DO NOT MODIFY",
4
4
"text": "You are {{role}} in this workspace.",
5
-
"rich_text": "<p>You are <span data-type=\"variable\" data-grammarly-skip class=\"\" data-variable-id=\"64e52580e5120107e7d21260\" data-name=\"role\" data-text=\"an administrator\" data-variable-type=\"map\">an administrator</span> in this workspace.</p>",
5
+
"rich_text": "<p>You are {{role}} in this workspace.</p>",
6
6
"status": "NONE",
7
7
"folder": null,
8
8
"variables": {
@@ -17,7 +17,7 @@
17
17
"shopping-cart-2": {
18
18
"name": "Shopping Cart 2 DO NOT MODIFY",
19
19
"text": "The cart is filled with {{item}}.",
20
-
"rich_text": "<p>The <strong>cart is filled</strong> with <span data-type=\"variable\" data-grammarly-skip class=\"\" data-variable-id=\"64e5250c4f28ef74fe4fd2b4\" data-name=\"item\" data-text=\"oranges\" data-variable-type=\"list\">oranges</span>.</p>",
20
+
"rich_text": "<p>The <strong>cart is filled</strong> with {{item}}.</p>",
21
21
"status": "NONE",
22
22
"folder": null,
23
23
"variables": {
@@ -31,7 +31,7 @@
31
31
"shopping-cart": {
32
32
"name": "Shopping Cart DO NOT MODIFY",
33
33
"text": "There are {{itemCount}} items in the cart",
34
-
"rich_text": "<p>There are <span data-type=\"variable\" data-grammarly-skip class=\"\" data-variable-id=\"61e72483efde2400db6ac3cb\" data-name=\"itemCount\" data-text=\"10\" data-variable-type=\"number\">10</span> items <b>in the cart</b></p>",
34
+
"rich_text": "<p>There are {{itemCount}} items <b>in the cart</b></p>",
35
35
"status": "NONE",
36
36
"folder": null,
37
37
"variables": {
@@ -42,9 +42,9 @@
42
42
},
43
43
"plurals": {
44
44
"other": "There are {{itemCount}} items in the cart",
45
-
"other_rich_text": "<p>There are <span data-type=\"variable\" data-grammarly-skip class=\"\" data-variable-id=\"61e72483efde2400db6ac3cb\" data-name=\"itemCount\" data-text=\"10\" data-variable-type=\"number\">10</span> items <b>in the cart</b></p>",
45
+
"other_rich_text": "<p>There are {{itemCount}} items <b>in the cart</b></p>",
46
46
"one": "There is {{itemCount}} item in the cart",
47
-
"one_rich_text": "<p>There is <span data-type=\"variable\" data-grammarly-skip class=\"\" data-variable-id=\"61e72483efde2400db6ac3cb\" data-name=\"itemCount\" data-text=\"10\" data-variable-type=\"number\">10</span> item in the cart</p>",
47
+
"one_rich_text": "<p>There is {{itemCount}} item in the cart</p>",
0 commit comments