score:0

you can directly add an inline style into the new editor state by using: editorstate.setinlinestyleoverride.

so it would look like this:

handlemousedown(symbol) {
    let newstate = this.inserttext(symbol);
    editorstate.setinlinestyleoverride(newstate, orderedset.of('subscript'));
        
    this.setstate({ editorstate: newstate });
}

Related Query

More Query from same tag