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