Value to React view
See original GitHub issueDo you want to request a feature or report a bug?
Feature
What’s the current behavior?
If you want to display rich text edited by Slate in React, you have to use the html serializer, and then put it as the html content of some div. If you want to use a custom component, you can’t do this.
It would be great if there was a stripped-down “react serializer component” that takes a value
(result of .toJSON()
) and some rules
and then can be used as a regular component.
It would be even greater if it would not need Immutable to do this.
What’s the expected behavior?
<SlateValue value={value} rules={rules} />
puts the edited text where it’s mounted, using the components defined in the rules
.
If there is already something like this somewhere, it would be great if that could be made into a package for slate.
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
Displaying Data | React
The most basic thing you can do with a UI is display some data. React makes it easy to display data and automatically...
Read more >View - React Native
Represents the current value of a component. It can be a textual description of a component's value, or for range-based components, such as ......
Read more >Components and Props - React
Components let you split the UI into independent, reusable pieces, and think about each piece in isolation. This page provides an introduction to...
Read more >Component State - React
What does setState do? setState() schedules an update to a component's state object. When state changes, the component responds by re-rendering.
Read more >Thinking in React
React is, in our opinion, the premier way to build big, fast Web apps with JavaScript. It has scaled very well for us...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We made slateToReact.js which converts from slate JSON representation to a React tree.
slate-html-serializer
, except that it works on the JSON and not the Immutable object.getLeaves
but just uses theleaves
arrayI believe that this may be fixed by https://github.com/ianstormtaylor/slate/pull/3093, which has changed a lot of the logic in Slate and
slate-react
especially. I’m going to close this out, but as always, feel free to open a new issue if it persists for you. Thanks for understanding.