I seem to have a problem making the following v2.6.5 code work in v3.3.1:
Can someone help shead some light on what to do?
function FCKeditor_OnComplete( editorInstance ) { editorInstance.Events.AttachEvent( 'OnBlur', FCKeditor_OnBlur ); editorInstance.Events.AttachEvent( 'OnFocus', FCKeditor_OnFocus ); } function FCKeditor_OnBlur( editorInstance ) { editorInstance.ToolbarSet.Collapse(); } function FCKeditor_OnFocus( editorInstance ) { editorInstance.ToolbarSet.Expand(); }I have tried putting ToolbarCollapse calls on editorinstance focus/blur inside a general instanceReady event, but the only effect is to make the toolbar appear when the first thing I do is to place the cursor in the editing area. The opposite will never happen, and if I close the toolbar and move the cursor to another field and back into the editing area it stays closed.
Can someone help shead some light on what to do?
Re: Toggle toolbar on focus/blur
The closest thing to a reply is to use "execCommand('ToolbarCollapse')" which really is to toggle the display, not set it to expand/collapse as desired. As explained in the original post, this toggle is hard to get to work at it looses interest as soon as the command has been performed once. So maybe I am stupid?
A would very much like some help on this, and a working example would be appreciated. For FCKEditor such an example was available from the makers, but for the CKEditor there are no migration help.
Re: Toggle toolbar on focus/blur
As I came to this old thread
As I came to this old thread and didn't find easy solutions elsewhere I thought I'd post my jQuery style answer... It hides tooldbar until focus.
id is the variable holding the name.
I use this in a function so I can set up multiple instances on a page with this behavior.
jQuery("#" + id).ckeditor(options);
CKEDITOR.instances[id].on("instanceReady", function (e) {
jQuery("#cke_" + id + " [id$='_top']").hide();
this.on("focus", function () {
jQuery("#cke_" + id + " [id$='_top']").show();
});
});