/**
@preserve CLEditor BBCode Plugin v1.0.0
http://premiumsoftware.net/cleditor
requires CLEditor v1.3.0 or later
Copyright 2010, Chris Landowski, Premium Software, LLC
Dual licensed under the MIT or GPL Version 2 licenses.
*/
// ==ClosureCompiler==
// @compilation_level SIMPLE_OPTIMIZATIONS
// @output_file_name jquery.cleditor.bbcode.min.js
// ==/ClosureCompiler==
/*
The CLEditor useCSS optional parameter should be set to false for this plugin
to function properly.
Supported HTML and BBCode Tags:
Bold Hello
[b]Hello[/b]
Italics Hello
[i]Hello[/i]
Underlined Hello
[u]Hello[/u]
Strikethrough Hello
[s]Hello[/s]
Unordered Lists
[img]http://premiumsoftware.net/image.jpg[/img]
Links Premium Software
[url=http://premiumsoftware.net]Premium Software[/url]
*/
(function($) {
// BBCode only supports a small subset of HTML, so remove
// any toolbar buttons that are not currently supported.
$.cleditor.defaultOptions.controls =
"bold italic underline strikethrough removeformat | bullets numbering | " +
"undo redo | image link unlink | cut copy paste pastetext | print source";
// Save the previously assigned callback handlers
var oldAreaCallback = $.cleditor.defaultOptions.updateTextArea;
var oldFrameCallback = $.cleditor.defaultOptions.updateFrame;
// Wireup the updateTextArea callback handler
$.cleditor.defaultOptions.updateTextArea = function(html) {
// Fire the previously assigned callback handler
if (oldAreaCallback)
html = oldAreaCallback(html);
// Convert the HTML to BBCode
return $.cleditor.convertHTMLtoBBCode(html);
}
// Wireup the updateFrame callback handler
$.cleditor.defaultOptions.updateFrame = function(code) {
// Fire the previously assigned callback handler
if (oldFrameCallback)
code = oldFrameCallback(code);
// Convert the BBCode to HTML
return $.cleditor.convertBBCodeToHTML(code);
}
// Expose the convertHTMLtoBBCode method
$.cleditor.convertHTMLtoBBCode = function(html) {
$.each([
[/[\r|\n]/g, ""],
[/