I was trying to do something like ...
when user clicked some "BOLD" text, the "BOLD" button will be highligh.
I am trying to add this to the plugins. Can anyone give me some direction?
I think I need to do something like this
FCKSelection.HasAncestorNode('A') ? FCK_TRISTATE_ON : FCK_TRISTATE_OFF;
and also I need to add Event triger, but I am not so sure how.
I tried couple different approach but no idea how it work ...
any suggestion will be greate.
when user clicked some "BOLD" text, the "BOLD" button will be highligh.
I am trying to add this to the plugins. Can anyone give me some direction?
I think I need to do something like this
FCKSelection.HasAncestorNode('A') ? FCK_TRISTATE_ON : FCK_TRISTATE_OFF;
and also I need to add Event triger, but I am not so sure how.
I tried couple different approach but no idea how it work ...
any suggestion will be greate.
RE: How to highlight a button?
MyParser.prototype.GetState = function()
{
return ( this.IsActive ? FCK_TRISTATE_OFF : FCK_TRISTATE_DISABLED ) ;
}
RE: How to highlight a button?
Can you show me how?
Actually I was thinking to create a button for those headers instead of using the combo dropdown box as a practice.
Could you tell me what I should change to make it work as other button like "bold" "italic"?
var FCKKidsFormat = function( name )
{
this.Name = name ;
}
FCKKidsFormat.prototype.Execute = function()
{
switch ( this.Name )
{
case 'FormatH1' :
FCK.ExecuteNamedCommand( 'FormatBlock', '<h1>' ) ;
break;
default :
}
}
FCKKidsFormat.prototype.GetState = function()
{
return FCKSelection.HasAncestorNode('h1') ? FCK_TRISTATE_ON : FCK_TRISTATE_OFF;
}
FCKCommands.RegisterCommand( 'KidsFormatH1', new FCKKidsFormat( 'FormatH1' ) ) ;
var oKidsItem = new FCKToolbarButton( 'KidsFormatH1', FCKLang['KidsFormatH1Title'] ) ;
oKidsItem.IconPath = FCKConfig.PluginsPath + 'kidsformat/h1.gif';
FCKToolbarItems.RegisterItem( 'KidsFormatH1', oKidsItem ) ;
RE: How to highlight a button?
I think I didn't state my problem clearly.
thx for replied.
I was talking about the blue highlight but not enable and disable.
I did put the similar code into the GetState function but somehow it will only run once when I first load the FCKeditor. The state won't change again once I click the mouse on edit area or do anything else.
RE: How to highlight a button?
the contextSensitive atribute in the FCKToolbarButton function.
Thanks so much.
RE: How to highlight a button?
thx a lot
Yoga