Hi all,
I found that changing the editor's stylesheet is very simple: edit fckconfig.js and set up FCKConfig.EditorAreaCSS with the path to your customized stylesheet.
Tested on pc (XP Pro sp1):
FF 1.0.4: don't read the a classes
IE 6: works fine
NN 7.2: don't read the a classes
Opera 7: FCKEditor not supported
Bye
Fri, 09/16/2005 - 01:16
#1
RE: custom StyleSheet for editorarea
Or you can do this / should be able to this:
I got this hint from an anonymous one on how to enable dynamic style class switching for the editor body tag.
******************************************
in fckconfig.js use the lines
------------------------------------
FCKConfig.EditorAreaClassName = 'classname';
FCKConfig.EditorAreaID = 'id';
------------------------------------
On the page that you use it you can do
FCKEditor.Config['EditorAreaClassName'] = 'classname';
******************************************
the hint above was posted at:
http://sourceforge.net/tracker/index.ph ... tid=543656
I have tested this and manage to switch the className for the body tag using:
function switchClass(theclass){
var oFCK;
if (navigator.appName=="Netscape")
oFCK = MyTextarea___Frame.contentWindow;
else
oFCK = MyTextarea___Frame;
oFCK.FCK.EditorDocument.body.className = theclass;
}
I created two buttons in my page, each with a call to the function above with the class name as argument.
This actually works nice even without any use of:
EditorAreaClassName in the fckconfig.js file.
What I need now is a way to set the className when initializing the editor. And I need to do it from the page that contains the editor and not fckconfig.js file.
I tried this:
oFCKeditor.Config['EditorAreaClassName'] = 'divtest';
and this:
oFCKeditor.Config.EditorAreaClassName = 'divtest';
before this line:
oFCKeditor.ReplaceTextarea();
None of those two lines seemed to work.
Anyone with an idea how I set the className of the editor BODY at startup of page?
RE: custom StyleSheet for editorarea
Sorry.... my mistake... Was'nt that easy... but allmost:
Got this from Brett Gardner.....
You need to change the javascript files that write the editor.
/fck/editor/js/fckeditorcode_gecko_1.js - for mozilla and
/fck/editor/js/fckeditorcode_ie_1.js for internet explorer
The lines you need to add in and where you add them in are on the page
http://sourceforge.net/tracker/index.ph ... tid=543656
RE: custom StyleSheet for editorarea
Okay. Another way of doing it. Could not make workaround above work:
In the page you display the editor put this function:
function FCKeditor_OnComplete( editorInstance ) {
var oFCK;
if (navigator.appName=="Netscape")
oFCK = MyTextarea___Frame.contentWindow;
else
oFCK = MyTextarea___Frame;
oFCK.FCK.EditorDocument.body.className='class';
}
change MyTextarea to name of your editor as well as class to name of your class.
Function above is called when editor has finished loading.
What you can do with this:
1. Set editor BODY nameClass to a custom class.
2.Then, if you now list all available classes for the editor body in a dropdown outside the editor and uses a similar function as the one above, the page editor can change the body class without refreshing the page.
This solution does not need any hack in the .js files nor in the fckconfig.js.
It has one drawback though.... the editor first show content without the class applied.
But it works...
I would prefer to do it as described in link below though:
http://sourceforge.net/tracker/index.ph ... tid=543656
but I could not make that work.....
If anyone have made that code work... please post it here... I want to make it work to.....
RE: custom StyleSheet for editorarea
RE: custom StyleSheet for editorarea
I'm not able to make your workaround work.
Are you using 2.0 version or something else?
Is it possible for you to send me copies of the files involved?
(if so send it to: nauticat39sloop at yahoo dot com)