/** * $Id$ * * @author Moxiecode * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. */ (function() { tinymce.create('tinymce.plugins.e107BBCodePlugin', { 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 : 'e107 BBCode Plugin', author : 'Moxiecode Systems AB - Modified by e107 Inc', 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); function rep(re, str) { s = s.replace(re, str); }; // rep(/([\s\S]*?)<\/td>/gim,"[td]$1[/td]\n"); // verified // rep(/([\s\S]*?)<\/tr>/gim,"[tr]$1[/tr]\n"); // verified // rep(/([\s\S]*?)<\/table>/gim,"[table]$1[/table]\n"); // verified return s; rep(/
([\s\S]*)<\/div>/gi,"[center]$1[/center]"); // verified rep(/
  • /gi,"[*]"); // verified rep(/<\/li>/gi,""); // verified rep(/