Hi,
I use this code so when the user clicks on the "div"... It loads CKEditor... This works... The problem is that it does not apply the css:
Only the first time that it loads:
Here is the full code:
Thanks in advance for any help.
I use this code so when the user clicks on the "div"... It loads CKEditor... This works... The problem is that it does not apply the css:
is.addCss('body { margin:0 0 0 0.5px; padding:0; font-family:' + Page.getStyle('font-family') + '; font-size:' + Page.getStyle('font-size') + ';}');
Only the first time that it loads:
window.editor = loadCKE($$('.module-editBlock')[0]);
Here is the full code:
function loadCKE(edit){
var Page = $('page');
var is = CKEDITOR.replace(edit,
{
sharedSpaces :
{
top : 'controls-bar'
},
docType: '<!DOCTYPE HTML>',
resize_enabled : false,
startupFocus : true,
toolbarCanCollapse : false,
toolbar : [
['Save'],
['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print', 'SpellChecker', 'Scayt'],
['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
['NumberedList','BulletedList','-','Outdent','Indent','Blockquote','CreateDiv'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
'/',
['Styles','Format','Font','FontSize'],
['TextColor','BGColor'],
['ShowBlocks'],
['Link','Unlink','Anchor'],
['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak']
]
})
is.addCss('body { margin:0 0 0 0.5px; padding:0; font-family:' + Page.getStyle('font-family') + '; font-size:' + Page.getStyle('font-size') + ';}');
return is;
}
window.editor = loadCKE($$('.module-editBlock')[0]);
$$('.module-editBlock').addEvent('click', function(el){
window.editor.destroy();
window.editor = loadCKE(this);
});
Thanks in advance for any help.

Re: Problem with addCss()
CKEDITOR.on( 'instanceReady', function( e ){ var Page = $('page'); e.editor.addCss('body {margin:0 0 0 0.5px; padding:0; font-family:' + Page.getStyle('font-family') + '; font-size:' + Page.getStyle('font-size') + ';}'); });The CSS is still no apply... I don't know why... Too me it does not make any sense.
Re: Problem with addCss()
Here is the code:
var editor; function replaceDiv( div ) { if ( editor ) editor.destroy(); editor = CKEDITOR.replace( div ); editor.addCss('body {margin:0 0 0 0.5px; padding:0; font-family:Arial,Helvetica,sans-serif; font-size:14.4px;}'); }Re: Problem with addCss()
viewtopic.php?f=11&t=15672
Re: Problem with addCss()
Here is the solution:
CKEDITOR.on( 'instanceCreated', function( e ){ e.editor.addCss(CSS); });