Hi,
Bubulina wrote:
Hello,
I found this link :
http://code.xwiki.org/xwiki/bin/view/Modules/WysiwygEditorModule. It is an
useful one, but if i wanna edit more than one html element(in this case
textarea that has the id="demo") then it does now what to do.
i tried making an array of "hookedIds" but that does not help either.
my case scenario is something like this:
"i have a table with multiple <input type="text" .. or textarea . they
are
grouped in a table(which had an id..thinking that if all elements are
integrated in an table that has an id i am doing a step forward..quess not).
each field has an id because when i press Edit i wanna edit all those
elements from the table, except some labels lets say. So, folowing the
example from the link above i tried, made a table, created input types and
labels. just like a normal table. i gave ids to all the elements that i
wanna edit later on. then when i call the editor on load in javascript, i
have this variable there:hookId. this one can receive only one id?. my scope
is to add as many ids as i need to so that when i press the edit button to
be ablet to edit those "
You need to instantiate as many editors as text-areas-to-be-replaced you
have. In other words, each WYSIWYG editor instance replaces just one
text area. That's why when you configure a WYSIWYG editor instance you
specify just one hook id. So if you have:
<textarea id="foo"></textarea>
<textarea id="bar"></textarea>
in order to replace both you have to wrote something like:
Wysiwyg.onModuleLoad(function() {
new WysiwygEditor({hookId:'foo'});
new WysiwygEditor({hookId:'bar'});
});
Of course, it's more elegant if you mark all text areas to be replaced
with a CSS class like:
<textarea id="foo" class="richtextarea"></textarea>
<textarea id="bar" class="richtextarea"></textarea>
and then have:
Wysiwyg.onModuleLoad(function() {
$$('.richtextarea').each(function(textArea) {
new WysiwygEditor({hookId:textArea.id});
});
});
Note that in case you want to edit properties of XWiki objects then it's
easier to use the wysiwyg_editProperties velocity macro.
Hope this helps,
Marius
this is a long shot, but it's my best idea yet. if you think there is
something wrong in the logic, please tell me. did anybody ran into such
stuff?
thank you