Contenteditable fixes

Here are a few changes that improve the behavior in regard to content editable divs.