You are not logged in.
Hi,
I've got xinha working great, but am wondering whether it was possible to get xinha to load with a dynamically created textarea.
Example:
JS Code:
var form = document.createElement('form');
form.name = "editForm";
form.action = "";
form.method = "post";
var ta = document.createElement('textarea');
ta.name= "message";
ta.setAttribute("id", "editMessage");
ta.setAttribute("cols", "67");
ta.setAttribute("rows", "6");
ta.value = contents;
e.innerHTML = "";
var edit = document.createElement('input');
edit.type = "button";
edit.setAttribute("value", "Edit Post");
edit.setAttribute("onclick", "editMessage();");
e.appendChild(form);
form.appendChild(ta);
form.appendChild(edit);
//Enable xinhia --how?
xinha_editors.editMessage.generate();
So it creates the form, but I can't figure out how to get xinha to recognize and generate it. Any ideas?
Offline
var editor = null;
HTMLArea.loadPlugin("ImageManager");
HTMLArea.loadPlugin("SuperClean");
var config = new HTMLArea.Config();
config.toolbar =
[
["bold","italic","createlink","insertimage","separator"],
["killword","removeformat"]
];
config.formatblock =
{
"— format —" : "",
"Heading 2": "h2",
"Normal" : "p"
};
function initEditor() {
editor = new HTMLArea("wer_text",config);
editor.registerPlugin(ImageManager);
editor.registerPlugin(SuperClean);
editor.generate();
}
I have copied this from an old "HTMLarea-like" config. It shows the steps you have to take before you can call editor.generate(). (Thanks James for the simplification on this, btw )
Last edited by ray (2006-04-24 16:10:25)
Offline
So in summary I'm going to need to make the configuration manually (rather then use config.js) so I can then generate the editor? Why didn't I think of that?
I'm off to test it. I'll post results after I test it. Thanks in advance!
Offline
Sorry to post later - it did work.
Offline