Use element.isContentEditable. Preserve contenteditable undo stack.