You are not logged in.
I am using the default button list in most areas but need to limit the buttons in a few spots on my site. can I set the "xinha_config.toolbar" value in the textarea if needed? Then have it default to the full list if its not specified?
Thanks
Offline
Yes
Great!
How?
Offline
Can you help with an example?
Offline
xinha_config.toolbar =
[
["popupeditor"],
["separator","formatblock","fontname","fontsize","bold","italic","underline","strikethrough"],
["separator","forecolor","hilitecolor","textindicator"],
["separator","subscript","superscript"],
["linebreak","separator","justifyleft","justifycenter","justifyright","justifyfull"],
["separator","insertorderedlist","insertunorderedlist","outdent","indent"],
["separator","inserthorizontalrule","createlink","insertimage","inserttable"],
["linebreak","separator","undo","redo","selectall","print"], (Xinha.is_gecko ? [] : ["cut","copy","paste","overwrite","saveas"]),
["separator","killword","clearfonts","removeformat","toggleborders","splitblock","lefttoright", "righttoleft"],
["separator","htmlmode","showhelp","about"]
];
??
James Sleeman
Offline
I mean per instance. Something like...
<textarea id="message" name="message" maxlength="300" cols=35 rows=10 style"xinha_config.toolbar = [["popupeditor"],["separator","formatblock","fontname","fontsize","bold","italic","underline","strikethrough"]]"></textarea>
Offline
In your config.
/** STEP 5 ***************************************************************
* If you want to change the configuration variables of any of the
* editors, this is the place to do that, for example you might want to
* change the width and height of one of the editors, like this...
*
* xinha_editors.myTextArea.config.width = '640px';
* xinha_editors.myTextArea.config.height = '480px';
*
************************************************************************/
James Sleeman
Offline
Back to my original question then the answer is no. You can not set variables in for each instance in the textarea. Right? You have to do it in the config. My problem is that when I try to assign different button layouts for different id's in the config, it fails to load.
Offline
Correct you can't set in the textarea html tag itself unless you write something to do it in your config step 5, like perhaps this...
function merge_object(a,b)
{
for(var j in b)
{
if(typeof a[j] != typeof b[j] || typeof b[j] != 'object')
{
a[j] = b[j]
}
else
{
merge_object(a[j], b[j]);
}
}
}
for(var o in xinha_editors)
{
var xn_eval = "{ }";
var xn_config = null;
if(typeof xinha_editors[o]._textArea.hasAttribute != 'undefined')
{
if(xinha_editors[o]._textArea.hasAttribute('xinhaconfig'))
{
xn_eval = xinha_editors[o]._textArea.getAttribute('xinhaconfig');
}
}
else if(typeof xinha_editors[o]._textArea.xinhaconfig != 'undefined')
{
xn_eval = xinha_editors[o]._textArea.xinhaconfig;
}
var xn_config = null;
try
{
if(!/^\{/.test(xn_eval)) //\}
{
eval("xn_config = {" + xn_eval + "}");
}
else
{
eval("xn_config = " + xn_eval);
}
}
catch(e)
{
try
{
xn_config = eval(xn_eval);
}
catch(e)
{
continue;
}
}
if(typeof xn_config == 'object')
{
if(typeof xn_config.toolbar != 'undefined' && xn_config.toolbar.length)
{
xinha_editors[o].config.toolbar = xn_config.toolbar;
delete xn_config.toolbar;
}
merge_object(xinha_editors[o].config, xn_config);
}
}
then you could use
<textarea name="youreditor" xinhaconfig="{ toolbar: [
["popupeditor"],
["separator","formatblock","fontname","fontsize","bold","italic","underline","strikethrough"],
["separator","forecolor","hilitecolor","textindicator"],
["separator","subscript","superscript"],
["linebreak","separator","justifyleft","justifycenter","justifyright","justifyfull"],
["separator","insertorderedlist","insertunorderedlist","outdent","indent"],
["separator","inserthorizontalrule","createlink","insertimage","inserttable"],
["linebreak","separator","undo","redo","selectall","print"], (Xinha.is_gecko ? [] : ["cut","copy","paste","overwrite","saveas"]),
["separator","killword","clearfonts","removeformat","toggleborders","splitblock","lefttoright", "righttoleft"],
["separator","htmlmode","showhelp","about"]
] }"></textarea>
James Sleeman
Offline