2 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
\r
3 * Copyright (C) 2003-2009 Frederico Caldeira Knabben
\r
5 * == BEGIN LICENSE ==
\r
7 * Licensed under the terms of any of the following licenses at your
\r
10 * - GNU General Public License Version 2 or later (the "GPL")
\r
11 * http://www.gnu.org/licenses/gpl.html
\r
13 * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
\r
14 * http://www.gnu.org/licenses/lgpl.html
\r
16 * - Mozilla Public License Version 1.1 or later (the "MPL")
\r
17 * http://www.mozilla.org/MPL/MPL-1.1.html
\r
21 * FCKToolbarPanelButton Class: Handles the Fonts combo selector.
\r
24 var FCKToolbarFontFormatCombo = function( tooltip, style )
\r
26 if ( tooltip === false )
\r
29 this.CommandName = 'FontFormat' ;
\r
30 this.Label = this.GetLabel() ;
\r
31 this.Tooltip = tooltip ? tooltip : this.Label ;
\r
32 this.Style = style ? style : FCK_TOOLBARITEM_ICONTEXT ;
\r
34 this.NormalLabel = 'Normal' ;
\r
36 this.PanelWidth = 190 ;
\r
38 this.DefaultLabel = FCKConfig.DefaultFontFormatLabel || '' ;
\r
41 // Inherit from FCKToolbarSpecialCombo.
\r
42 FCKToolbarFontFormatCombo.prototype = new FCKToolbarStyleCombo( false ) ;
\r
44 FCKToolbarFontFormatCombo.prototype.GetLabel = function()
\r
46 return FCKLang.FontFormat ;
\r
49 FCKToolbarFontFormatCombo.prototype.GetStyles = function()
\r
53 // Get the format names from the language file.
\r
54 var aNames = FCKLang['FontFormats'].split(';') ;
\r
58 address : aNames[2],
\r
65 div : aNames[9] || ( aNames[0] + ' (DIV)')
\r
68 // Get the available formats from the configuration file.
\r
69 var elements = FCKConfig.FontFormats.split(';') ;
\r
71 for ( var i = 0 ; i < elements.length ; i++ )
\r
73 var elementName = elements[ i ] ;
\r
74 var style = FCKStyles.GetStyle( '_FCK_' + elementName ) ;
\r
77 style.Label = oNames[ elementName ] ;
\r
78 styles[ '_FCK_' + elementName ] = style ;
\r
81 alert( "The FCKConfig.CoreStyles['" + elementName + "'] setting was not found. Please check the fckconfig.js file" ) ;
\r
87 FCKToolbarFontFormatCombo.prototype.RefreshActiveItems = function( targetSpecialCombo )
\r
89 var startElement = FCK.ToolbarSet.CurrentInstance.Selection.GetBoundaryParentElement( true ) ;
\r
93 var path = new FCKElementPath( startElement ) ;
\r
94 var blockElement = path.Block ;
\r
98 for ( var i in targetSpecialCombo.Items )
\r
100 var item = targetSpecialCombo.Items[i] ;
\r
101 var style = item.Style ;
\r
103 if ( style.CheckElementRemovable( blockElement ) )
\r
105 targetSpecialCombo.SetLabel( style.Label ) ;
\r
112 targetSpecialCombo.SetLabel( this.DefaultLabel ) ;
\r
115 FCKToolbarFontFormatCombo.prototype.StyleCombo_OnBeforeClick = function( targetSpecialCombo )
\r
117 // Clear the current selection.
\r
118 targetSpecialCombo.DeselectAll() ;
\r
120 var startElement = FCK.ToolbarSet.CurrentInstance.Selection.GetBoundaryParentElement( true ) ;
\r
122 if ( startElement )
\r
124 var path = new FCKElementPath( startElement ) ;
\r
125 var blockElement = path.Block ;
\r
127 for ( var i in targetSpecialCombo.Items )
\r
129 var item = targetSpecialCombo.Items[i] ;
\r
130 var style = item.Style ;
\r
132 if ( style.CheckElementRemovable( blockElement ) )
\r
134 targetSpecialCombo.SelectItem( item ) ;
\r