Reputation: 2523
I have been working on this Material UI Rich Text Editor over here
https://www.npmjs.com/package/material-ui-rte
I'm trying to follow best practices for both React and Material-UI so that anyone can pick it up and drop it in their project and it just works with Material
I'm having an issue where after running my build script and trying to actually import the editor into a project, I'm not getting any theme passed into the components in the editor, so palette colors or font families are not being represented in the editor at all which I thought they would be
When actually cloning the repo and running the start
script, playing with the demo works with the theme when pulling the Editor
from the src component but pulling it in from the lib
directory like a normal use case would does not work with the theme.
Here is a codesandbox to illustrate this, I've set the theme to have a text color of lime green and the editor is not rendering this color at all. But if you clone and run the actual repo, the editor does use the lime color
https://codesandbox.io/embed/create-react-app-dw7gh
I would love some direction on this. Am I doing something wrong or missing something that material expects? Did I set up my build script wrong?
Upvotes: 3
Views: 659
Reputation: 8681
The theme propagation relies on a singleton to work. I would encourage the usage of @material-ui/styles as a peer dependency. Right now, it seems that you publish it: https://unpkg.com/[email protected]/lib/index.js. You should change that.
Upvotes: 1