You are not logged in.
Hi,
I have had a look at Xinha, and I am having real trouble working out how to integrate it with my app.
All the example code seems to assume a couple of things:
1) The textareas exist when the page loads.
2) You want to turn all of them on at the same time.
Neither of which is true for me.
My app is JS / AJAX, and there are two textareas that I wish to XINHA-ize. Both of them only exist in certain conditions, and only ever one or the other. The textareas will be created in a DIV at some point in the code, at which point I need to XINHA-ize it.
I have gotten one to show, but cannot get the other one to for the life of me - all the code examples seem to require that you hard-code textarea IDs into the source, and I cannot seem to get Xinha.startEditors to just try and start one editor in xinha_editors.
What I want is a JS function that you can pass a textarea ID and it XINHA-izes it. All XINHA boxes will use the same plugins and be the same size, so the only argument I need to the JS func is the ID of the textarea - the rest can be globals.
Any ideas?
To see the project to get an idea of what I am talking about:
http://www.evilc.com/phpbb/gp.php
You need to register and log in, then go to Edit Mode to see the HTMLArea box.
TIA
Clive
Offline
Why do you want to have two editors when you always want only one visible?
You don't have to attach xinha_init to window.onload but call it anytime you want. After editing is done, you just display:none the div and show it again next time with other content.
You can set the content with the method setHTML() like
var newHtml = "some HTML";
xinha_editors.myTextArea.setHTML(newHtml);
and you pull it out with
var editor = xinha_editors.myTextArea;
var editedHTML = editor.outwardHtml(editor.getHTML());
Important: It will not work to create Xinha in a <div style="display:none">, but you can hide and show it at will once generated.
Offline
at the moment the DIVs are built using the JS echo command. They *don't exist* until you enter edit mode and the point edit div is drawn and the user has selected a valid region.
I am looking into recoding it now with hidden DIVs and stuff, I think that will probably be the best method in the end. this project has grown with my coding abilities over the last couple of years, I am probably going about a whole bunch of things the wrong way...
Thinking about it, what with the time it takes xinha to initialise, I think it would probably be better to do it with hidden divs to make it a smoother user experience.
Thanks for your input once again ray
Offline