How to do add/change functionality without a config.js file?

Jan 3, 2014 at 8:18 PM
Curious how something like this:

Adding a Rule to config.js is possible using the latest CKEditor on DNN?
CKEDITOR.on('instanceReady', function (ev) {
// Ends self closing tags the HTML4 way, like <br>.
            $: function (element) {
                // Output dimensions of images as width and height
                if ( == 'img') {
                    var style =;

                    if (style) {
                        // Get the width from the style.
                        var match = /(?:^|\s)width\s*:\s*(\d+)px/i.exec(style),
                            width = match && match[1];

                        // Get the height from the style.
                        match = /(?:^|\s)height\s*:\s*(\d+)px/i.exec(style);
                        var height = match && match[1];

                        if (width) {
                   =^|\s)width\s*:\s*(\d+)px;?/i, '');
                            element.attributes.width = width;

                        if (height) {
                   =^|\s)height\s*:\s*(\d+)px;?/i, '');
                            element.attributes.height = height;
Specifically we aim to remove the style attribute on images and replace it with specific height/width attributes instead. (we're using the CK Editor on a bootstrap 3 based site and are having issues with the editor adding in inline styles for images).

Thanks in advance for any direction or support on this one.
Jan 11, 2014 at 3:32 PM
In version 2.00.09 (BETA 1 released today). You can define a custom js file. For exactly your solution. This file will be loaded with the editor.
Marked as answer by tha_watcha on 1/11/2014 at 7:47 AM