.container {
display: flex;
flex-direction: column;
outline: none;
}
.edit-area {
border-right: solid rgba(0,0,0,0) 1px;
outline: none;
min-height: 19px;
}
<div class="container" contenteditable>
<div class="edit-area" contenteditable>
Delete this text
</div>
<div contenteditable="false">x</div>
</div>
There is the potential to go down quite the rabbit hole on this one. I've seen solutions with 100's of lines of javascript.
I found the trick is to separate the x from the contenteditable.
I also add the alpha zero border right to force the block to render. In this case it works without it because of the flex box, but I've seen other cases where it just doesn't work without it - so I thought I'd share.
The min-height is also important to force it not to disappear when height goes to 0 if content is deleted.
I also wrapped the whole thing in a contenteditable to prove the point that it does work as a child of a contenteditable container.
Essentially this enables you to have an empty contenteditable and retain the flashing cursor.