[ Index ] |
|
Code source de vtiger CRM 5.0.2 |
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: fcktoolbarstylecombo.js 14 * FCKToolbarPanelButton Class: Handles the Fonts combo selector. 15 * 16 * File Authors: 17 * Frederico Caldeira Knabben (fredck@fckeditor.net) 18 */ 19 20 var FCKToolbarStyleCombo = function( tooltip, style ) 21 { 22 this.Command = FCKCommands.GetCommand( 'Style' ) ; 23 this.Label = this.GetLabel() ; 24 this.Tooltip = tooltip ? tooltip : this.Label ; 25 this.Style = style ? style : FCK_TOOLBARITEM_ICONTEXT ; 26 } 27 28 // Inherit from FCKToolbarSpecialCombo. 29 FCKToolbarStyleCombo.prototype = new FCKToolbarSpecialCombo ; 30 31 FCKToolbarStyleCombo.prototype.GetLabel = function() 32 { 33 return FCKLang.Style ; 34 } 35 36 FCKToolbarStyleCombo.prototype.CreateItems = function( targetSpecialCombo ) 37 { 38 // Add the Editor Area CSS to the Styles panel so the style classes are previewed correctly. 39 FCKTools.AppendStyleSheet( targetSpecialCombo._Panel.Document, FCKConfig.EditorAreaCSS ) ; 40 41 targetSpecialCombo._Panel.Document.body.className += ' ForceBaseFont' ; 42 43 // For some reason Gecko is blocking inside the "RefreshVisibleItems" function. 44 if ( ! FCKBrowserInfo.IsGecko ) 45 targetSpecialCombo.OnBeforeClick = this.RefreshVisibleItems ; 46 47 // Add the styles to the special combo. 48 for ( var s in this.Command.Styles ) 49 { 50 var oStyle = this.Command.Styles[s] ; 51 var oItem ; 52 53 if ( oStyle.IsObjectElement ) 54 oItem = targetSpecialCombo.AddItem( s, s ) ; 55 else 56 oItem = targetSpecialCombo.AddItem( s, oStyle.GetOpenerTag() + s + oStyle.GetCloserTag() ) ; 57 58 oItem.Style = oStyle ; 59 } 60 } 61 62 FCKToolbarStyleCombo.prototype.RefreshActiveItems = function( targetSpecialCombo ) 63 { 64 // Clear the actual selection. 65 targetSpecialCombo.DeselectAll() ; 66 67 // Get the active styles. 68 var aStyles = this.Command.GetActiveStyles() ; 69 70 if ( aStyles.length > 0 ) 71 { 72 // Select the active styles in the combo. 73 for ( var i = 0 ; i < aStyles.length ; i++ ) 74 targetSpecialCombo.SelectItem( aStyles[i].Name ) ; 75 76 // Set the combo label to the first style in the collection. 77 targetSpecialCombo.SetLabelById( aStyles[0].Name ) ; 78 } 79 else 80 targetSpecialCombo.SetLabel('') ; 81 } 82 83 FCKToolbarStyleCombo.prototype.RefreshVisibleItems = function( targetSpecialCombo ) 84 { 85 if ( FCKSelection.GetType() == 'Control' ) 86 var sTagName = FCKSelection.GetSelectedElement().tagName ; 87 88 for ( var i in targetSpecialCombo.Items ) 89 { 90 var oItem = targetSpecialCombo.Items[i] ; 91 if ( ( sTagName && oItem.Style.Element == sTagName ) || ( ! sTagName && ! oItem.Style.IsObjectElement ) ) 92 oItem.style.display = '' ; 93 else 94 oItem.style.display = 'none' ; // For some reason Gecko is blocking here. 95 } 96 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 10:22:19 2007 | par Balluche grâce à PHPXref 0.7 |