We're evaluating CMS platform for using it in our projects - BetterCMS. Overall it is nice CMS, just API is quite weak so far, especially client side API.

What we needed is to add custom plugin to HTML editor they are using - CKEditor. Problem was, that you need to pass plugin configuration to CKEditor before it creates instance, after instance is created, your plugin won't be registered. I was searching for a way to do it for quite some time, as long as there was no API event, that would fire before CKEditor instance will be created, there was no direct way to override BetterCMS configuration and if I would configure CKEditor very early, better CMS would overwrite that configuration with its own.

Solution turns out is pretty simple, when you start to think in javascript:

  // CKEDITOR.replace is a function, that creates editor instance
  // so we save reference to original function
  var replaceFunction = CKEDITOR.replace;

  // then override it 
  CKEDITOR.replace = function (elementOrIdOrName, config) {

            // configure as we wish
            // ...
            // finally run original function
            return replaceFunction(elementOrIdOrName, config);
Comments javascript  BetterCMS