Hi, I'm new to the FCKeditor but have managed to get it up and running quickly on a php platform after first having installed openwysiwyg which wasn't bad but lacked cross browser compatibility.
What I would like to do, something that I used with openwysiwyg but can't seem to find on FCK, is change the look of multiple textareas on a page (Title, text, caption etc) so that it reflects the stylesheets for each component on my site.
Obviously I could have all these elements show up correctly in one textarea by attaching a css and applying the right styles to each element, but this site requires multiple table entries.
To resume, I have managed to create the multiple textareas on my page like this :
{
var oFCKeditorTit = new FCKeditor( 'tit','450','100','Title' ) ;
var oFCKeditorTxt = new FCKeditor( 'txt','450','200','Text' ) ;
...
and configure these in fckconfig.js :
FCKConfig.ToolbarSets["Title"] = [
['FontSize',...
FCKConfig.ToolbarSets["Text"] = [
['Bold',...
this works fine but I would like each of these blocks to carry the correct styles (different fonts, colours etc) when editing.
Can anybody help me on this one?
Thank's, Everlyn
What I would like to do, something that I used with openwysiwyg but can't seem to find on FCK, is change the look of multiple textareas on a page (Title, text, caption etc) so that it reflects the stylesheets for each component on my site.
Obviously I could have all these elements show up correctly in one textarea by attaching a css and applying the right styles to each element, but this site requires multiple table entries.
To resume, I have managed to create the multiple textareas on my page like this :
{
var oFCKeditorTit = new FCKeditor( 'tit','450','100','Title' ) ;
var oFCKeditorTxt = new FCKeditor( 'txt','450','200','Text' ) ;
...
and configure these in fckconfig.js :
FCKConfig.ToolbarSets["Title"] = [
['FontSize',...
FCKConfig.ToolbarSets["Text"] = [
['Bold',...
this works fine but I would like each of these blocks to carry the correct styles (different fonts, colours etc) when editing.
Can anybody help me on this one?
Thank's, Everlyn
Re: Multiple textareas styles on same page please!
OK I found a (the?) solution.
You have to interact with the editor instances via an API :
http://docs.fckeditor.net/FCKeditor_2.x ... Script_API
in this example the function builds 2 editor instances and tweaks the styles of each instance via the API :
window.onload = function()
{
var oFCKeditorTit = new FCKeditor( 'lib','450','100','Titre' ) ;
var oFCKeditorTxt = new FCKeditor( 'chapo','450','200','Texte' ) ;
oFCKeditorTit.BasePath = '/admin/fckeditor/' ;
oFCKeditorTit.ReplaceTextarea() ;
oFCKeditorTxt.BasePath = '/admin/fckeditor/' ;
oFCKeditorTxt.ReplaceTextarea() ;
}
fCount = 0;
function FCKeditor_OnComplete( editorInstance ) {
if(fCount == 1) {
oEditor1 = FCKeditorAPI.GetInstance('lib') ;
oEditor1.EditorDocument.body.style.cssText += 'font-family: 'Courier New', Arial, Verdana, Sans-Serif; font-size: 12px;' ;
oEditor2 = FCKeditorAPI.GetInstance('chapo') ;
oEditor2.EditorDocument.body.style.cssText += 'font-size: 18px;' ;
}
fCount+=1;
}
Because the function is called each time an editor instance has finished loading we must wait until all the instances are loaded before running the function, hence the if condition. There's undoubtedly a cleaner way of doing this, but hey, it works.
Hope this is useful to somebody.
Everlyn
Re: Multiple textareas styles on same page please!
If you don't want to use a CSS file then you can set the FCKConfig.EditorAreaStyles configuration option for each of the editor instances you create.
Re: Multiple textareas styles on same page please!
Keep up the useful posts.
Everlyn