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
This commit adds a new prop for LiveEditor - - which lets you define how the tab key should work.
If you pass the value indentation (the default), everything will work as it has. If you pass focus, however, you'll be able to tab on to the next or previous item in the tab order
Our reported bundle size badges don't give you the full picture of
@@ -175,16 +166,15 @@ Sucrase for transpilation.
175
166
This component provides the `context` for all the other ones. It also transpiles the user’s code!
176
167
It supports these props, while passing any others through to the `children`:
177
168
178
-
|Name|PropType|Description|
179
-
|---|---|---|
180
-
|code|PropTypes.string|The code that should be rendered, apart from the user’s edits
181
-
|scope|PropTypes.object|Accepts custom globals that the `code` can use
182
-
|noInline|PropTypes.bool|Doesn’t evaluate and mount the inline code (Default: `false`). Note: when using `noInline` whatever code you write must be a single expression (function, class component or some `jsx`) that can be returned immediately. If you'd like to render multiple components, use `noInline={true}`
183
-
|transformCode|PropTypes.func|Accepts and returns the code to be transpiled, affording an opportunity to first transform it
184
-
|language|PropTypes.string|What language you're writing for correct syntax highlighting. (Default: `jsx`)
185
-
|disabled|PropTypes.bool|Disable editing on the `<LiveEditor />` (Default: `false`)
186
-
|theme|PropTypes.object|A `prism-react-renderer` theme object. See more [here](https://github.com/FormidableLabs/prism-react-renderer#theming)
| code | PropTypes.string | The code that should be rendered, apart from the user’s edits |
172
+
| scope | PropTypes.object | Accepts custom globals that the `code` can use |
173
+
| noInline | PropTypes.bool | Doesn’t evaluate and mount the inline code (Default: `false`). Note: when using `noInline` whatever code you write must be a single expression (function, class component or some `jsx`) that can be returned immediately. If you'd like to render multiple components, use `noInline={true}`|
174
+
| transformCode | PropTypes.func | Accepts and returns the code to be transpiled, affording an opportunity to first transform it |
175
+
| language | PropTypes.string | What language you're writing for correct syntax highlighting. (Default: `jsx`) |
176
+
| disabled | PropTypes.bool | Disable editing on the `<LiveEditor />` (Default: `false`) |
177
+
| theme | PropTypes.object | A `prism-react-renderer` theme object. See more [here](https://github.com/FormidableLabs/prism-react-renderer#theming)|
188
178
189
179
All subsequent components must be rendered inside a provider, since they communicate
190
180
using one.
@@ -197,10 +187,10 @@ with valid JSX elements.
197
187
198
188
This component renders the editor that displays the code. It is a wrapper around [`react-simple-code-editor`](https://github.com/satya164/react-simple-code-editor) and the code highlighted using [`prism-react-renderer`](https://github.com/FormidableLabs/prism-react-renderer).
199
189
200
-
|Name|PropType|Description|
201
-
|---|---|---|
202
-
|style|PropTypes.object|Allows overriding default styles on the `LiveEditor` component.
| code | PropTypes.string | Reflects the code that is passed in as the `code` prop |
223
+
| error | PropTypes.string | An error that the code has thrown when it was previewed |
224
+
| onError | PropTypes.func | A callback that, when called, changes the error to what's passed as the first argument |
225
+
| onChange | PropTypes.func | A callback that accepts new code and transpiles it |
226
+
| element | React.Element | The result of the transpiled code that is previewed |
239
227
240
228
> Note: The code prop doesn't reflect the up-to-date code, but the `code` prop, that is passed to the `LiveProvider`.
241
229
242
-
243
230
## FAQ
244
-
> **I want to use experimental feature x but Sucrase doesn't support it! Can I use babel instead?**
245
-
246
-
`react-live` doesn't currently support configuring the transpiler and it ships with Sucrase. The current workaround for using some experimental features `Sucrase` doesn't support would be to use the `transformCode` prop on `LiveProvider` to transform your code with `babel` alongside `Sucrase`.
247
231
232
+
> **I want to use experimental feature x but Sucrase doesn't support it! Can I use babel instead?**
248
233
234
+
`react-live` doesn't currently support configuring the transpiler and it ships with Sucrase. The current workaround for using some experimental features `Sucrase` doesn't support would be to use the `transformCode` prop on `LiveProvider` to transform your code with `babel` alongside `Sucrase`.
249
235
250
236
## Comparison to [component-playground](https://github.com/FormidableLabs/component-playground)
251
237
@@ -266,5 +252,4 @@ Here are the various factors at play:
266
252
267
253
## Maintenance Status
268
254
269
-
**Active:** Formidable is actively working on this project, and we expect to continue for work for the foreseeable future. Bug reports, feature requests and pull requests are welcome.
270
-
255
+
**Active:** Formidable is actively working on this project, and we expect to continue for work for the foreseeable future. Bug reports, feature requests and pull requests are welcome.
0 commit comments