DEV Community

[Comment from a deleted post]
Collapse
 
daviddalbusco profile image
David Dal Busco

Good point 👍

To summarized the answer: you found an issue!

It's a bug or something I have on purpose left aside now 😉.

A couple of weeks / months after I implemented this solution and published the blog post, I also activated back again the usage of document.execCommand in my Web Component. With a property I can toggle between it and this custom implementation.

There is a discussion on Stack Overflow about the deprecation and a user pointed out the replacement might be Input Events Level 2.

So for the time being I use execCommand and if sudently it becomes removed from the browsers, I'll toggle to my custom made solution (while loosing undo / redo) and then I'll then check if I improve the solution (fix such bugs as the one you found) or migrate to a new API.

Collapse
 
medboo profile image
medboo

Thank you David for your answer, I thought maybe you've found a workaround for it, so, I think the only thing left for me now is to try to figure it out, with a hackish (maybe?) way, will see ;)

 
daviddalbusco profile image
David Dal Busco

Keep me posted, sounds super interesting what you are doing!