此文對如何自訂 Fck Editor 做了一些介紹.
原文來自 : http://www.smart-thinker.com/Default.aspx?tabid=1070&EntryID=35
Objective: I wanted to customize the look of the FCK Editor on PokerDIY and allow users to select poker card icons as custom smileys in all modules that use the Rich HTML Editor, for example, Private Messages, the Poker Forums (in particular) and on all Wall posts (for example on Poker Player Profiles and Event Walls).
After reading my web usability book ("Steve Krug - Don't make me think!", highly recommend!) I also wanted to remove a lot of the options that the average poker player cares little about - e.g. "Paste from Word", "Tables" and the ubiquitous "Add Flash Object" ("Does a Flash Object beat a Straight?").
You can see the end result in the screenshot, or log in to PokerDIY and make a Wall post on your Wall to see the customized FCK editor (click on the Smileys icon to open the new smileys).
Lets start with adding a nice set of custom smileys - namely my cool poker cards! This is fairly simple to do (the hardest part was finding the right file to change and fighting my browser cache) :
FCKConfig.SmileyPath = FCKConfig.BasePath + 'images/smiley/msn/' ;
FCKConfig.SmileyImages = ['regular_smile.gif','sad_smile.gif','wink_smile.gif','teeth_smile.gif','thumbs_up.gif','heart.gif','broken_heart.gif','kiss.gif','envelope.gif'] ;
FCKConfig.SmileyColumns = 8 ;
FCKConfig.SmileyWindowWidth = 320 ;
FCKConfig.SmileyWindowHeight = 240 ;
You need to customize this to your new folder, for example, I changed mine to use my new icons in the "poker" folder (I copied the existing ones from "MSN" to "Poker" as they were nice too - I have removed some for clarity's sake):
FCKConfig.SmileyPath = FCKConfig.BasePath + 'images/smiley/poker/' ;
FCKConfig.SmileyImages = ['spade2.gif','spade3.gif','spade4.gif','spade5.gif','spade6.gif','spade7.gif','spade8.gif','broken_heart.gif','kiss.gif','envelope.gif'] ;
FCKConfig.SmileyColumns = 13 ;
FCKConfig.SmileyWindowWidth = 500 ;
FCKConfig.SmileyWindowHeight = 350 ;
I also increased the width, height and number of columns (13 spaded in a deck!) to make it more user-friendly.
Thats all there is to it - my users are going to love that - now on to the reduced toolbar:
Firstly, I want to mention Tom Kraak's article on customizing FCK toolbars - this is worth reading first to get an idea of how the process works. We going to go one step further and customize the buttons on one of the toolbars.
We are going to start with the Basic toolbar as it is the simplest already (you could modify any/all of them of course).
Here is the original Basic toolbar
FCKConfig.ToolbarSets["Basic"] = [
['Smiley','Bold','Italic','-','OrderedList','UnorderedList','-','Link','Unlink','-','About']
and here is my PokerDIY toolbar with the icons I wanted (I grabbed them from the options above and edited the file). You can see the scaled down toolbar in the screenshot below or log on to PokerDIY to test it.
FCKConfig.ToolbarSets["Basic"] = [
['FitWindow','Link','Unlink','-','Smiley','Image','Table','-','Bold','Italic','Underline','StrikeThrough','-','OrderedList','UnorderedList'],
['FontName','FontSize','TextColor','BGColor'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull','-','About']
Save the file and ensure that your Rich Text boxes are displaying the Basic editor (if this is the one you modified).
Notes:
Hope this helps someone...