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 * FCKStyleCommand Class: represents the "Style" command.
\r
24 var FCKStyleCommand = function()
\r
27 FCKStyleCommand.prototype =
\r
31 Execute : function( styleName, styleComboItem )
\r
33 FCKUndo.SaveUndoStep() ;
\r
35 if ( styleComboItem.Selected )
\r
36 FCK.Styles.RemoveStyle( styleComboItem.Style ) ;
\r
38 FCK.Styles.ApplyStyle( styleComboItem.Style ) ;
\r
40 FCKUndo.SaveUndoStep() ;
\r
43 FCK.Events.FireEvent( 'OnSelectionChange' ) ;
\r
46 GetState : function()
\r
48 if ( FCK.EditMode != FCK_EDITMODE_WYSIWYG || !FCK.EditorDocument )
\r
49 return FCK_TRISTATE_DISABLED ;
\r
51 if ( FCKSelection.GetType() == 'Control' )
\r
53 var el = FCKSelection.GetSelectedElement() ;
\r
54 if ( !el || !FCKStyles.CheckHasObjectStyle( el.nodeName.toLowerCase() ) )
\r
55 return FCK_TRISTATE_DISABLED ;
\r
58 return FCK_TRISTATE_OFF ;
\r