2
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
3
* Copyright (C) 2003-2009 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 FCKToolbarFontFormatCombo = function( tooltip, style )
26
if ( tooltip === false )
29
this.CommandName = 'FontFormat' ;
30
this.Label = this.GetLabel() ;
31
this.Tooltip = tooltip ? tooltip : this.Label ;
32
this.Style = style ? style : FCK_TOOLBARITEM_ICONTEXT ;
34
this.NormalLabel = 'Normal' ;
36
this.PanelWidth = 190 ;
38
this.DefaultLabel = FCKConfig.DefaultFontFormatLabel || '' ;
41
// Inherit from FCKToolbarSpecialCombo.
42
FCKToolbarFontFormatCombo.prototype = new FCKToolbarStyleCombo( false ) ;
44
FCKToolbarFontFormatCombo.prototype.GetLabel = function()
46
return FCKLang.FontFormat ;
49
FCKToolbarFontFormatCombo.prototype.GetStyles = function()
53
// Get the format names from the language file.
54
var aNames = FCKLang['FontFormats'].split(';') ;
65
div : aNames[9] || ( aNames[0] + ' (DIV)')
68
// Get the available formats from the configuration file.
69
var elements = FCKConfig.FontFormats.split(';') ;
71
for ( var i = 0 ; i < elements.length ; i++ )
73
var elementName = elements[ i ] ;
74
var style = FCKStyles.GetStyle( '_FCK_' + elementName ) ;
77
style.Label = oNames[ elementName ] ;
78
styles[ '_FCK_' + elementName ] = style ;
81
alert( "The FCKConfig.CoreStyles['" + elementName + "'] setting was not found. Please check the fckconfig.js file" ) ;
87
FCKToolbarFontFormatCombo.prototype.RefreshActiveItems = function( targetSpecialCombo )
89
var startElement = FCK.ToolbarSet.CurrentInstance.Selection.GetBoundaryParentElement( true ) ;
93
var path = new FCKElementPath( startElement ) ;
94
var blockElement = path.Block ;
98
for ( var i in targetSpecialCombo.Items )
100
var item = targetSpecialCombo.Items[i] ;
101
var style = item.Style ;
103
if ( style.CheckElementRemovable( blockElement ) )
105
targetSpecialCombo.SetLabel( style.Label ) ;
112
targetSpecialCombo.SetLabel( this.DefaultLabel ) ;
115
FCKToolbarFontFormatCombo.prototype.StyleCombo_OnBeforeClick = function( targetSpecialCombo )
117
// Clear the current selection.
118
targetSpecialCombo.DeselectAll() ;
120
var startElement = FCK.ToolbarSet.CurrentInstance.Selection.GetBoundaryParentElement( true ) ;
124
var path = new FCKElementPath( startElement ) ;
125
var blockElement = path.Block ;
127
for ( var i in targetSpecialCombo.Items )
129
var item = targetSpecialCombo.Items[i] ;
130
var style = item.Style ;
132
if ( style.CheckElementRemovable( blockElement ) )
134
targetSpecialCombo.SelectItem( item ) ;