don't use a public memoization of the selection in the editor
use textContent instead of stripping HTML in undo