config.contentsCss = 'http://www.mysite.com/css/dynamic-styles.css';
CKEDITOR.editorConfig = function( config )
{
config.toolbar_Full =
[
['Source','Preview'],
['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'],
['Link','Unlink','Anchor'],
['Image','Flash','Table','SpecialChar'],
'/',
['Styles','Format','Font','FontSize'],
['TextColor','BGColor']
];
config.height = 600;
config.toolbar = 'Full';
config.resize_enabled = false;
config.language = 'fr';
config.contentsCss = 'http://www.mysite.com/css/dynamic-styles.css';
};
Re: why have an external css file definition ?
found it : I needed to add
config.bodyClass = "content";
to the config file - "content" is the class of the wrapper div that holds the dynamic text in my page - the text in the text box in the editor is now formated the same way
but it does seem a bit round-the-houses to use 1 file to format the text and then have to write all the classes into the styles combo config, too.
Re: why have an external css file definition ?
It would be MUCH much simpler and easier if the stylescombo box could automatically pull the style names / definitions directly from the external CSS file without this added step.
Or is this already possible and I am just missing it?
Re: why have an external css file definition ?
Instead of editing a config file, I just put my configuration directly in my javascript file with the intent of moving it over later if need be (the syntax is different, and that is why). By adding the css file, all the style drop downs came across as being styled correctly. Very nice.
Here's my config so far:
var editor = CKEDITOR.replace( 'story_body', { toolbar : [ ['Source'], ['PasteFromWord','-', 'Scayt'], ['RemoveFormat', '-', 'Bold','Italic','Underline','Strike','-','Subscript','Superscript'], ['NumberedList','BulletedList' ], ['Link','Unlink','Anchor'], ['Image', 'HorizontalRule', 'CreateDiv'], ['Format'], ], height : 500, bodyClass : "editor_body", contentsCss : '/stylesheets/screen.css' } ); .....I had to modify my css to have the default body get reset to what I expected to see as my screen.css sets a color and align to the body tag:
body.editor_body, body.cke_ltr { background-color: white; margin: 0; text-align: left; } body.editor_body { padding: 5px; }Re: why have an external css file definition ?
Re: why have an external css file definition ?
sample page