source: extensions/FCKEditor/editor/_source/classes/fcktoolbarfontsizecombo.js @ 3295

Last change on this file since 3295 was 3295, checked in by patdenice, 15 years ago

New extension added:
FCK Editor (2.0.a)

File size: 2.1 KB
Line 
1/*
2 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
3 * Copyright (C) 2003-2009 Frederico Caldeira Knabben
4 *
5 * == BEGIN LICENSE ==
6 *
7 * Licensed under the terms of any of the following licenses at your
8 * choice:
9 *
10 *  - GNU General Public License Version 2 or later (the "GPL")
11 *    http://www.gnu.org/licenses/gpl.html
12 *
13 *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
14 *    http://www.gnu.org/licenses/lgpl.html
15 *
16 *  - Mozilla Public License Version 1.1 or later (the "MPL")
17 *    http://www.mozilla.org/MPL/MPL-1.1.html
18 *
19 * == END LICENSE ==
20 *
21 * FCKToolbarPanelButton Class: Handles the Fonts combo selector.
22 */
23
24var FCKToolbarFontSizeCombo = function( tooltip, style )
25{
26        this.CommandName        = 'FontSize' ;
27        this.Label              = this.GetLabel() ;
28        this.Tooltip    = tooltip ? tooltip : this.Label ;
29        this.Style              = style ? style : FCK_TOOLBARITEM_ICONTEXT ;
30
31        this.DefaultLabel = FCKConfig.DefaultFontSizeLabel || '' ;
32
33        this.FieldWidth = 70 ;
34}
35
36// Inherit from FCKToolbarSpecialCombo.
37FCKToolbarFontSizeCombo.prototype = new FCKToolbarFontFormatCombo( false ) ;
38
39FCKToolbarFontSizeCombo.prototype.GetLabel = function()
40{
41        return FCKLang.FontSize ;
42}
43
44FCKToolbarFontSizeCombo.prototype.GetStyles = function()
45{
46        var baseStyle = FCKStyles.GetStyle( '_FCK_Size' ) ;
47
48        if ( !baseStyle )
49        {
50                alert( "The FCKConfig.CoreStyles['FontFace'] setting was not found. Please check the fckconfig.js file" ) ;
51                return {} ;
52        }
53
54        var styles = {} ;
55
56        var fonts = FCKConfig.FontSizes.split(';') ;
57
58        for ( var i = 0 ; i < fonts.length ; i++ )
59        {
60                var fontParts = fonts[i].split('/') ;
61                var font = fontParts[0] ;
62                var caption = fontParts[1] || font ;
63
64                var style = FCKTools.CloneObject( baseStyle ) ;
65                style.SetVariable( 'Size', font ) ;
66                style.Label = caption ;
67
68                styles[ caption ] = style ;
69        }
70
71        return styles ;
72}
73
74FCKToolbarFontSizeCombo.prototype.RefreshActiveItems = FCKToolbarStyleCombo.prototype.RefreshActiveItems ;
75
76FCKToolbarFontSizeCombo.prototype.StyleCombo_OnBeforeClick = FCKToolbarFontsCombo.prototype.StyleCombo_OnBeforeClick ;
Note: See TracBrowser for help on using the repository browser.