Have setSource take a callback argument:
editor.setSource = function(callback) {
    // do editor things
    callback();
}
Then pass the next block of code to be executed as a callback:
editor.setSource(function() {
    // do some other things
});
If you have access to jQuery's deferred objects, you can make use of them here:
- Make a new deferred object.
- Start the timeout to do your long task.
- Return the deferred object.
- In the timeout, once the task is complete, call deferred.resolve.
 
editor = {
    setSource: function() {
        var deferred = $.Deferred();
        console.log("Beginning editor.setSource...");
        setTimeout(function() {
            // This function took a while to occur
            deferred.resolve();
        }, 3000);
        return deferred;
    }
}
$.when(editor.setSource()).then(function() {
    console.log("Editor is done!");
});
If you're doing AJAX or animation or another jQuery task that uses deferred objects already, you can just return its result value instead of making your own deferred object:
editor = {
    setSource: function() {
        return $.get({
            url: "myurl.com/mypage",
            data: $("#myform").serialize()
        });
    }
}
$.when(editor.setSource()).then(function() {
    console.log("Editor is done!");
});
Make sure to look up how you can either resolve or reject deferred objects, and how to handle those.