Problem
I want to wrap some plain text in a Vue component dynamically, using mouseUp after selecting the text.
For example: <div> Hello World! </div>
=> <div> <Greeting/> World! </div>
Aprox solution
Right now, I'm wrapping it using document.createElement("span")
and surrounding the range of the selection with it.
I have found similar questions like the next one, but I'm trying to avoid render level:
How can I dynamically wrap a substring with a component in Vue.js?