]*>/gi, '[quote]');
rep(/<\/blockquote>/gi, '[/quote]');
rep(/
/gi, '\n');
rep(/
/gi, '\n');
rep(/
/gi, '\n');
rep(//gi, '');
rep(/<\/p>/gi, '\n');
rep(/ |\u00a0/gi, ' ');
rep(/"/gi, '"');
rep(/</gi, '<');
rep(/>/gi, '>');
rep(/&/gi, '&');
return s;
};
var bbcode2html = function (s) {
s = global$1.trim(s);
var rep = function (re, str) {
s = s.replace(re, str);
};
rep(/\n/gi, '
');
rep(/\[b\]/gi, '');
rep(/\[\/b\]/gi, '');
rep(/\[i\]/gi, '');
rep(/\[\/i\]/gi, '');
rep(/\[u\]/gi, '');
rep(/\[\/u\]/gi, '');
rep(/\[url=([^\]]+)\](.*?)\[\/url\]/gi, '$2');
rep(/\[url\](.*?)\[\/url\]/gi, '$1');
rep(/\[img\](.*?)\[\/img\]/gi, '');
rep(/\[color=(.*?)\](.*?)\[\/color\]/gi, '$2');
rep(/\[code\](.*?)\[\/code\]/gi, '$1 ');
rep(/\[quote.*?\](.*?)\[\/quote\]/gi, '$1 ');
return s;
};
function Plugin () {
global.add('bbcode', function (editor) {
editor.on('BeforeSetContent', function (e) {
e.content = bbcode2html(e.content);
});
editor.on('PostProcess', function (e) {
if (e.set) {
e.content = bbcode2html(e.content);
}
if (e.get) {
e.content = html2bbcode(e.content);
}
});
});
}
Plugin();
}());