I've been playing with the BBCode plugin and have added some tags, such as strike, but I cannot figure out how to implement supported BBCode for font styles and text justification.
[font=font name]this font here[/font] and [left], [center], and [right] are pretty common BBCode tags, yet I cannot find any documentation or post on the site to add them. The following code snippet is the current implementation I'm using to try to get [font] to work. I haven't a clue how to set tags for justification since those are usually <p> elements and BBCode typically strips them.
Any help with this would be greatly appreciated. Thank you!
I found the solution. Looks like some added code needs to be popped in down the file a bit, just after font-size portion of some if statements. I've added my snippet afterwards. I'm kind of surprised font styles aren't supported by the BBCode plugin natively.
[font=font name]this font here[/font] and [left], [center], and [right] are pretty common BBCode tags, yet I cannot find any documentation or post on the site to add them. The following code snippet is the current implementation I'm using to try to get [font] to work. I haven't a clue how to set tags for justification since those are usually <p> elements and BBCode typically strips them.
var bbcodeMap = { 'b' : 'strong', 'u': 'u', 'i' : 'em', 'strike' : 'strike', 'color' : 'span', 'size' : 'span', 'font' : 'span', 'quote' : 'blockquote', 'code' : 'code', 'url' : 'a', 'email' : 'span', 'img' : 'span', '*' : 'li', 'list' : 'ol', 'h1' : 'h1', 'h2' : 'h2', 'h3' : 'h3' }, convertMap = { 'strong' : 'b' , 'b' : 'b', 'u' : 'u', 'em' : 'i', 'i' : 'i', 'code' : 'code', 'li' : '*' }, tagnameMap = { 'strong' : 'b', 'em' : 'i', 'u' : 'u', 'li' : '*', 'ul' : 'list', 'ol' : 'list', 'code' : 'code', 'a' : 'link', 'img' : 'img', 'blockquote' : 'quote' }, stylesMap = { 'color' : 'color', 'size' : 'font-size', 'font' : 'font-family' }, attributesMap = { 'url' : 'href', 'email' : 'mailhref', 'quote': 'cite', 'list' : 'listType' };
Any help with this would be greatly appreciated. Thank you!
else if ( ( value = style[ 'font-size' ] ) ) { var percentValue = value.match( /(\d+)%$/ ); if ( percentValue ) { value = percentValue[ 1 ]; tagName = 'size'; } } else if ( ( value = style[ 'font-family' ] ) ) { tagName = 'font'; }
I found the solution. Looks like some added code needs to be popped in down the file a bit, just after font-size portion of some if statements. I've added my snippet afterwards. I'm kind of surprised font styles aren't supported by the BBCode plugin natively.