/*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2010 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* This is a sample implementation for a custom Data Processor for basic BBCode.
*/
FCK.DataProcessor =
{
/*
* Returns a string representing the HTML format of "data". The returned
* value will be loaded in the editor.
* The HTML must be from to , eventually including
* the DOCTYPE.
* @param {String} data The data to be converted in the
* DataProcessor specific format.
*/
ConvertToHtml : function( data )
{
// Convert < and > to their HTML entities.
data = data.replace( //g, '>' ) ;
// Convert line breaks to
.
data = data.replace( /(?:\r\n|\n|\r)/g, '
' ) ;
// [url]
data = data.replace( /\[url\](.+?)\[\/url]/gi, '$1' ) ;
data = data.replace( /\[url\=([^\]]+)](.+?)\[\/url]/gi, '$2' ) ;
// [b]
data = data.replace( /\[b\](.+?)\[\/b]/gi, '$1' ) ;
// [i]
data = data.replace( /\[i\](.+?)\[\/i]/gi, '$1' ) ;
// [u]
data = data.replace( /\[u\](.+?)\[\/u]/gi, '$1' ) ;
return '
, so let's use
.
FCKConfig.EnterMode = 'br' ;
// To avoid pasting invalid markup (which is discarded in any case), let's
// force pasting to plain text.
FCKConfig.ForcePasteAsPlainText = true ;
// Rename the "Source" buttom to "BBCode".
FCKToolbarItems.RegisterItem( 'Source', new FCKToolbarButton( 'Source', 'BBCode', null, FCK_TOOLBARITEM_ICONTEXT, true, true, 1 ) ) ;
// Let's enforce the toolbar to the limits of this Data Processor. A custom
// toolbar set may be defined in the configuration file with more or less entries.
FCKConfig.ToolbarSets["Default"] = [
['Source'],
['Bold','Italic','Underline','-','Link'],
['About']
] ;