Ideally, yes, it should work for both. There is a way to get and set the cursor position in the RTE. I don't know if it's technically possible to do so via a Joplin plugin (I haven't tried).