Very slick and great filesize. I've been working on a wysiwyg document editor and am very tempted to use this. My only problem is with contenteditable in general, which is hard to convince to use <p>'s. I'm rolling my own paste function and optimistic about getting the functionality you have, but definitely not in 5k ;)
Also, do you have any idea of a resource for valid/invalid nesting rules for inline and block elements? I'm currently sanitizing to keep block elements at the top level.
I realize your rolling your own, but if you are interested in an available editor, we have SnapEditor which does exactly that.
One of the core features is that it keeps the nesting of blocks and tables consistent. All P, H1, H2, etc. tags are always at the top level. If they are not (for example, after a Paste), we automatically fix the HTML so that it is. In this way, you always have consistent, predictable, HTML which makes it easy to style and reason about.
It also works both as a form-based editor (traditional) or an inline editor (like Aloha editor).
Also, do you have any idea of a resource for valid/invalid nesting rules for inline and block elements? I'm currently sanitizing to keep block elements at the top level.