2
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
3
* Copyright (C) 2003-2010 Frederico Caldeira Knabben
7
* Licensed under the terms of any of the following licenses at your
10
* - GNU General Public License Version 2 or later (the "GPL")
11
* http://www.gnu.org/licenses/gpl.html
13
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
14
* http://www.gnu.org/licenses/lgpl.html
16
* - Mozilla Public License Version 1.1 or later (the "MPL")
17
* http://www.mozilla.org/MPL/MPL-1.1.html
21
* FCKToolbarPanelButton Class: Handles the Fonts combo selector.
24
var FCKToolbarFontsCombo = function( tooltip, style )
26
this.CommandName = 'FontName' ;
27
this.Label = this.GetLabel() ;
28
this.Tooltip = tooltip ? tooltip : this.Label ;
29
this.Style = style ? style : FCK_TOOLBARITEM_ICONTEXT ;
31
this.DefaultLabel = FCKConfig.DefaultFontLabel || '' ;
34
// Inherit from FCKToolbarSpecialCombo.
35
FCKToolbarFontsCombo.prototype = new FCKToolbarFontFormatCombo( false ) ;
37
FCKToolbarFontsCombo.prototype.GetLabel = function()
42
FCKToolbarFontsCombo.prototype.GetStyles = function()
44
var baseStyle = FCKStyles.GetStyle( '_FCK_FontFace' ) ;
48
alert( "The FCKConfig.CoreStyles['Size'] setting was not found. Please check the fckconfig.js file" ) ;
54
var fonts = FCKConfig.FontNames.split(';') ;
56
for ( var i = 0 ; i < fonts.length ; i++ )
58
var fontParts = fonts[i].split('/') ;
59
var font = fontParts[0] ;
60
var caption = fontParts[1] || font ;
62
var style = FCKTools.CloneObject( baseStyle ) ;
64
style.SetVariable( 'Font', font ) ;
65
style.Label = caption ;
67
styles[ caption ] = style ;
73
FCKToolbarFontsCombo.prototype.RefreshActiveItems = FCKToolbarStyleCombo.prototype.RefreshActiveItems ;
75
FCKToolbarFontsCombo.prototype.StyleCombo_OnBeforeClick = function( targetSpecialCombo )
77
// Clear the current selection.
78
targetSpecialCombo.DeselectAll() ;
80
var startElement = FCKSelection.GetBoundaryParentElement( true ) ;
84
var path = new FCKElementPath( startElement ) ;
86
for ( var i in targetSpecialCombo.Items )
88
var item = targetSpecialCombo.Items[i] ;
89
var style = item.Style ;
91
if ( style.CheckActive( path ) )
93
targetSpecialCombo.SelectItem( item ) ;