CKEditor Exception Demo

HTML

<script src="//cdn.ckeditor.com/4.4.7/standard/ckeditor.js"></script>
<div id="editor1" autocomplete="off" autocorrect="off" role="group" aria-label="Rich Text Editor - type your response."></div>

JavaScript

CKEDITOR.on('instanceReady', function (ev) {
    var doc = editor.document.$;
    var win = editor.document.getWindow().$;
    
    var s = '<style>body.cke_editable {' +
        'position: absolute;' +
	    'overflow: auto;' +
        'top: .3em;' +
	    'bottom: .3em;' +
    	'left: .3em;' +
	    'right: .3em;' +        
        '}</style>';

    if(doc == document){
        console.log('*** Inline');
        $('head').append(s);
    }else{
        console.log('*** iFrame');
        $('.cke_wysiwyg_frame').contents().find('head').append(s);
    }
    

});

var editor = CKEDITOR.appendTo('editor1');