Hello i have a realy strange problem. When the form is submited, CKEditor removes all inline styles.
Here is my config:
/**
* @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.editorConfig = function(config) {
// Define changes to default configuration here. For example:
// config.language = 'fr';
// config.uiColor = '#AADC6E';
config.filebrowserBrowseUrl = $('#baseURL').val() + 'web/admin/js/lib/elfinder/elfinder.php?baseurl=' + $('#baseURL').val();
config.toolbar = 'Minimal';
config.toolbar_Minimal =
[
{name: 'document', items: ['Source']},
{name: 'clipboard', items: ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo']},
{name: 'basicstyles', items: ['Bold', 'Italic', 'Underline', 'Strike']},
{name: 'paragraph', items: ['NumberedList', 'BulletedList', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock']},
{name: 'links', items: ['Link', 'Unlink']},
{name: 'insert', items: ['Image', 'Table', 'HorizontalRule']},
{name: 'styles', items: ['Format', 'FontSize', 'Styles']},
{name: 'colors', items: ['TextColor', 'BGColor']},
{name: 'tools', items: ['Maximize']}
];
config.smiley_path = $('#baseURL').val() + 'web/smileys/';
config.smiley_images = [
'angry.gif', 'bigsurprise.gif', 'blank.gif', 'cheese.gif', 'confused.gif', 'downer.gif',
'embarrassed.gif', 'exclaim.gif', 'grin.gif', 'grrr.gif', 'hmm.gif', 'kiss.gif',
'lol.gif', 'longface.gif', 'mad.gif', 'ohh.gif', 'ohoh.gif', 'question.gif',
'rasberry.gif', 'rolleyes.gif', 'shade_cheese.gif', 'shade_grin.gif', 'shade_hmm.gif', 'shade_mad.gif',
'shade_smile.gif', 'shade_smirk.gif', 'shock.gif', 'shuteye.gif', 'sick.gif', 'smile.gif', 'smirk.gif', 'snake.gif', 'surprise.gif',
'tongue_laugh.gif', 'tongue_rolleye.gif', 'tongue_wink.gif', 'vampire.gif', 'wink.gif', 'zip.gif'
];
config.language = 'bg';
config.allowedContent = true;
config.entities = true;
config.toolbar_Comment =
[
{name: 'basicstyles', items: ['Bold', 'Italic', 'Underline', 'Strike']},
{name: 'links', items: ['Link', 'Unlink']},
{name: 'colors', items: ['TextColor', 'BGColor', 'Smiley']},
{name: 'tools', items: ['Maximize']}
];
};
CKEDITOR.on('instanceReady', function(ev) {
// Ends self closing tags the HTML4 way, like <br>.
ev.editor.dataProcessor.htmlFilter.addRules(
{
elements:
{
$: function(element) {
// Output dimensions of images as width and height
if (element.name == 'img') {
var style = element.attributes.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];
// Get the float from the style.
match = /(?:^|\s)float\s*:\s*(\w+)/i.exec(style);
var float = match && match[1];
if (width) {
element.attributes.style = element.attributes.style.replace(/(?:^|\s)width\s*:\s*(\d+)px;?/i, '');
element.attributes.width = width;
}
if (height) {
element.attributes.style = element.attributes.style.replace(/(?:^|\s)height\s*:\s*(\d+)px;?/i, '');
element.attributes.height = height;
}
if (float) {
element.attributes.style = element.attributes.style.replace(/(?:^|\s)float\s*:\s*(\w+)/i, '');
element.attributes.align = float;
}
}
}
return element;
}
}
});
});