Custom inline styles
While contenido
try to provide everything for you as a developer, there may be some cases
that you need to do something that isn't provided. Here is a list of provided utilities to
manipulate the inline styles:
- Bold
- Italic
- Underline
- Line through
- Overline
- Subscript
- Superscript
There are some other docs in this section (inline styles) like Color and Text Transform that are totally based on this.
Custom style map #
When you need inline styles rather than bold, italic and underline; you have to add the style key and the relevant css of that to the style map and pass it to the editor. It's a good idea to spread the current inline styles first and then add yours.
toggleInlineStyle #
When you added your style key and CSS to the style map you can use the toggleInlineStyle
utility
to toggle your style on the selected part of your text.
hasInlineStyleOf #
This function help you to find out if the current character has your style or not. The returend boolean will update on cursor moves.
Example #
This is an example of toggleInlineStyle
and hasInlineStyleOf
utilities where we want to
colorize the selected text with the #4cb5f5 color and make it bold.