-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add style option to custom controls #126
base: master
Are you sure you want to change the base?
Conversation
…ng them in the events example
…a fallback to the name if none is specified
…g custom header controls
What do you think about this PR @niuware? |
…ure/custom-component-style
@niuware you've made changes since this PR has been created. I've merged these changes. Could you please check this PR out? |
Is this still ongoing ? Seems blocked. I would like to add a "CENTER" (alignment) custom control, without success |
Up, useful feature that allows customization of the default controls, it is kind of like undocumented feature now. |
did you get a solution for this? |
I'm using mui-rte as a rich text editor and I've integrated it nicely with the rest of my Material UI React application. There are some things I want to configure about the editor. This PR is about one of those things.
Instead of the default 'title' control, I want to make use of several header controls. They are default supported by Draft.js but not by mui-rte. I hoped to simply provide a custom control to mui-rte with the proper style specified, so Draft.js will do the rest (e.g.
header-one
,header-two
). This unfortunately was not an option.For custom controls in mui-rte you can't specify the style. You can specify the name, which in turn is used as the style, but it is transformed to upper case first. So the
header-one
name would become theHEADER-ONE
style and Draft.js won't interpret that as the header one block.With this PR, I've added the
style
option to the custom component so you can optionally specify the style of a custom control explicitly. If none is specified, it falls back to the component name, but it doesn't transform it to upper case. Along with the change I updated the custom controls example to show the use of theheader-one
–header-three
.