si eso me ayudo gracias pero no todo en si tu ve que modificar el tinymce el archivo editor_plugin.js del bbcode, lo tuve que hacer porq no me leia el bbcode este codigo lo encontre despues de matarme buscando en el foro tinymce.
Código :
/**
* $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
*
* @author Moxiecode
* @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
*/
(function() {
tinymce.create('tinymce.plugins.BBCodePlugin', {
init : function(ed, url) {
var t = this, dialect = ed.getParam('bbcode_dialect', 'punbb').toLowerCase();
ed.onBeforeSetContent.add(function(ed, o) {
o.content = t['_' + dialect + '_bbcode2html'](o.content);
});
ed.onPostProcess.add(function(ed, o) {
if (o.set)
o.content = t['_' + dialect + '_bbcode2html'](o.content);
if (o.get)
o.content = t['_' + dialect + '_html2bbcode'](o.content);
});
},
getInfo : function() {
return {
longname : 'BBCode Plugin',
author : 'Moxiecode Systems AB',
authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/bbcode',
version : tinymce.majorVersion + "." + tinymce.minorVersion
};
},
// Private methods
// HTML -> BBCode in PunBB dialect
_punbb_html2bbcode : function(s) {
s = tinymce.trim(s);
//alert('html: ' + s);
function getTagName(el) {
return el.match(/\w+/);
}
function elGetAttribute(el,name) {
var r = new RegExp(name+"=\"([^\"]*)\"");
var m = r.exec(el);
if (m && m[1]) {
return m[1];
}
return null;
}
function getRule(el,name) {
var r = new RegExp("[\";]\\s*"+name+":\\s*([^\";]*?)%?[;\"]");
var m = r.exec(el);
if (m && m[1]) {
return m[1];
}
return null;
}
function analyzeCouple(opening,closing) {
var res = new Array();
var op = getTagName(opening);
if (op == 'p') {
opening = '';
closing = '\n';
}
if (op == 'a') {
opening = "[url= + elGetAttribute(opening,'href') + ]";
closing = "[/url]";
}
if (op == 'span') {
if (getRule(opening,'color')) {
opening = '[color= + getRule(opening,\'color\') + ]';
closing = '[/color]';
}
if (getRule(opening,'background-color')) {
opening = '[bgcolor=' + getRule(opening,'background-color') + ']';
closing = '[/bgcolor]';
}
if (getRule(opening,'font-size')) {
var n = getRule(opening,'font-size').match(/\d+/);
opening = '[size=' + n + ']';
closing = '[/size]';
}
if (getRule(opening,'text-decoration')=='underline') {
opening = '[u]';
closing = '[/u]';
}
if (getRule(opening,'text-decoration')=='line-through') {
opening = '[s]';
closing = '[/s]';
}
}
if (op == 'img') {
opening = "[img]"+elGetAttribute(opening,'src');
closing = "[/img]";
}
if ((op == 'strong')||(op == 'b')) {
opening = "[b]";
closing = "[/b]";
}
if ((op == 'em')||(op == 'i')) {
opening = "[i]";
closing = "[/i]";
}
if (op == 'ul') {
opening = "[ul]";
closing = "[/ul]";
}
if (op == 'ol') {
opening = "[ol]";
closing = "[/ol]";
}
if (op == 'li') {
opening = "[li]";
closing = "[/li]";
}
res[0] = opening;
res[1] = closing;
return res;
}
function getNodeType(tag) {
if (tag.match(/<(?!\/)[^>]*[^\/]>/) != null)
return 1; // opening
if (tag.match(/<[\/][^>]*>/) != null)
return 2; // closing
if (tag.match(/<[^>]*[\/]>/) != null)
return 3; // closed directly
return 0; // string
}
function rep(re, str) {
s = s.replace(re, str);
};
var repSpanSplit = /<span\s+style="([^:]+:[^;]+;)\s*([^"]+)">(.*?)<\/span>/ig;
while (repSpanSplit.test(s)) {
s = s.replace(repSpanSplit, "<span style=\"$1\"><span style=\"$2\">$3</span></span>");
}
rep(/\n/gi,' ');
rep(/<br\s*\/?>/gi,"\n");
var match = s.match(/<.*?>|[^<]*/ig);
var result = new Array();
var position = 0;
for (var i = 0; i< match.length; i++) {
//alert('segment: ' + match[i].replace('\n','.').replace(' ','-'));
if (getNodeType(match[i])==1) {
var backtrace = 0;
for (var y = i; y < match.length; y++) {
if (getNodeType(match[y])==1) {
backtrace++;
}
if (getNodeType(match[y])==2) {
backtrace--;
}
if (backtrace == 0) {
var a = analyzeCouple(match[i],match[y]);
match[i] = a[0];
match[y] = a[1];
break;
}
}
} else if (getNodeType(match[i])==3) {
var a = analyzeCouple(match[i], null);
match[i] = a[0] + a[1];
}
}
s = match.join('');
rep(/ /gi," ");
rep(/"/gi,"\"");
rep(/</gi,"<");
rep(/>/gi,">");
rep(/&/gi,"&");
var repNestedSize = /(\[size=\d+\])(.*?)\[size=\d+\](.*?)\[\/size\](.*?)\[\/size\]/gi
while (repNestedSize.test(s))
rep(repNestedSize,"[size=$1]$2$3[/size]");
rep(/\[size=\[size=(\d+)\]\](.*?)\[\/size\]/gi, "[size=$1]$2[/size]");
return s;
},
// --------------------------------------------------------------------------------------
// BBCode -> HTML from PunBB dialect
_punbb_bbcode2html : function(s) {
s = tinymce.trim(s);
//alert('bbcode: ' + s);
function getTagName(el) {
return el.match(/\w+/);
}
function bbGetParam(el) {
var r = /=\"?([^\]]*)\"?/;
var m = r.exec(el);
if (m && m[1]) {
return m[1];
}
return null;
}
function analyzeCouple(opening,closing,content) {
var res = new Array();
var op = getTagName(opening);
if (op == 'url') {
opening = '<a href="' + bbGetParam(opening) + '">';
closing = '</a>';
}
if (op == 'color') {
opening = '<span style="color:'+bbGetParam(opening)+';">';
closing = '</span>';
}
if (op == 'bgcolor') {
opening = '<span style="background-color:'+bbGetParam(opening)+';">';
closing = '</span>';
}
if (op == 'size') {
opening = '<span style="font-size:'+bbGetParam(opening)+'%;">';
closing = '</span>';
}
if (op == 'u') {
opening = '<span style="text-decoration:underline;">';
closing = '</span>';
}
if (op == 's') {
opening = '<span style="text-decoration:line-through;">';
closing = '</span>';
}
if (op == 'img') {
opening = '<img src="' + content + '" />';
closing = '';
content = '';
}
if (op == 'b') {
opening = "<strong>";
closing = "</strong>";
}
if (op == 'i') {
opening = "<em>";
closing = "</em>";
}
if (op == 'ul') {
opening = "<ul>";
closing = "</ul>";
}
if (op == 'ol') {
opening = "<ol>";
closing = "</ol>";
}
if (op == 'li') {
opening = "<li>";
closing = "</li>";
}
res[0] = opening;
res[1] = closing;
res[2] = content;
return res;
}
function getNodeType(tag) {
if (tag.match(/\[[^\/][^\]]*\]/) != null)
return 1; // opening
if (tag.match(/\[[\/]\w+\]/) != null)
return 2; // closing
return 0; // string
}
function rep(re, str) {
s = s.replace(re, str);
};
rep(/\r\n|\n/gi,"<br />");
var match = s.match(/\[.*?\]|\[?[^\[]*/ig);
var result = new Array();
var position = 0;
for (var i = 0; i< match.length; i++) {
if (getNodeType(match[i])==1) {
var backtrace = 0;
for (var y = i; y < match.length; y++) {
if (getNodeType(match[y])==1) {
backtrace++;
}
if (getNodeType(match[y])==2) {
backtrace--;
}
if (backtrace == 0) {
var a = analyzeCouple(match[i],match[y],match[i+1]);
match[i] = a[0];
match[y] = a[1];
match[i+1] = a[2];
break;
}
}
}
}
// some fixes
//rep(/\[size=(\d+)\](.*?)\[size=\d+\](.*?)\[\/size\](.*?)\[\/size\]/gi,"[size=$1]$2$3[/size]");
//rep(/\[size=\[size=(\d+)\]\](.*?)\[\/size\]/gi, "[size=$1]$2[/size]");
s = match.join('');
return '<p>' + s + '</p>';
}
});
// Register plugin
tinymce.PluginManager.add('bbcode', tinymce.plugins.BBCodePlugin);
})();
espero que si alguien tiene un problema similar a esto le sirva y gracias por su ayuda