I managed to find a working solution that stores the instance once it's ready and uses that for any future calls...
ck_instance: null,
set_background: function(hex) {
if (this.ck_instance === null) {
if (typeof CKEDITOR !== "object") { return; }
this.ck_instance = CKEDITOR.instances['body'];
if (typeof this.ck_instance !== "object") { return; }
this.ck_instance.on('instanceReady', function(e) {
// First time
e.editor.document.getBody().setStyle('background-color', hex);
// in case the user switches to source and back
e.editor.on('contentDom', function() {
e.editor.document.getBody().setStyle('background-color', hex);
});
});
return;
}
// First time
this.ck_instance.document.getBody().setStyle('background-color', hex);
// in case the user switches to source and back
this.ck_instance.on('contentDom', function() {
this.ck_instance.document.getBody().setStyle('background-color', hex);
});
}
Both required firings are working now, once on form load to set the saved background in the new editor, and again by way of the colour pickers change callback.