Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
titleJavascript to call FCKEditor
borderStylesolid

<textarea id="myeditor" name="myeditor" wrap="virtual/>

<script type="text/javascript">
    var name = 'myeditor';
    var base_url = window.location.href;
    base_url = base_url.substring(0,base_url.indexOf('/tag.'));
    var editor = new FCKeditor(name,'100%','400','Default') ;
    editor.BasePath= base_url + '/fckeditor/';
    var worker_url = '<xsl:value-of select="$baseWorkerURL"/>';
    editor.Width = '400px';
    editor.Height = 400px';
    editor.Config['BaseHref'] = base_url + '/' + worker_url + '<xsl:value-of select="$base"/>';
    editor.Config['CustomConfigurationsPath'] = base_urleditor.BasePath + '/media/edu/iastate/ait/theme/theme_configmyconfig.js';
    var link_url = worker_url + '&amp;ServerPath=<xsl:value-of select="$base"/>';
    var image_url = link_url + '&amp;Type=Image';
    image_url = image_url.replace(/amp;/gi,'');
    link_url = link_url.replace(/amp;/gi,'');
    editor.Config['ImageBrowserURL'] = editor.BasePath +     
        'editor/filemanager/browser/default/browser.html?Connector=../../../../../' + image_url;
    editor.Config['LinkBrowserURL'] = editor.BasePath +     
        'editor/filemanager/browser/default/browser.html?Connector=../../../../../' + link_url;
    editor.ReplaceTextarea() ;
</script>

Note that there are a number of configuration parameters that can be set globally in your myconfig.js or locally for each editor as shown here.

Customizations to the Basic Editor

FCKEditor provides for a large number of customizations. For example, in myconfig.js you can control the menu options that appear:

Code Block
titleChanging Menu Options
borderStylesolid

FCKConfig.ToolbarSets["Default"] = [
	['Source','DocProps','-','Save','NewPage','Preview','-','Templates'],
	['Cut','Copy','Paste','PasteText','PasteWord','-','Print','SpellCheck'],
	['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
	['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'],
	['OrderedList','UnorderedList','-','Outdent','Indent'],
	['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'],
	['Link','Unlink','Anchor'],
	['Image','Table','Rule','Smiley','SpecialChar','UniversalKey','Comment'/*,'Placeholder'*/],
	//['Form','Checkbox','Radio','TextField','Textarea','Select','Button','ImageButton','HiddenField'],
	['TextColor','BGColor'],
	['About'],
	'/',
	['Style','FontFormat','FontName','FontSize']
] ;

FCKConfig.ToolbarSets["Basic"] = [
	['Bold','Italic','-','OrderedList','UnorderedList','-','Link','Unlink','-','About']
] ;

A simple and fully-loaded toolbar set are defined above. I have commented out the form options because my users don't need them for building simple HTML. However, you can choose which icons to include on the tool bar. Each array is a collection of tools that are grouped together. The dash give some space between them. You specify the toolbar in the new FCKEditor function (see previous Javascript example).

Initial fonts, pulldown items and colors can all be specified in this file.

Image and Link Browsing

Adding Plugins