1
Peekay
Custom toolbar sets in FCKeditor
  • 2007/1/25 14:57

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


Content 0.5 comes with the FCKeditor WYSIWYG editor. By default, the 'default' FCKeditor toolbar set is loaded. If you want to create your own custom toolbar, here's what to do...

1) Open the folder 'content/admin/fckeditor'.
2) Make a backup of 'fckconfig.js'.
3) Open 'fckconfig.js' in a text editor.
4) Copy the default tool bar definition (shown below):
FCKConfig.ToolbarSets["Default"] = [
    [
'Source','-','Templates'],
    [
'TextColor','BGColor'],
    [
'Cut','Copy','Paste','PasteText','PasteWord','-','SpellCheck'],
    [
'Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
    [
'Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'],
    [
'OrderedList','UnorderedList','-','Outdent','Indent'],
    [
'JustifyLeft','JustifyCenter','JustifyRight'],
    [
'Link','Unlink','Anchor'],
    [
'Image','Table','Rule','Smiley','SpecialChar','UniversalKey'],
    [
'FontName''FontSize']
] ;

and paste the copy directly below the default definition. (Take care not to chop off any code!)

5) Edit the first line of the pasted version and rename it:
FCKConfig.ToolbarSets["MyToolbar"] = [

6) Add or remove any tools from your new toolbarset. For example, I change 'FontSize' to 'FontFormat' so users can apply heading and paragraph tags. The '-' is a spacer. Be sure not to leave a trailing ',' after the last tool in a row.

7) Save the file.

8) Next, make a backup of 'fckeditor.php' (it's in the same folder).
9) Open 'fckeditor.php' in a text editor.
10) In the function at around line 32, change the toolbarset value:
function FCKeditor$instanceName )
        {
                
$this->InstanceName        $instanceName ;
                
$this->BasePath            '/FCKeditor/' ;
                
$this->Width               '100%' ;
                
$this->Height              '200' ;
                [
color=ff0000]$this->ToolbarSet          'MyToolbar' ;[/color]
                
$this->Value               '' ;

                
$this->Config                = array() ;
        }

11) Save the file.

Please note that if you preview this in Firefox, the cache will result in a JavaScript error saying 'The toolbarset 'MyToolbar' does not exist. Close and re-start Firefox to see the changes.

This may work for other modules too. If someone knows a variation perhaps they can post in this thread.

HTH
A thread is for life. Not just for Christmas.

2
TheFinni
Re: Custom toolbar sets in FCKeditor
  • 2007/1/29 19:40

  • TheFinni

  • Just popping in

  • Posts: 75

  • Since: 2003/11/25


Hi Peekay,

I set a custom toolbar for FCKeditor a little differently. Instead of binding yourself to a particular name "MyToolbar" I made it so every module could set their own custom toolbar name.

I posted a comment/example in an older News article regarding the FCKeditor and Xoopseditor update. I don't know if anyone read it since News comments don't always offer notifications.

My post is a bit lengthy as I also write instructions on how to select your upload directory.

Have a look:

https://xoops.org/modules/news/article.php?storyid=3438

Thomas

3
Peekay
Re: Custom toolbar sets in FCKeditor
  • 2007/1/29 19:53

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


Hi TheFinni,

That sounds like a nice solution. I'm gonna try it.

There should be a FAQ for each editor really so people could post tips. I see a lot of forum posts from people having problems with FCKeditor, particularly image uploads.
A thread is for life. Not just for Christmas.

4
TheFinni
Re: Custom toolbar sets in FCKeditor
  • 2007/1/29 20:00

  • TheFinni

  • Just popping in

  • Posts: 75

  • Since: 2003/11/25


I agree. The information is too spread out. Having a dedicated forum sub-category for each editor would be great.

Let me know how it works for you.

Let me also know what you think about being able to set custom upload directory (if you decide to try it).

I think it would make more sense in the core not to have to restrict oneself to the root/uploads/modulename settings.

Login

Who's Online

311 user(s) are online (105 user(s) are browsing Support Forums)


Members: 0


Guests: 311


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits