For buttons that exist on the toolbar you can use this function.
function toggleButton(editorInstance, itemName)
{
toolbarButton = editorInstance.EditorWindow.parent.FCKToolbarItems.LoadedItems[itemName]._UIButton.MainElement;
if (toolbarButton.style.display == 'none')
{
toolbarButton.style.display = 'block';
}
else
{
toolbarButton.style.display = 'none';
}
}
E.g. to hide the FitWindow button onload of the editor:
function FCKeditor_OnComplete(editorInstance)
{
toggleButton(editorInstance, 'FitWindow');
}
Or to toggle it onclick of an HTML element:
<span onclick="toggleButton(FCKeditorAPI.GetInstance('FCKeditor1'), 'FitWindow');">click here<span>
With of course the string in GetInstance to be your FCKeditor instance name
function toggleButton(editorInstance, itemName)
{
toolbarButton = editorInstance.EditorWindow.parent.FCKToolbarItems.LoadedItems[itemName]._UIButton.MainElement;
if (toolbarButton.style.display == 'none')
{
toolbarButton.style.display = 'block';
}
else
{
toolbarButton.style.display = 'none';
}
}
E.g. to hide the FitWindow button onload of the editor:
function FCKeditor_OnComplete(editorInstance)
{
toggleButton(editorInstance, 'FitWindow');
}
Or to toggle it onclick of an HTML element:
<span onclick="toggleButton(FCKeditorAPI.GetInstance('FCKeditor1'), 'FitWindow');">click here<span>
With of course the string in GetInstance to be your FCKeditor instance name
RE: HOWTO - hide/show a toolbar button
"toolbarButton = editorInstance.EditorWindow.parent.FCKToolbarItems.LoadedItems[itemName]._UIButton.MainElement;"
with the code below:
if (editorInstance.EditorWindow.parent.FCKToolbarItems.LoadedItems[itemName].DOMDiv) // fCKeditor 2.2-
{
toolbarButton = editorInstance.EditorWindow.parent.FCKToolbarItems.LoadedItems[itemName].DOMDiv;
}
else // FCKeditor 2.3+
{
toolbarButton = editorInstance.EditorWindow.parent.FCKToolbarItems.LoadedItems[itemName]._UIButton.MainElement;
}
And to get the image of the button do: toolbarButton.getElementsByTagName('IMG')[0]