the FCKeditor_OnComplete function is already called with the editorInstance object, so you don't need to hardcode it with FCKeditorAPI.GetInstance('FCKeditor1').
and changing the .Execute function doesn't really disable the button, the button will look enabled so that's bad user experience. You could do it better this way: <script type="text/javascript"> function FCKeditor_OnComplete( editorInstance ) { var oCommand = editorInstance.Commands.GetCommand('FitWindow') ; oCommand.Execute = function(){return false;} ; oCommand.GetState = function(){return FCK_TRISTATE_DISABLED;} ; } </script>
But as I said in another reply, for this specific case it's just easier to adjust the width and height of the editor instead of loading it and then forcing it to resize itself again.
Oh inedeed, thanks for reminding me that the editor instance is passed to the FCKeditor_OnComplete function.
Overwriting the Execute method this way DOES disable the button, but indeed, the buttons still looks enabled. I do not know of a way to set it to look disabled. Your suggestion will only tell FCKeditor itself that the code is disabled, but it still looks enabled.
I've been trying to disable certain toolbar options on FCKeditor dynamically. I tried both of the approaches mentioned above. But when I try the 'Disable()' option, it seems to disable the feature only temporarily. If I click anywhere inside the editor, the feature is enabled again. The other approach of overriding the 'Execute' and 'GetState' methods of the command to disable seem to work more permanently. Has anybody else had a similar experience with the 'Disable' command before?
I would prefer using 'Disable' as its the recommended way. But I'm not sure why the feature gets enabled again after clicking inside the text area. In either case, I'm calling the disabling mechanism inside the 'FCKeditor_OnComplete' method. I would appreciate any feedback /comments regarding this.
You can disable the state changing of the button with: editorInstance.EditorWindow.parent.FCKToolbarItems.LoadedItems[commandName]._UIButton.ChangeState = function(){};
Not sure there is a better way to do it though. I thought you could do something with setting the state of the button to FCK_TRISTATE_OFF (editorInstance.EditorWindow.parent.FCKToolbarItems.LoadedItems[commandName]._UIButton.ChangeState( FCK_TRISTATE_OFF );), but testing shows this doesn't help. So no idea what this off state is... I guess a button has to define it's behavior for the off state, otherwise it defaults to its on state behavior (?)
I have a problem with the save button while the content is being loaded At this point (while loading) the toolbar is enabled (not all the content loaded), so If the user click on the save button the form submits, but not all the content was loaded. How can I prevent this behavior. FCKeditor_OnComplete is useless because this happens before.
saul11 wrote:Hmmmm you're right, never tested that :p
You can disable the state changing of the button with: editorInstance.EditorWindow.parent.FCKToolbarItems.LoadedItems[commandName]._UIButton.ChangeState = function(){};
Not sure there is a better way to do it though. I thought you could do something with setting the state of the button to FCK_TRISTATE_OFF (editorInstance.EditorWindow.parent.FCKToolbarItems.LoadedItems[commandName]._UIButton.ChangeState( FCK_TRISTATE_OFF );), but testing shows this doesn't help. So no idea what this off state is... I guess a button has to define it's behavior for the off state, otherwise it defaults to its on state behavior (?)
Any luck with FCK_TRISTATE_OFF? I am trying to remove(hide) a button withouth changing fckconfig.js and i belive FCK_TRISTATE_OFF is the way to do it ...I think i am not using it right...
I am using ckeditor in my project. Its working fine in all browsers, but a small issue in Google Chrome - Editor will open properly on first click, After closing the pop up and try the editor on second time without loading the page , I can't type text in the editor.
I somehow managed to resolve this issue using this javascript.
<script type="text/javascript">
$(document).ready( function() {
var instance = CKEDITOR.instances['lessonContent'];
if(instance) {
CKEDITOR.remove(instance);
}
CKEDITOR.config.startupMode = 'source';
});
</script>
but toolbar buttons are disabled now.
Can you please help me how to enable toolbar options here?
What you did is not the right method -- you are now opening CKEditor in Source mode. When you are in Source mode, toolbar buttons are disabled because they apply to WYSIWYG mode. You simply cannot use their features in Source mode, as Source is supposed to work on raw HTML code.
This always works in this way, see for example the demo on our website. If you click the Source button, you go into Source mode and the buttons become disabled.
RE: HOWTO - disable toolbar buttons
and changing the .Execute function doesn't really disable the button, the button will look enabled so that's bad user experience.
You could do it better this way:
<script type="text/javascript">
function FCKeditor_OnComplete( editorInstance )
{
var oCommand = editorInstance.Commands.GetCommand('FitWindow') ;
oCommand.Execute = function(){return false;} ;
oCommand.GetState = function(){return FCK_TRISTATE_DISABLED;} ;
}
</script>
But as I said in another reply, for this specific case it's just easier to adjust the width and height of the editor instead of loading it and then forcing it to resize itself again.
RE: HOWTO - disable toolbar buttons
Overwriting the Execute method this way DOES disable the button, but indeed, the buttons still looks enabled. I do not know of a way to set it to look disabled. Your suggestion will only tell FCKeditor itself that the code is disabled, but it still looks enabled.
RE: HOWTO - disable toolbar buttons
FCKeditorAPI.GetInstance('FCKeditor1').EditorWindow.parent.FCKToolbarItems.LoadedItems[commandName].Disable();
to disable a button onload of the editor do
function FCKeditor_OnComplete( editorInstance )
{
editorInstance.EditorWindow.parent.FCKToolbarItems.LoadedItems[commandName].Disable();
}
For the commandNames, see the first message in this thread.
RE: HOWTO - disable toolbar buttons
RE: HOWTO - disable toolbar buttons
I've been trying to disable certain toolbar options on FCKeditor dynamically. I tried both of the approaches mentioned above. But when I try the 'Disable()' option, it seems to disable the feature only temporarily. If I click anywhere inside the editor, the feature is enabled again. The other approach of overriding the 'Execute' and 'GetState' methods of the command to disable seem to work more permanently. Has anybody else had a similar experience with the 'Disable' command before?
I would prefer using 'Disable' as its the recommended way. But I'm not sure why the feature gets enabled again after clicking inside the text area. In either case, I'm calling the disabling mechanism inside the 'FCKeditor_OnComplete' method. I would appreciate any feedback /comments regarding this.
I'm using version 2.4.2 of FCKeditor.
thanks,
Satchit
RE: HOWTO - disable toolbar buttons
You can disable the state changing of the button with:
editorInstance.EditorWindow.parent.FCKToolbarItems.LoadedItems[commandName]._UIButton.ChangeState = function(){};
Not sure there is a better way to do it though. I thought you could do something with setting the state of the button to FCK_TRISTATE_OFF (editorInstance.EditorWindow.parent.FCKToolbarItems.LoadedItems[commandName]._UIButton.ChangeState( FCK_TRISTATE_OFF );), but testing shows this doesn't help. So no idea what this off state is... I guess a button has to define it's behavior for the off state, otherwise it defaults to its on state behavior (?)
Re: HOWTO - disable toolbar buttons
At this point (while loading) the toolbar is enabled (not all the content loaded), so If the user click on the save button the form submits, but not all the content was loaded.
How can I prevent this behavior. FCKeditor_OnComplete is useless because this happens before.
Thanks
Re: RE: HOWTO - disable toolbar buttons
Any luck with FCK_TRISTATE_OFF? I am trying to remove(hide) a button withouth changing fckconfig.js and i belive FCK_TRISTATE_OFF is the way to do it ...I think i am not using it right...
how to enable ckeditor toolbar options?
I am using ckeditor in my project. Its working fine in all browsers, but a small issue in Google Chrome - Editor will open properly on first click, After closing the pop up and try the editor on second time without loading the page , I can't type text in the editor.
I somehow managed to resolve this issue using this javascript.
<script type="text/javascript">
$(document).ready( function() {
var instance = CKEDITOR.instances['lessonContent'];
if(instance) {
CKEDITOR.remove(instance);
}
CKEDITOR.config.startupMode = 'source';
});
</script>
but toolbar buttons are disabled now.
Can you please help me how to enable toolbar options here?
Thanks in adv
What you did is not the right
What you did is not the right method -- you are now opening CKEditor in Source mode. When you are in Source mode, toolbar buttons are disabled because they apply to WYSIWYG mode. You simply cannot use their features in Source mode, as Source is supposed to work on raw HTML code.
This always works in this way, see for example the demo on our website. If you click the Source button, you go into Source mode and the buttons become disabled.
Documentation Manager, CKSource
See CKEditor 5 docs, CKEditor 4 docs, CKEditor 3 docs, CKFinder 3 docs, CKFinder 2 docs for help.
Visit the new CKEditor SDK for samples showcasing editor features to try out and download!
Ok then. I am back to square
Ok then. I am back to square 1 now.
My issue is when I open ckeditor 2nd time in chrome without reloading page (using ajax) then ckeditor gets disabled.
Issue is similar to this
http://bugs.jqueryui.com/ticket/7888#comment:2
I am not able to find solution for it. Any idea what it is happening?
I tried to change it to WYSIWYG mode but no outcome.
How to
How to disable buttons and ebable if i click on other button.
I explain if you don't click on form's button you can click on radio button, etc. How i can do this please