Skip to content
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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

steurt
Copy link
Contributor

@steurt steurt commented Jun 2, 2020

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 the HEADER-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 the header-one ⁠⁠– header-three.

@steurt steurt changed the title Add style option to custom components Add style option to custom controls Jun 2, 2020
@steurt
Copy link
Contributor Author

steurt commented Jul 22, 2020

What do you think about this PR @niuware?

@steurt
Copy link
Contributor Author

steurt commented Nov 8, 2020

@niuware you've made changes since this PR has been created. I've merged these changes. Could you please check this PR out?

@corneliugaina
Copy link

Is this still ongoing ? Seems blocked. I would like to add a "CENTER" (alignment) custom control, without success

@Bielousov
Copy link

Bielousov commented Apr 12, 2022

Up, useful feature that allows customization of the default controls, it is kind of like undocumented feature now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants