How do you avoid losing focus on a contenteditable element when a user clicks outside that element?

Putting Juan's question into an answer, instead of using the click event, you have to use the mousedown event as follows:

$(document).ready(function()
{
    $('#content')[0].contentEditable=true;

    $('#clickThis').bind('mousedown',function(e)
    {
        console.log(window.getSelection().getRangeAt(0).startContainer);
        e.preventDefault();
    });
});

You can see it working here:

http://jsfiddle.net/FKDhe/7/