If your goal is to apply styles to field contents, AFAIK there is no dedicated API for that.
Here is an example of how I went about changing the directionality of selected text in one of my add-ons:
If your goal is to apply styles to field contents, AFAIK there is no dedicated API for that.
Here is an example of how I went about changing the directionality of selected text in one of my add-ons: