Add style option to custom controls #126
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
.