You are not logged in.
Pages: 1
Hi Everybody,
I need to use Xinha in a forum, so i need to use the bold, italic, etc, fonctionnality but not with html tags, but BBCode Tags.
I know that tinyMCE has a mode that makes him works in BBCode mode.
Does Xinha has a BBCode mode too ?
Thanks in advance.
Offline
A little up for the Week-End
Offline
Xinha does not do BB code. That said, it would be relatively trivial for you to do such I expect by simply creating a couple of javascript functions which you can put into your editor configuration...
[your editor].config.inwardHtml - converts from BB to html
[your editor].config.outwardHtml - converts from html to BB
something along the lines of...
my_editor.config.inwardHtml = function(bbcode)
{
var html = bbcode;
// [b] [/b] goes to <b> </b>
html = html.replace(/[(\/?)b]/, '<$1b>');
// other conversions here!
// Strip any remaining html tags here!
html = html.replace(/<[^>]*>?/, '');
return html;
}
my_editor.config.outwardHtml = function(html)
{
var bbcode = html;
// <b> and <strong> go to [b]
bbcode = bbcode.replace(/<(\/?)(b|strong)>/, '[$1b]');
// other conversions here!
// Strip any remaining html tags here!
bbcode = bbcode.replace(/<[^>]*>?/, '');
return bbcode;
}
Then just limit your editor tool bar to those things which make sense for bbcode (and you can translate).
James Sleeman
Offline
Pages: 1