2
0
forked from Wavyzz/dolibarr

Mise jour de fckeditor la version 2.4

This commit is contained in:
Regis Houssin
2007-03-17 20:10:20 +00:00
parent f0c10f24ce
commit e97b651f1f
211 changed files with 52967 additions and 48492 deletions

View File

@@ -1,14 +1,22 @@
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
* == BEGIN LICENSE ==
*
* For further information visit:
* http://www.fckeditor.net/
* Licensed under the terms of any of the following licenses at your
* choice:
*
* "Support Open Source software. What about a donation today?"
* - 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 ==
*
* File Name: fckeditor.js
* This is the integration file for JavaScript.
@@ -18,7 +26,7 @@
* operations, use the specific integration system.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
* Frederico Caldeira Knabben (www.fckeditor.net)
*/
// FCKeditor Class
@@ -42,34 +50,41 @@ var FCKeditor = function( instanceName, width, height, toolbarSet, value )
this.OnError = null ; // function( source, errorNumber, errorDescription )
}
FCKeditor.prototype.Version = '2.3' ;
FCKeditor.prototype.VersionBuild = '1054' ;
FCKeditor.prototype.Version = '2.4' ;
FCKeditor.prototype.VersionBuild = '1148' ;
FCKeditor.prototype.Create = function()
{
document.write( this.CreateHtml() ) ;
}
FCKeditor.prototype.CreateHtml = function()
{
// Check for errors
if ( !this.InstanceName || this.InstanceName.length == 0 )
{
this._ThrowError( 701, 'You must specify an instance name.' ) ;
return ;
return '' ;
}
document.write( '<div>' ) ;
var sHtml = '<div>' ;
if ( !this.CheckBrowser || this._IsCompatibleBrowser() )
{
document.write( '<input type="hidden" id="' + this.InstanceName + '" name="' + this.InstanceName + '" value="' + this._HTMLEncode( this.Value ) + '" style="display:none" />' ) ;
document.write( this._GetConfigHtml() ) ;
document.write( this._GetIFrameHtml() ) ;
sHtml += '<input type="hidden" id="' + this.InstanceName + '" name="' + this.InstanceName + '" value="' + this._HTMLEncode( this.Value ) + '" style="display:none" />' ;
sHtml += this._GetConfigHtml() ;
sHtml += this._GetIFrameHtml() ;
}
else
{
var sWidth = this.Width.toString().indexOf('%') > 0 ? this.Width : this.Width + 'px' ;
var sHeight = this.Height.toString().indexOf('%') > 0 ? this.Height : this.Height + 'px' ;
document.write('<textarea name="' + this.InstanceName + '" rows="4" cols="40" style="WIDTH: ' + sWidth + '; HEIGHT: ' + sHeight + '">' + this._HTMLEncode( this.Value ) + '<\/textarea>') ;
sHtml += '<textarea name="' + this.InstanceName + '" rows="4" cols="40" style="width:' + sWidth + ';height:' + sHeight + '">' + this._HTMLEncode( this.Value ) + '<\/textarea>' ;
}
document.write( '</div>' ) ;
sHtml += '</div>' ;
return sHtml ;
}
FCKeditor.prototype.ReplaceTextarea = function()
@@ -82,7 +97,7 @@ FCKeditor.prototype.ReplaceTextarea = function()
var i = 0;
while ( oTextarea || i == 0 )
{
if ( oTextarea && oTextarea.tagName == 'TEXTAREA' )
if ( oTextarea && oTextarea.tagName.toLowerCase() == 'textarea' )
break ;
oTextarea = colElementsByName[i++] ;
}
@@ -118,7 +133,7 @@ FCKeditor.prototype._GetConfigHtml = function()
for ( var o in this.Config )
{
if ( sConfig.length > 0 ) sConfig += '&amp;' ;
sConfig += escape(o) + '=' + escape( this.Config[o] ) ;
sConfig += encodeURIComponent( o ) + '=' + encodeURIComponent( this.Config[o] ) ;
}
return '<input type="hidden" id="' + this.InstanceName + '___Config" value="' + sConfig + '" style="display:none" />' ;
@@ -126,42 +141,24 @@ FCKeditor.prototype._GetConfigHtml = function()
FCKeditor.prototype._GetIFrameHtml = function()
{
var sFile = (/fcksource=true/i).test( window.top.location.search ) ? 'fckeditor.original.html' : 'fckeditor.html' ;
var sFile = 'fckeditor.html' ;
try
{
if ( (/fcksource=true/i).test( window.top.location.search ) )
sFile = 'fckeditor.original.html' ;
}
catch (e) { /* Ignore it. Much probably we are inside a FRAME where the "top" is in another domain (security error). */ }
var sLink = this.BasePath + 'editor/' + sFile + '?InstanceName=' + this.InstanceName ;
if (this.ToolbarSet) sLink += '&Toolbar=' + this.ToolbarSet ;
var sLink = this.BasePath + 'editor/' + sFile + '?InstanceName=' + encodeURIComponent( this.InstanceName ) ;
if (this.ToolbarSet) sLink += '&amp;Toolbar=' + this.ToolbarSet ;
return '<iframe id="' + this.InstanceName + '___Frame" src="' + sLink + '" width="' + this.Width + '" height="' + this.Height + '" frameborder="0" scrolling="no"></iframe>' ;
}
FCKeditor.prototype._IsCompatibleBrowser = function()
{
var sAgent = navigator.userAgent.toLowerCase() ;
// Internet Explorer
if ( sAgent.indexOf("msie") != -1 && sAgent.indexOf("mac") == -1 && sAgent.indexOf("opera") == -1 )
{
var sBrowserVersion = navigator.appVersion.match(/MSIE (.\..)/)[1] ;
return ( sBrowserVersion >= 5.5 ) ;
}
// Gecko
if ( navigator.product == "Gecko" && navigator.productSub >= 20030210 )
return true ;
// Opera
if ( this.EnableOpera )
{
var aMatch = sAgent.match( /^opera\/(\d+\.\d+)/ ) ;
if ( aMatch && aMatch[1] >= 9.0 )
return true ;
}
// Safari
if ( this.EnableSafari && sAgent.indexOf( 'safari' ) != -1 )
return ( sAgent.match( /safari\/(\d+)/ )[1] >= 312 ) ; // Build must be at least 312 (1.3)
return false ;
return FCKeditor_IsCompatibleBrowser( this.EnableSafari, this.EnableOpera ) ;
}
FCKeditor.prototype._ThrowError = function( errorNumber, errorDescription )
@@ -185,11 +182,37 @@ FCKeditor.prototype._HTMLEncode = function( text )
if ( typeof( text ) != "string" )
text = text.toString() ;
text = text.replace(/&/g, "&amp;") ;
text = text.replace(/"/g, "&quot;") ;
text = text.replace(/</g, "&lt;") ;
text = text.replace(/>/g, "&gt;") ;
text = text.replace(/'/g, "&#39;") ;
text = text.replace(
/&/g, "&amp;").replace(
/"/g, "&quot;").replace(
/</g, "&lt;").replace(
/>/g, "&gt;") ;
return text ;
}
function FCKeditor_IsCompatibleBrowser( enableSafari, enableOpera )
{
var sAgent = navigator.userAgent.toLowerCase() ;
// Internet Explorer
if ( sAgent.indexOf("msie") != -1 && sAgent.indexOf("mac") == -1 && sAgent.indexOf("opera") == -1 )
{
var sBrowserVersion = navigator.appVersion.match(/MSIE (.\..)/)[1] ;
return ( sBrowserVersion >= 5.5 ) ;
}
// Gecko (Opera 9 tries to behave like Gecko at this point).
if ( navigator.product == "Gecko" && navigator.productSub >= 20030210 && !( typeof(opera) == 'object' && opera.postError ) )
return true ;
// Opera
if ( enableOpera && navigator.appName == 'Opera' && parseInt( navigator.appVersion, 10 ) >= 9 )
return true ;
// Safari
if ( enableSafari && sAgent.indexOf( 'safari' ) != -1 )
return ( sAgent.match( /safari\/(\d+)/ )[1] >= 312 ) ; // Build must be at least 312 (1.3)
return false ;
}