Underline
Making the text underlined help you to somehow highlight your text. You should be aware that the other usecase of the underlined text is to indicate a links and you need to keep the styles differences tangible for this two.
toggleUnderline #
To make the selection of your content underlined you can use toggleUnderline
function.
It'll toggle between underlined and not underlined automatically.
isUnderline #
This function help you to find out if the current character is underline or not. The returend boolean will update on cursor moves.
Example #
An example of toggleUnderline
and isUnderline
usage:
Customization #
By default, the UNDERLINE
key represent the underlined inline style. For any reason if you need
to change this key to something else, you can pass your custom key to the previous functions as
the third parameter.
Also if you changed the default key for the underline inline style, you have to pass the updated version of style map to the editor. Here is an example: