/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2007 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 == * */ // Register the related commands. FCKCommands.RegisterCommand( 'Plugin_Tool', new FCKDialogCommand( "Plugin Tool", "Plugin Tool", FCKConfig.PluginsPath + 'plugintool/plugin_tool.html', 475, 400 ) ) ; var oPluginTool = new FCKToolbarButton( 'Plugin_Tool', 'Plugin Tool' ) ; oPluginTool.IconPath = FCKConfig.PluginsPath + 'plugintool/plugin.gif' ; FCKToolbarItems.RegisterItem( 'Plugin_Tool', oPluginTool ) ; // 'Format_Table' is the name used in the Toolbar config. // The object used for all Abbr operations. var FCKAbbr = new Object() ; // Insert a new Abbr FCKAbbr.Insert = function(val, isSafari, stet) { val = val.replace(/^\s+/,''); val = val.replace(/\s+$/,''); if(val) { val = '"' + val + '"'; } var hrefStartHtml = (val == '') ? '' : ''; var hrefEndHtml = (val == '') ? '' : ' '; var reset = false; mySelection = ( FCKBrowserInfo.IsIE) ? FCKSelection.GetSelectedHTML(isSafari) : removeBR(FCKSelection.GetSelectedHTML(isSafari)); mySelection = mySelection.replace(/^\s+/,""); mySelection = mySelection.replace(/\s+$/,""); if(mySelection.match(/<\/FCK:plugin>/)) { reset = true; } mySelection = mySelection.replace(/<\/FCK:plugin>/gi,""); mySelection = mySelection.replace(//gi,""); if(!stet) { mySelection = mySelection.replace(/<\/P>/gi,"

"); mySelection = mySelection.replace(/^/gi,"

"); mySelection = mySelection.replace(/ /gi, ""); // for IE in mySelection = mySelection.replace(//gi, ""); mySelection = mySelection.replace(/

/gi," <p> "); mySelection = mySelection.replace(//gi," "); mySelection = mySelection.replace(/
/g,"
"); mySelection = mySelection.replace(//g,"
"); } if(FCKBrowserInfo.IsIE && reset) { hrefHtml = mySelection; } else { hrefHtml = hrefStartHtml+mySelection+hrefEndHtml; } ////////////////////////////////////////////////////// // choose one of these two lines; in fckeditor 2.5 both lines can be skipped!!! // // hrefHtml = FCK.ProtectTags(hrefStartHtml) ; // needed because in fckeditor 2.4 protected tags only works with SetHTML hrefHtml = ProtectTags( hrefHtml ) ; // needed because IE doesn't support and it breaks it. ///////////////////////////////////////////////////// FCK.InsertHtml(hrefHtml); } FCKAbbr.InsertEdited = function(val) { //mySelection = ( FCKBrowserInfo.IsIE) ? FCKSelection.GetSelectedHTML() : removeBR(FCKSelection.GetSelectedHTML()); val = val.replace(/ and it breaks it. Let's protect it. if ( FCKBrowserInfo.IsIE ) { var sTags = 'plugin' ; var oRegex = new RegExp( '<(' + sTags + ')([ \>])', 'gi' ) ; html = html.replace( oRegex, '', 'gi' ) ; html = html.replace( oRegex, '<\/FCK:$1>' ) ; } return html ; }