[ Index ]
 

Code source de FCKeditor 2.4

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/editor/_source/classes/ -> fcktoolbarfontformatcombo.js (source)

   1  /*
   2   * FCKeditor - The text editor for Internet - http://www.fckeditor.net
   3   * Copyright (C) 2003-2007 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   * File Name: fcktoolbarfontformatcombo.js
  22   *     FCKToolbarPanelButton Class: Handles the Fonts combo selector.
  23   * 
  24   * File Authors:
  25   *         Frederico Caldeira Knabben (www.fckeditor.net)
  26   */
  27  
  28  var FCKToolbarFontFormatCombo = function( tooltip, style )
  29  {
  30      this.CommandName = 'FontFormat' ;
  31      this.Label        = this.GetLabel() ;
  32      this.Tooltip    = tooltip ? tooltip : this.Label ;
  33      this.Style        = style ? style : FCK_TOOLBARITEM_ICONTEXT ;
  34      
  35      this.NormalLabel = 'Normal' ;
  36      
  37      this.PanelWidth = 190 ;
  38  }
  39  
  40  // Inherit from FCKToolbarSpecialCombo.
  41  FCKToolbarFontFormatCombo.prototype = new FCKToolbarSpecialCombo ;
  42  
  43  
  44  FCKToolbarFontFormatCombo.prototype.GetLabel = function()
  45  {
  46      return FCKLang.FontFormat ;
  47  }
  48  
  49  FCKToolbarFontFormatCombo.prototype.CreateItems = function( targetSpecialCombo )
  50  {
  51      var oTargetDoc = targetSpecialCombo._Panel.Document ;
  52  
  53      // Add the Editor Area CSS to the panel to create a realistic preview.
  54      FCKTools.AppendStyleSheet( oTargetDoc, FCKConfig.ToolbarComboPreviewCSS ) ;
  55  
  56      // Add ID and Class to the body
  57      if ( FCKConfig.BodyId && FCKConfig.BodyId.length > 0 )
  58          oTargetDoc.body.id = FCKConfig.BodyId ;
  59      if ( FCKConfig.BodyClass && FCKConfig.BodyClass.length > 0 )
  60          oTargetDoc.body.className += ' ' + FCKConfig.BodyClass ;
  61  
  62      // Get the format names from the language file.
  63      var aNames = FCKLang['FontFormats'].split(';') ;
  64      var oNames = {
  65          p        : aNames[0],
  66          pre        : aNames[1],
  67          address    : aNames[2],
  68          h1        : aNames[3],
  69          h2        : aNames[4],
  70          h3        : aNames[5],
  71          h4        : aNames[6],
  72          h5        : aNames[7],
  73          h6        : aNames[8],
  74          div        : aNames[9]
  75      } ;
  76  
  77      // Get the available formats from the configuration file.
  78      var aTags = FCKConfig.FontFormats.split(';') ;
  79      
  80      for ( var i = 0 ; i < aTags.length ; i++ )
  81      {
  82          // Support for DIV in Firefox has been reintroduced on version 2.2.
  83  //        if ( aTags[i] == 'div' && FCKBrowserInfo.IsGecko )
  84  //            continue ;
  85          
  86          var sTag    = aTags[i] ;
  87          var sLabel    = oNames[sTag] ;
  88          
  89          if ( sTag == 'p' )
  90              this.NormalLabel = sLabel ;
  91          
  92          this._Combo.AddItem( sTag, '<div class="BaseFont"><' + sTag + '>' + sLabel + '</' + sTag + '></div>', sLabel ) ;
  93      }
  94  }
  95  
  96  if ( FCKBrowserInfo.IsIE )
  97  {
  98      FCKToolbarFontFormatCombo.prototype.RefreshActiveItems = function( combo, value )
  99      {
 100  //        FCKDebug.Output( 'FCKToolbarFontFormatCombo Value: ' + value ) ;
 101  
 102          // IE returns normal for DIV and P, so to avoid confusion, we will not show it if normal.
 103          if ( value == this.NormalLabel )
 104          {
 105              if ( combo.Label != '&nbsp;' )
 106                  combo.DeselectAll(true) ;
 107          }
 108          else
 109          {
 110              if ( this._LastValue == value )
 111                  return ;
 112  
 113              combo.SelectItemByLabel( value, true ) ;
 114          }
 115  
 116          this._LastValue = value ;
 117      }
 118  }


Généré le : Sun Feb 25 15:28:05 2007 par Balluche grâce à PHPXref 0.7