Announcement

Do not use the forums to submit bug reports, feature requests or patches, submit a New Ticket instead.

#1 2009-02-01 13:14:35

YBELLU
New member
Registered: 2009-01-23
Posts: 8

Limit Xinha to BBCode

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

#2 2009-02-06 13:53:32

YBELLU
New member
Registered: 2009-01-23
Posts: 8

Re: Limit Xinha to BBCode

A little up for the Week-End smile

Offline

#3 2009-02-08 21:38:41

gogo
Xinha Leader
From: New Zealand
Registered: 2005-02-11
Posts: 1,015
Website

Re: Limit Xinha to BBCode

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

Board footer

Powered by FluxBB