2
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
3
* Copyright (C) 2003-2010 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
* FCKStyleCommand Class: represents the "Style" command.
24
var FCKStyleCommand = function()
27
FCKStyleCommand.prototype =
31
Execute : function( styleName, styleComboItem )
33
FCKUndo.SaveUndoStep() ;
35
if ( styleComboItem.Selected )
36
FCK.Styles.RemoveStyle( styleComboItem.Style ) ;
38
FCK.Styles.ApplyStyle( styleComboItem.Style ) ;
40
FCKUndo.SaveUndoStep() ;
43
FCK.Events.FireEvent( 'OnSelectionChange' ) ;
48
if ( FCK.EditMode != FCK_EDITMODE_WYSIWYG || !FCK.EditorDocument )
49
return FCK_TRISTATE_DISABLED ;
51
if ( FCKSelection.GetType() == 'Control' )
53
var el = FCKSelection.GetSelectedElement() ;
54
if ( !el || !FCKStyles.CheckHasObjectStyle( el.nodeName.toLowerCase() ) )
55
return FCK_TRISTATE_DISABLED ;
58
return FCK_TRISTATE_OFF ;