Changeset 5230


Ignore:
Timestamp:
03/09/10 22:42:20 (5 years ago)
Author:
alfonsoml
Message:

#5150 Allow to specify names in the CKEDITOR.config.colorButton_colors

Location:
CKEditor/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • CKEditor/trunk/CHANGES.html

    r5229 r5230  
    4141        <ul> 
    4242                <li><a href="http://dev.fckeditor.net/ticket/4478">#4478</a> : Enable the SelectAll command in source mode.</li> 
     43                <li><a href="http://dev.fckeditor.net/ticket/5150">#5150</a> : Allow names in the CKEDITOR.config.colorButton_colors setting.</li> 
    4344        </ul> 
    4445        <p> 
  • CKEditor/trunk/_source/plugins/colorbutton/plugin.js

    r5221 r5230  
    123123                                        output.push( '</tr><tr>' ); 
    124124 
    125                                 var colorCode = colors[ i ]; 
     125                                var parts = colors[ i ].split( '/' ), 
     126                                        colorName = parts[ 0 ], 
     127                                        colorCode = parts[ 1 ] || colorName; 
     128 
     129                                // The data can be only a color code (without #) or colorName + color code 
     130                                // If only a color code is provided, then the colorName is the color with the hash 
     131                                if (!parts[1]) 
     132                                        colorName = '#' + colorName; 
     133 
    126134                                var colorLabel = editor.lang.colors[ colorCode ] || colorCode; 
    127135                                output.push( 
     
    129137                                                '<a class="cke_colorbox" _cke_focus=1 hidefocus=true' + 
    130138                                                        ' title="', colorLabel, '"' + 
    131                                                         ' onclick="CKEDITOR.tools.callFunction(', clickFn, ',\'#', colorCode, '\',\'', type, '\'); return false;"' + 
     139                                                        ' onclick="CKEDITOR.tools.callFunction(', clickFn, ',\'', colorName, '\',\'', type, '\'); return false;"' + 
    132140                                                        ' href="javascript:void(\'', colorLabel, '\')"' + 
    133141                                                        ' role="option" aria-posinset="', ( i + 2 ), '" aria-setsize="', total, '">' + 
     
    173181 * Defines the colors to be displayed in the color selectors. It's a string 
    174182 * containing the hexadecimal notation for HTML colors, without the "#" prefix. 
     183 * 
     184 * Since 3.3: A name may be optionally defined by prefixing the entries with the 
     185 * name and the slash character. For example, "FontColor1/FF9900" will be 
     186 * displayed as the color #FF9900 in the selector, but will be outputted as "FontColor1". 
    175187 * @type String 
    176188 * @default '000,800000,8B4513,2F4F4F,008080,000080,4B0082,696969,B22222,A52A2A,DAA520,006400,40E0D0,0000CD,800080,808080,F00,FF8C00,FFD700,008000,0FF,00F,EE82EE,A9A9A9,FFA07A,FFA500,FFFF00,00FF00,AFEEEE,ADD8E6,DDA0DD,D3D3D3,FFF0F5,FAEBD7,FFFFE0,F0FFF0,F0FFFF,F0F8FF,E6E6FA,FFF' 
     
    178190 * // Brazil colors only. 
    179191 * config.colorButton_colors = '00923E,F8C100,28166F'; 
     192 * @example 
     193 * config.colorButton_colors = 'FontColor1/FF9900,FontColor2/0066CC,FontColor3/F00' 
    180194 */ 
    181195CKEDITOR.config.colorButton_colors = 
Note: See TracChangeset for help on using the changeset viewer.
© 2003 – 2012 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy