This is why I'm so fucking angry at the state of contenteditable. It could have been awesome, but its a complete disaster. If you want anything good (say, autoembedding youtube videos) you essentially have to use text area and fake the whole thing. Like managing cursor state and switching elements.