~ubuntu-branches/ubuntu/natty/moin/natty-updates

« back to all changes in this revision

Viewing changes to wiki/htdocs/applets/FCKeditor/editor/_source/classes/fcktoolbarfontformatcombo.js

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard
  • Date: 2008-06-22 21:17:13 UTC
  • mto: This revision was merged to the branch mainline in revision 18.
  • Revision ID: james.westby@ubuntu.com-20080622211713-inlv5k4eifxckelr
Import upstream version 1.7.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * FCKeditor - The text editor for internet
 
3
 * Copyright (C) 2003-2005 Frederico Caldeira Knabben
 
4
 * 
 
5
 * Licensed under the terms of the GNU Lesser General Public License:
 
6
 *              http://www.opensource.org/licenses/lgpl-license.php
 
7
 * 
 
8
 * For further information visit:
 
9
 *              http://www.fckeditor.net/
 
10
 * 
 
11
 * "Support Open Source software. What about a donation today?"
 
12
 * 
 
13
 * File Name: fcktoolbarfontformatcombo.js
 
14
 *      FCKToolbarPanelButton Class: Handles the Fonts combo selector.
 
15
 * 
 
16
 * File Authors:
 
17
 *              Frederico Caldeira Knabben (fredck@fckeditor.net)
 
18
 */
 
19
 
 
20
var FCKToolbarFontFormatCombo = function( tooltip, style )
 
21
{
 
22
        this.Command    = FCKCommands.GetCommand( 'FontFormat' ) ;
 
23
        this.Label              = this.GetLabel() ;
 
24
        this.Tooltip    = tooltip ? tooltip : this.Label ;
 
25
        this.Style              = style ? style : FCK_TOOLBARITEM_ICONTEXT ;
 
26
        
 
27
        this.NormalLabel = 'Normal' ;
 
28
        
 
29
        this.PanelWidth = 190 ;
 
30
}
 
31
 
 
32
// Inherit from FCKToolbarSpecialCombo.
 
33
FCKToolbarFontFormatCombo.prototype = new FCKToolbarSpecialCombo ;
 
34
 
 
35
FCKToolbarFontFormatCombo.prototype.GetLabel = function()
 
36
{
 
37
        return FCKLang.FontFormat ;
 
38
}
 
39
 
 
40
FCKToolbarFontFormatCombo.prototype.CreateItems = function( targetSpecialCombo )
 
41
{
 
42
        // Get the format names from the language file.
 
43
        var aNames = FCKLang['FontFormats'].split(';') ;
 
44
        var oNames = {
 
45
                p               : aNames[0],
 
46
                pre             : aNames[1],
 
47
                address : aNames[2],
 
48
                h1              : aNames[3],
 
49
                h2              : aNames[4],
 
50
                h3              : aNames[5],
 
51
                h4              : aNames[6],
 
52
                h5              : aNames[7],
 
53
                h6              : aNames[8],
 
54
                div             : aNames[9]
 
55
        } ;
 
56
 
 
57
        // Get the available formats from the configuration file.
 
58
        var aTags = FCKConfig.FontFormats.split(';') ;
 
59
        
 
60
        for ( var i = 0 ; i < aTags.length ; i++ )
 
61
        {
 
62
                // Support for DIV in Firefox has been reintroduced on version 2.2.
 
63
//              if ( aTags[i] == 'div' && FCKBrowserInfo.IsGecko )
 
64
//                      continue ;
 
65
                
 
66
                var sTag        = aTags[i] ;
 
67
                var sLabel      = oNames[sTag] ;
 
68
                
 
69
                if ( sTag == 'p' )
 
70
                        this.NormalLabel = sLabel ;
 
71
                
 
72
                this._Combo.AddItem( sTag, '<div class="BaseFont"><' + sTag + '>' + sLabel + '</' + sTag + '></div>', sLabel ) ;
 
73
        }
 
74
}
 
75
 
 
76
if ( FCKBrowserInfo.IsIE )
 
77
{
 
78
        FCKToolbarFontFormatCombo.prototype.RefreshActiveItems = function( combo, value )
 
79
        {
 
80
//              FCKDebug.Output( 'FCKToolbarFontFormatCombo Value: ' + value ) ;
 
81
 
 
82
                // IE returns normal for DIV and P, so to avoid confusion, we will not show it if normal.
 
83
                if ( value == this.NormalLabel )
 
84
                {
 
85
                        if ( combo.Label != '&nbsp;' )
 
86
                                combo.DeselectAll(true) ;
 
87
                }
 
88
                else
 
89
                {
 
90
                        if ( this._LastValue == value )
 
91
                                return ;
 
92
 
 
93
                        combo.SelectItemByLabel( value, true ) ;
 
94
                }
 
95
 
 
96
                this._LastValue = value ;
 
97
        }
 
98
}
 
 
b'\\ No newline at end of file'