Convert text editor to custom element

Closes #3732

This PR builds on #3734 to implement commands properly, so they should be merged in order.