I have this plugin to set a div:
var FCKPageSplit = function(name) {this.Name = name;}
FCKPageSplit.prototype.Execute = function() {
FCK.InsertHtml('<div class="pagesplit"> </div>');
}
FCKPageSplit.prototype.GetState = function() {
return FCK_TRISTATE_OFF;
}
FCKCommands.RegisterCommand('PageSplit',new FCKPageSplit('PageSplit')) ;
var oPageSplitItem = new FCKToolbarButton('PageSplit','PageSplit',null,null,false,true) ;
oPageSplitItem.IconPath = FCKConfig.PluginsPath + 'pagesplit/split.gif' ;
FCKToolbarItems.RegisterItem('PageSplit',oPageSplitItem) ;
How can I set the button disabled, if the cursor is in a table element? I try different ways like this:
if(editorInstance.Commands.GetCommand('Table').GetState) {
var oCommand = editorInstance.Commands.GetCommand('PageSplit') ;
oCommand.Execute = function(){return false;} ;
oCommand.GetState = function(){return FCK_TRISTATE_DISABLED;} ;
} else {
var oCommand = editorInstance.Commands.GetCommand('PageSplit') ;
oCommand.Execute = function(){return true;} ;
oCommand.GetState = function(){return FCK_TRISTATE_ENABLED;} ;
}
but nothing happends Is there a way?
Thanks
Wed, 01/03/2007 - 13:39
#1
RE: Disable button, if cursor is inside table
something like
FCKPageSplit.prototype.GetState = function() {
if( FCKSelection.HasAncestorNode( 'TABLE' )){
return FCK_TRISTATE_DISABLED;
}
return FCK_TRISTATE_OFF;
}
might do the simple trick.
Hope that helps,
Andreas.
RE: Disable button, if cursor is inside table
great, thank you
Sven
Re: Disable button, if cursor is inside table
I updated to version 2.5.1. The plugin works, but FCKSelection.HasAncestorNode didn't.
Where can I fix this problem?