ckeditor demo

by pj_js15

HTML

<script src="//cdn.ckeditor.com/4.5.1/standard/ckeditor.js"></script>
<textarea name="editor1" id="editor1" rows="10" cols="80"></textarea>

JavaScript

// Replace the <textarea id="editor1"> with a CKEditor
// instance, using default configuration.
CKEDITOR.editorConfig = function (config) {
console.log('test:', config);
    config.language = 'es';
    config.uiColor = '#F7B42C';
    config.height = 500;
    config.toolbarCanCollapse = false;
    // ALLOW <i></i>
		//config.protectedSource.push(/<span[^>]*><\/span>/g);
    //config.allowedContent = true;
    //config.extraAllowedContent = 'p(*)[*]{*};div(*)[*]{*};li(*)[*]{*};ul(*)[*]{*}';
    //CKEDITOR.dtd.$removeEmpty.i = 0;
    //config.extraAllowedContent = 'u;span{color}'
    
    //CKEDITOR.dtd.$removeEmpty.span = 0; 
		//CKEDITOR.dtd.$removeEmpty.i = 0;
};

CKEDITOR.dtd.$removeEmpty.span = 0;

//CKEDITOR.replace('editor1');

CKEDITOR.replace('editor1', {
      extraAllowedContent: 'p{text-align}(*); span{*}[*](*); div{*}[*](*); strong(*); em(*); b(*); i(*); u(*); sup(*); sub(*); ul{*}[*](*); ol{*}[*](*); li{*}[*](*); a[!href](*); br(*); hr(*); img{*}[*](*); iframe(*)'
      //'u;span{color};div'
    });