Subscript
Subscript can be used in a wide range such as references and symbols and also in equations.
toggleSubscript #
To make the selection of your content as a subscript you can use toggleSubscript
function.
isSubcript #
This function help you to find out if the current character is subscript or not. The returend boolean will update on cursor moves.
Example #
An example of toggleSubscript
and isSubcript
usage:
Customization #
By default, the SUBSCRIPT
key represent the subscript 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 subscript inline style, you have to pass the updated version of style map to the editor. Here is an example: