You are not logged in.
Hi all,
I had some serious trouble focussing Xinha editors which are in hidden div layers. After days of searching for a solution, I found a simple one, and I want to share it with you.
I use the newest version (v0931, but other versions had this trouble too) and the problem was especially with IE6 (IE7 I did not test) -- in FireFox everything is working fine without the hack I found. The editors are initialised correctly, but after that I hide them. When showing an editor again (display:block / none) it could not receive focus in all situations. I tried several (javascript) constructs but at last I managed to get things working in IE :
xinha_editors[*id*].sizeEditor(4 params);
This makes the editor "wake up" and you can start typing because it receives focus again.
BTW. I found out that the config constructs while initialising (e.g. xinha_editors[*id*].config.height = ...) which are mentioned many times on this forum, are only for setting properties while initialising, you can not use them after that to change the properties of an Editor (... but please correct me if I'm wrong).
This method I found at ...
http://xinha.raimundmeyer.de/JSdoc/Xinh … Xinha.html
... a nice list which contains several other "secret" methods / functions ...!
Here you can read about the "sizeEditor" method :
-------------------
void sizeEditor(<string> width, <string> height, <Boolean> includingBars, <Boolean> includingPanels)
Size the editor to a specific size, or just refresh the size (when window resizes for example)
Parameters:
width - optional width (CSS specification)
height - optional height (CSS specification)
includingBars - optional to indicate if the size should include or exclude tool & status bars
includingPanels - optional to indicate if the size should include or exclude panels
-------------------
HTH,
Roelof
simple is not always best, but best is always simple
Offline
Interesting. I ran into a similar problem, and actually got around it by removing/re-adding hidden editors (didn't have time to research this solution). When adding a new editor, I have found that the following construct works well:
xinha_editorsnew = Array();
xinha_editorsnew.push('txtNormal', 'txtSuccess' , 'txtFailure');
xinha_editorsnew = Xinha.makeEditors(xinha_editorsnew, xinha_config, xinha_plugins);
Xinha.startEditors(xinha_editorsnew);
xinha_init();
However, I don't think we should have to refocus a hidden editor. I wonder if there is a related ticket already...
Offline
deactivateEditor and activateEditor are your friends here in lots of cases. Essentially you should deactivate before changing anythng regarding the style of the editor (especially visibility, even if it's "inheritied") and reacivate it after.
Xinha should also be visible at least when it is created, otherwise sizing will probably be messed up.
James Sleeman
Offline
I did not mention it, but I knew about these 'basics" ..
deactivateEditor and activateEditor are your friends here in lots of cases. Essentially you should deactivate before changing anythng regarding the style of the editor (especially visibility, even if it's "inheritied") and reacivate it after.
Xinha should also be visible at least when it is created, otherwise sizing will probably be messed up.
You may use visibility:hidden during creation when you want the editor not to be seen. Once it's ready you may do deactivateEditor() and display:none
.. because I first read your forum for possible solutions. Nevertheless, I ran into the situation of this topic, and my solution is as I described. When anyone has the same problem, maybe my solution helps, but it is possible some other programming issue in my project made me have to use the solution I described, I don't know. Thanks anyway for completing this issue.
simple is not always best, but best is always simple
Offline