Update of /cvsroot/phpslash/phpslash-dev/public_html/scripts/fckeditor/editor/_source/internals
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16237/phpslash-dev/public_html/scripts/fckeditor/editor/_source/internals
Added Files:
fck.js fck_1.js fck_1_gecko.js fck_1_ie.js fck_2.js
fck_2_gecko.js fck_2_ie.js fck_last.js fck_onload.js
fckbrowserinfo.js fckcommands.js fckconfig.js
fckcontextmenu.js fckcontextmenu_gecko.js fckcontextmenu_ie.js
fckdebug.js fckdialog.js fckdialog_gecko.js fckdialog_ie.js
fcklanguagemanager.js fckscriptloader.js fckselection.js
fckselection_gecko.js fckselection_ie.js fcktoolbaritems.js
fcktoolbarset.js fcktools.js fcktools_gecko.js fcktools_ie.js
fckurlparams.js fckxhtml.js
Log Message:
added fckeditor to comment submittal.
--- NEW FILE: fck.js ---
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2004 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* File Name: fck.js
* Creation and initialization of the "FCK" object. This is the main object
* that represents an editor instance.
*
* Version: 2.0 Beta 1
* Modified: 2004-05-31 23:07:48
*
* File Authors:
* Frederico Caldeira Knabben (fr...@fc...)
*/
// FCK represents the active editor instance
var FCK = new Object() ;
FCK.Name = FCKURLParams[ 'InstanceName' ] ;
FCK.LinkedField = window.parent.document.getElementById( FCK.Name ) ;
FCK.Status = FCK_STATUS_NOTLOADED ;
FCK.EditMode = FCK_EDITMODE_WYSIWYG ;
FCK.PasteEnabled = false ;
--- NEW FILE: fck_1.js ---
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2004 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* File Name: fck_1.js
* This is the first part of the "FCK" object creation. This is the main
* object that represents an editor instance.
*
* Version: 2.0 Beta 1
* Modified: 2004-05-31 23:07:48
*
* File Authors:
* Frederico Caldeira Knabben (fr...@fc...)
*/
FCK.Events = new FCKEvents( FCK ) ;
FCK.Toolbar = null ;
FCK.SetStatus = function( newStatus )
{
this.Status = newStatus ;
if ( newStatus == FCK_STATUS_ACTIVE )
{
if ( FCKBrowserInfo.IsIE )
FCKScriptLoader.AddScript( 'js/fckeditorcode_ie_2.js' ) ;
else
FCKScriptLoader.AddScript( 'js/fckeditorcode_gecko_2.js' ) ;
}
this.Events.FireEvent( 'OnStatusChange', newStatus ) ;
if ( this.OnStatusChange ) this.OnStatusChange( newStatus ) ;
}
FCK.SetHTML = function( html, forceWYSIWYG )
{
if ( forceWYSIWYG || FCK.EditMode == FCK_EDITMODE_WYSIWYG )
{
// On Gecko we must disable editing before setting the innerHTML.
if ( FCKBrowserInfo.IsGecko )
FCK.EditorDocument.designMode = "off" ;
this.EditorDocument.body.innerHTML = html ;
// On Gecko we must set the desingMode on again after setting the innerHTML.
if ( FCKBrowserInfo.IsGecko )
FCK.EditorDocument.designMode = "on" ;
}
else
document.getElementById('eSourceField').value = html ;
}
FCK.GetHTML = function()
{
if ( FCK.EditMode == FCK_EDITMODE_WYSIWYG )
return this.EditorDocument.body.innerHTML ;
else
return document.getElementById('eSourceField').value ;
}
FCK.GetXHTML = function()
{
var bSource = ( FCK.EditMode == FCK_EDITMODE_SOURCE ) ;
if ( bSource )
this.SwitchEditMode() ;
var sXHTML = FCKXHtml.GetXHTML( this.EditorDocument.body ) ;
if ( bSource )
this.SwitchEditMode() ;
return sXHTML ;
}
FCK.UpdateLinkedField = function()
{
if ( FCKConfig.EnableXHTML )
FCKTools.SetLinkedFieldValue( FCK.GetXHTML() ) ;
else
FCKTools.SetLinkedFieldValue( FCK.GetHTML() ) ;
}
FCK.Focus = function()
{
if ( FCK.EditMode == FCK_EDITMODE_WYSIWYG )
FCK.EditorDocument.body.focus() ;
else
document.getElementById('eSource').focus() ;
}
FCK.ShowContextMenu = function( x, y )
{
if ( this.Status != FCK_STATUS_COMPLETE )
return ;
FCKContextMenu.Show( x, y ) ;
this.Events.FireEvent( "OnContextMenu" ) ;
}
--- NEW FILE: fck_1_gecko.js ---
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2004 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* File Name: fck_1_gecko.js
* This is the first part of the "FCK" object creation. This is the main
* object that represents an editor instance.
* (Gecko specific implementations)
*
* Version: 2.0 Beta 1
* Modified: 2004-05-31 23:07:48
*
* File Authors:
* Frederico Caldeira Knabben (fr...@fc...)
*/
FCK.Description = "FCKeditor for Gecko Browsers" ;
FCK.StartEditor = function()
{
// Get the editor's window and document (DOM)
this.EditorWindow = window.frames[ 'eEditorArea' ] ;
this.EditorDocument = this.EditorWindow.document ;
// Sets the editor's startup contents
this.SetHTML( FCKTools.GetLinkedFieldValue() ) ;
// Attach the editor to the form onsubmit event
FCKTools.AttachToLinkedFieldFormSubmit( this.UpdateLinkedField ) ;
// Disable Right-Click
var oOnContextMenu = function( e )
{
e.preventDefault() ;
FCK.ShowContextMenu( e.clientX, e.clientY ) ;
}
this.EditorDocument.addEventListener( 'contextmenu', oOnContextMenu, true ) ;
var oOnKeyDown = function( e )
{
if ( e.ctrlKey && !e.shiftKey && !e.altKey )
{
// Char 86/118 = V/v
if ( e.which == 86 || e.which == 118 )
{
if ( FCK.Status == FCK_STATUS_COMPLETE )
{
if ( !FCK.Events.FireEvent( "OnPaste" ) )
e.preventDefault() ;
}
else
e.preventDefault() ;
}
}
}
this.EditorDocument.addEventListener( 'keydown', oOnKeyDown, true ) ;
var oOnSelectionChange = function( e )
{
/*
var bIsDifferent = false ;
var oActualSel = FCK.EditorWindow.getSelection() ;
if ( FCK.LastSelection )
{
if ( FCK.LastSelection.rangeCount != oActualSel.rangeCount )
{
bIsDifferent = true ;
}
else
{
if ( oActualSel.rangeCount == 1 )
{
var oRangeA = oActualSel.getRangeAt(0) ;
var oRangeB = FCK.LastSelection.getRangeAt(0) ;
FCKDebug.Output( 'collapsed: ' + oRangeA.collapsed ) ;
if ( oRangeA.collapsed )
{
FCKDebug.Output( 'startContainerBranch: ' + oRangeA.startContainerBranch + ' == ' + oRangeB.startContainerBranch ) ;
FCKDebug.Output( 'Container: ' + oRangeA.startContainer.childNodes[ oRangeA.startOffset ] + ' == ' + oRangeB.commonAncestorContainer.parent ) ;
if
(
!oRangeB.collapsed ||
oRangeA.startContainer.childNodes[ oRangeA.startOffset ] != oRangeB.startContainer.childNodes[ oRangeB.startOffset ] ||
oRangeA.commonAncestorContainer.parent != oRangeB.commonAncestorContainer.parent )
{
bIsDifferent = true ;
}
}
else
{
bIsDifferent = true ;
}
}
else
{
bIsDifferent == true ;
}
}
}
else
{
bIsDifferent = true ;
}
FCK.LastSelection = oActualSel ;
FCKDebug.Output( 'bIsDifferent: ' + bIsDifferent ) ;
if ( bIsDifferent )
{*/
FCK.Events.FireEvent( "OnSelectionChange" ) ;
//}
}
this.EditorDocument.addEventListener( 'mouseup', oOnSelectionChange, false ) ;
this.EditorDocument.addEventListener( 'keyup', oOnSelectionChange, false ) ;
//Enable editing
this.EditorDocument.designMode = "on" ;
this.SetStatus( FCK_STATUS_ACTIVE ) ;
}
--- NEW FILE: fck_1_ie.js ---
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2004 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* File Name: fck_1_ie.js
* This is the first part of the "FCK" object creation. This is the main
* object that represents an editor instance.
* (IE specific implementations)
*
* Version: 2.0 Beta 1
* Modified: 2004-05-31 23:07:48
*
* File Authors:
* Frederico Caldeira Knabben (fr...@fc...)
*/
FCK.Description = "FCKeditor for Internet Explorer 5.5+" ;
FCK.StartEditor = function()
{
// Get the editor's window and document (DOM)
this.EditorWindow = window.frames[ 'eEditorArea' ] ;
this.EditorDocument = this.EditorWindow.document ;
// Set the editor's startup contents
this.SetHTML( FCKTools.GetLinkedFieldValue() ) ;
// Attach the editor to the form onsubmit event
FCKTools.AttachToLinkedFieldFormSubmit( this.UpdateLinkedField ) ;
// Intercept pasting operations
this.EditorDocument.body.onpaste = function()
{
if ( FCK.Status == FCK_STATUS_COMPLETE )
return FCK.Events.FireEvent( "OnPaste" ) ;
else
return false ;
}
// Disable Right-Click and shows the context menu.
this.EditorDocument.oncontextmenu = function()
{
var e = this.parentWindow.event ;
FCK.ShowContextMenu( e.screenX, e.screenY ) ;
return false ;
}
// Intercept cursor movements
this.EditorDocument.onselectionchange = function()
{
FCK.Events.FireEvent( "OnSelectionChange" ) ;
}
//Enable editing
this.EditorDocument.body.contentEditable = true ;
this.SetStatus( FCK_STATUS_ACTIVE ) ;
}
--- NEW FILE: fck_2.js ---
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2004 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* File Name: fck_2.js
* This is the second part of the "FCK" object creation. This is the main
* object that represents an editor instance.
*
* Version: 2.0 Beta 1
* Modified: 2004-05-31 23:07:49
*
* File Authors:
* Frederico Caldeira Knabben (fr...@fc...)
*/
FCK.ExecuteNamedCommand = function( commandName, commandParameter )
{
this.EditorDocument.execCommand( commandName, false, commandParameter ) ;
this.Events.FireEvent( 'OnSelectionChange' ) ;
}
FCK.GetNamedCommandState = function( commandName )
{
try
{
if ( !FCK.EditorDocument.queryCommandEnabled( commandName ) )
return FCK_TRISTATE_DISABLED ;
else
return FCK.EditorDocument.queryCommandState( commandName ) ? FCK_TRISTATE_ON : FCK_TRISTATE_OFF ;
}
catch ( e )
{
return FCK_TRISTATE_OFF ;
}
}
FCK.GetNamedCommandValue = function( commandName )
{
var sValue = '' ;
var eState = FCK.GetNamedCommandState( commandName ) ;
if ( eState == FCK_TRISTATE_DISABLED )
return null ;
try
{
sValue = this.EditorDocument.queryCommandValue( commandName ) ;
}
catch(e) {}
return sValue ? sValue : '' ;
}
FCK.CreateLink = function( url )
{
if ( url.length == 0 )
this.ExecuteNamedCommand( 'Unlink' ) ;
else
{
this.ExecuteNamedCommand( 'CreateLink', "javascript:void(0);/*fckeditortemplink*/" ) ;
var oLinks = this.EditorDocument.links ;
for ( i = 0 ; i < oLinks.length ; i++ )
{
if ( oLinks[i].href == "javascript:void(0);/*fckeditortemplink*/" )
{
oLinks[i].href = url ;
return oLinks[i] ;
}
}
}
}
FCK.CleanAndPaste = function( html )
{
// Remove all SPAN tags
html = html.replace(/<\/?SPAN[^>]*>/gi, "" );
// Remove Class attributes
html = html.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3") ;
// Remove Style attributes
html = html.replace(/<(\w[^>]*) style="([^"]*)"([^>]*)/gi, "<$1$3") ;
// Remove Lang attributes
html = html.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3") ;
// Remove XML elements and declarations
html = html.replace(/<\\?\?xml[^>]*>/gi, "") ;
// Remove Tags with XML namespace declarations: <o:p></o:p>
html = html.replace(/<\/?\w+:[^>]*>/gi, "") ;
// Replace the
html = html.replace(/ /, " " );
// Transform <P> to <DIV>
var re = new RegExp("(<P)([^>]*>.*?)(<\/P>)","gi") ; // Different because of a IE 5.0 error
html = html.replace( re, "<div$2</div>" ) ;
this.InsertHtml( html ) ;
}
FCK.Preview = function()
{
var oWindow = window.open( '', null, 'toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes' ) ;
oWindow.document.write( FCK.GetHTML() );
oWindow.document.close();
// TODO: The CSS of the editor area must be configurable.
// oWindow.document.createStyleSheet( config.EditorAreaCSS );
}
FCK.SwitchEditMode = function()
{
// Check if the actual mode is WYSIWYG.
var bWYSIWYG = ( FCK.EditMode == FCK_EDITMODE_WYSIWYG ) ;
// Display/Hide the TRs.
document.getElementById('eWysiwyg').style.display = bWYSIWYG ? "none" : "" ;
document.getElementById('eSource').style.display = bWYSIWYG ? "" : "none" ;
// Update the HTML in the view output to show.
if ( bWYSIWYG )
document.getElementById('eSourceField').value = ( FCKConfig.EnableXHTML && FCKConfig.EnableSourceXHTML ? FCK.GetXHTML() : FCK.GetHTML() ) ;
else
FCK.SetHTML( FCK.GetHTML(), true ) ;
// Updates the actual mode status.
FCK.EditMode = bWYSIWYG ? FCK_EDITMODE_SOURCE : FCK_EDITMODE_WYSIWYG ;
// Set the Focus.
FCK.Focus() ;
// Update the toolbar.
FCKToolbarSet.RefreshItemsState() ;
}
--- NEW FILE: fck_2_gecko.js ---
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2004 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* File Name: fck_2_gecko.js
* This is the second part of the "FCK" object creation. This is the main
* object that represents an editor instance.
* (Gecko specific implementations)
*
* Version: 2.0 Beta 1
* Modified: 2004-05-31 23:07:49
*
* File Authors:
* Frederico Caldeira Knabben (fr...@fc...)
*/
// GetNamedCommandState overload for Gecko.
FCK._BaseGetNamedCommandState = FCK.GetNamedCommandState ;
FCK.GetNamedCommandState = function( commandName )
{
switch ( commandName )
{
case 'Unlink' :
return FCKSelection.HasAncestorNode('A') ? FCK_TRISTATE_OFF : FCK_TRISTATE_DISABLED ;
default :
return FCK._BaseGetNamedCommandState( commandName ) ;
}
}
// ExecuteNamedCommand overload for Gecko.
FCK._BaseExecuteNamedCommand = FCK.ExecuteNamedCommand ;
FCK.ExecuteNamedCommand = function( commandName, commandParameter )
{
switch ( commandName )
{
case 'Print' :
FCK.EditorWindow.print();
default :
FCK._BaseExecuteNamedCommand( commandName, commandParameter ) ;
}
}
FCK.Focus = function()
{
this.EditorWindow.focus() ;
}
FCK.AttachToOnSelectionChange = function( functionPointer )
{
this.Events.AttachEvent( 'OnSelectionChange', functionPointer ) ;
}
FCK.Paste = function()
{
FCKDebug.Output( 'FCK.Paste' ) ;
if ( FCKConfig.ForcePasteAsPlainText )
{
FCK.PasteAsPlainText() ;
return false ;
}
else if ( FCKConfig.AutoDetectPasteFromWord && FCKBrowserInfo.IsIE55OrMore )
{
var sHTML = FCK.GetClipboardHTML() ;
var re = /<\w[^>]* class="?MsoNormal"?/gi ;
if ( re.test( sHTML ) )
{
if ( confirm( FCKLang["PasteWordConfirm"] ) )
{
FCK.CleanAndPaste( sHTML ) ;
return false ;
}
}
}
else
return true ;
}
//**
// FCK.InsertHtml: Inserts HTML at the current cursor location. Deletes the
// selected content if any.
FCK.InsertHtml = function( html )
{
// Delete the actual selection.
var oSel = FCKSelection.Delete() ;
// var oContainer = oSel.getRangeAt(0).startContainer ;
// var iOffSet = oSel.getRangeAt(0).startOffset ;
// Get the first available range.
var oRange = oSel.getRangeAt(0) ;
// var oRange = this.EditorDocument.createRange() ;
// oRange.setStart( oContainer, iOffSet ) ;
// oRange.setEnd( oContainer, iOffSet ) ;
// Create a fragment with the input HTML.
var oFragment = oRange.createContextualFragment( html ) ;
// Get the last available node.
var oLastNode = oFragment.lastChild ;
// Insert the fragment in the range.
oRange.insertNode(oFragment) ;
// Set the cursor after the inserted fragment.
oRange.setEndAfter( oLastNode ) ;
oRange.setStartAfter( oLastNode ) ;
oSel.removeAllRanges() ;
oSel = FCK.EditorWindow.getSelection() ;
oSel.addRange( oRange ) ;
this.Focus() ;
}
FCK.InsertElement = function( element )
{
// Deletes the actual selection.
var oSel = FCKSelection.Delete() ;
// Gets the first available range.
var oRange = oSel.getRangeAt(0) ;
// Inserts the element in the range.
oRange.insertNode( element ) ;
// Set the cursor after the inserted fragment.
oRange.setEndAfter( element ) ;
oRange.setStartAfter( element ) ;
this.Focus() ;
}
FCK.PasteAsPlainText = function()
{
/*
var sText = FCKTools.HTMLEncode( clipboardData.getData("Text") ) ;
FCKDebug.Output( 'FCK.PasteAsPlainText: ' + sText ) ;
sText = sText.replace( /\n/g, '<BR>' ) ;
this.InsertHtml( sText ) ;
*/
}
FCK.GetClipboardHTML = function()
{
return '' ;
}
--- NEW FILE: fck_2_ie.js ---
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2004 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* File Name: fck_2_ie.js
* This is the second part of the "FCK" object creation. This is the main
* object that represents an editor instance.
* (IE specific implementations)
*
* Version: 2.0 Beta 1
* Modified: 2004-05-31 23:07:49
*
* File Authors:
* Frederico Caldeira Knabben (fr...@fc...)
*/
FCK.Paste = function()
{
if ( FCKConfig.ForcePasteAsPlainText )
{
FCK.PasteAsPlainText() ;
return false ;
}
else if ( FCKConfig.AutoDetectPasteFromWord && FCKBrowserInfo.IsIE55OrMore )
{
var sHTML = FCK.GetClipboardHTML() ;
var re = /<\w[^>]* class="?MsoNormal"?/gi ;
if ( re.test( sHTML ) )
{
if ( confirm( FCKLang["PasteWordConfirm"] ) )
{
FCK.CleanAndPaste( sHTML ) ;
return false ;
}
}
}
else
return true ;
}
FCK.PasteAsPlainText = function()
{
var sText = FCKTools.HTMLEncode( clipboardData.getData("Text") ) ;
FCKDebug.Output( 'FCK.PasteAsPlainText: ' + sText ) ;
sText = sText.replace( /\n/g, '<BR>' ) ;
this.InsertHtml( sText ) ;
}
FCK.InsertHtml = function( html )
{
var oSel = FCKSelection.Delete() ;
oSel.createRange().pasteHTML( html ) ;
this.Focus() ;
}
FCK.InsertElement = function( element )
{
this.InsertHtml( element.outerHTML ) ;
}
FCK.GetClipboardHTML = function()
{
var oDiv = document.getElementById( '___FCKHiddenDiv' ) ;
if ( !oDiv )
{
var oDiv = document.createElement( 'DIV' ) ;
divEdit.id = '___FCKHiddenDiv' ;
oDiv.style.display = 'none' ;
oDiv.style.visibility = 'hidden' ;
oDiv.style.overflow = 'hidden' ;
oDiv.style.position = 'absolute' ;
oDiv.style.width = 1 ;
oDiv.style.height = 1 ;
document.body.appendChild( oDiv ) ;
// Get the element again (must be done to work)
oDiv = document.getElementById( '___FCKHiddenDiv' ) ;
}
var oTextRange = document.body.createTextRange() ;
oTextRange.moveToElementText( oDiv ) ;
oTextRange.execCommand( 'Paste' ) ;
var sData = oDiv.innerHTML ;
oDiv.innerHTML = '' ;
return sData ;
}
FCK.AttachToOnSelectionChange = function( functionPointer )
{
this.EditorDocument.attachEvent( 'onselectionchange', functionPointer ) ;
}
--- NEW FILE: fck_last.js ---
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2004 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* File Name: fck_last.js
* These are the last script lines executed in the editor loading process.
*
* Version: 2.0 Beta 1
* Modified: 2004-05-31 23:07:49
*
* File Authors:
* Frederico Caldeira Knabben (fr...@fc...)
*/
// This is the last file loaded to complete the editor initialization and activation
// Activate pasting operations.
if ( FCKConfig.ForcePasteAsPlainText )
FCK.Events.AttachEvent( "OnPaste", FCK.Paste ) ;
// Load the Toolbar
FCKToolbarSet.Name = FCKURLParams['Toolbar'] || 'Default' ;
FCKToolbarSet.Load( FCKToolbarSet.Name ) ;
FCKToolbarSet.Restart() ;
FCK.AttachToOnSelectionChange( FCKToolbarSet.RefreshItemsState ) ;
// Set some object references to the editor instance object (FCK).
FCK.Config = FCKConfig ;
FCK.ToolbarSet = FCKToolbarSet ;
FCK.SetStatus( FCK_STATUS_COMPLETE ) ;
// Call the special "FCKeditor_OnComplete" function that should be present in
// the HTML page where the editor is located.
if ( typeof( window.parent.FCKeditor_OnComplete ) == 'function' )
window.parent.FCKeditor_OnComplete( FCK ) ;
--- NEW FILE: fck_onload.js ---
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2004 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* File Name: fck_onload.js
* This is the script that is called when the editor page is loaded inside
* its IFRAME. It's the editor startup.
*
* Version: 2.0 Beta 1
* Modified: 2004-05-31 23:07:49
*
* File Authors:
* Frederico Caldeira Knabben (fr...@fc...)
*/
// Disable the context menu in the editor (areas outside the editor area).
window.document.oncontextmenu = function( e )
{
if ( e )
e.preventDefault() ; // This is the Gecko way to do that.
return false ; // This is the IE way to do that.
}
// Gecko browsers doens't calculate well that IFRAME size so we must
// recalculate it every time the window size changes.
if ( ! FCKBrowserInfo.IsIE )
{
window.onresize = function()
{
var oFrame = document.getElementById("eEditorArea") ;
oFrame.height = 0 ;
var oCell = document.getElementById("eWysiwygCell") ;
var iHeight = oCell.offsetHeight ;
oFrame.height = iHeight - 2 ;
}
}
// Start the editor as soon as the window is loaded.
window.onload = function()
{
FCKScriptLoader.OnEmpty = function()
{
// Override the configurations passed throw the hidden field.
FCKConfig.LoadHiddenField() ;
// Load the styles for the configured skin.
LoadStyles() ;
}
// First of all load the configuration file.
FCKScriptLoader.AddScript( '../fckconfig.js' ) ;
}
function LoadStyles()
{
FCKScriptLoader.OnEmpty = LoadScripts ;
// Load the active skin CSS.
FCKScriptLoader.AddScript( FCKConfig.SkinPath + 'fck_editor.css' ) ;
FCKScriptLoader.AddScript( FCKConfig.SkinPath + 'fck_contextmenu.css' ) ;
}
function LoadScripts()
{
FCKScriptLoader.OnEmpty = function()
{
// Removes the OnEmpty listener.
this.OnEmpty = null ;
// Correct the editor layout to the correct language direction.
window.document.dir = FCKLang.Dir ;
// Starts the editor.
FCK.StartEditor() ;
}
if ( FCKBrowserInfo.IsIE )
FCKScriptLoader.AddScript( 'js/fckeditorcode_ie_1.js' ) ;
else
FCKScriptLoader.AddScript( 'js/fckeditorcode_gecko_1.js' ) ;
}
--- NEW FILE: fckbrowserinfo.js ---
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2004 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* File Name: fckbrowserinfo.js
* Defines the FCKBrowserInfo object that hold some browser informations.
*
* Version: 2.0 Beta 1
* Modified: 2004-05-31 23:07:49
*
* File Authors:
* Frederico Caldeira Knabben (fr...@fc...)
*/
var FCKBrowserInfo = new Object() ;
var sAgent = navigator.userAgent.toLowerCase() ;
FCKBrowserInfo.IsIE = sAgent.indexOf("msie") != -1 ;
FCKBrowserInfo.IsGecko = ! FCKBrowserInfo.IsIE ;
if ( FCKBrowserInfo.IsIE )
{
FCKBrowserInfo.MajorVer = navigator.appVersion.match(/MSIE (.)/)[1] ;
FCKBrowserInfo.MinorVer = navigator.appVersion.match(/MSIE .\.(.)/)[1] ;
}
else
{
// TODO: Other browsers
FCKBrowserInfo.MajorVer = 0 ;
FCKBrowserInfo.MinorVer = 0 ;
}
FCKBrowserInfo.IsIE55OrMore = FCKBrowserInfo.IsIE && ( FCKBrowserInfo.MajorVer > 5 || FCKBrowserInfo.MinorVer >= 5 ) ;
--- NEW FILE: fckcommands.js ---
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2004 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* File Name: fckcommands.js
* Define all commands available in the editor.
*
* Version: 2.0 Beta 1
* Modified: 2004-05-31 23:07:49
*
* File Authors:
* Frederico Caldeira Knabben (fr...@fc...)
*/
var FCKCommands = new Object() ;
/*
Instead of adding a line like this for every named command:
FCKCommands['Bold'] = new FCKNamedCommand( 'Bold' ) ;
... an Array was created to simplify the code (and reduce its size).
*/
var sNamedCommands = [
'Cut','Copy','Paste','Print','Find','SelectAll','RemoveFormat','Unlink','Undo','Redo',
'Bold','Italic','Underline','StrikeThrough','Subscript','Superscript',
'JustifyLeft','JustifyCenter','JustifyRight','JustifyFull','Outdent','Indent',
'InsertOrderedList','InsertUnorderedList','InsertHorizontalRule'] ;
// Loops throw all named items.
for ( i = 0 ; i < sNamedCommands.length ; i++ )
{
FCKCommands[ sNamedCommands[i] ] = new FCKNamedCommand( sNamedCommands[i] ) ;
}
//### Other Commands.
FCKCommands['Link'] = new FCKDialogCommand( 'Link' , FCKLang.DlgLnkWindowTitle, 'dialog/fck_link.html' , 400, 330, FCK.GetNamedCommandState, 'CreateLink' ) ;
FCKCommands['About'] = new FCKDialogCommand( 'About' , FCKLang.About, 'dialog/fck_about.html' , 400, 330 ) ;
FCKCommands['Image'] = new FCKDialogCommand( 'Image' , 'Image Properties', 'dialog/fck_image.html' , 450, 400, FCK.GetNamedCommandState, 'InsertImage' ) ;
FCKCommands['Table'] = new FCKDialogCommand( 'Table' , 'Table Properties', 'dialog/fck_table.html' , 400, 250 ) ;
FCKCommands['TableProp'] = new FCKDialogCommand( 'Table' , 'Table Properties', 'dialog/fck_table.html?Parent', 400, 250 ) ;
FCKCommands['SpecialChar'] = new FCKDialogCommand( 'SpecialChar' , 'Select Character', 'dialog/fck_specialchar.html' , 400, 300, FCK.GetNamedCommandState, 'InsertImage' ) ;
FCKCommands['Smiley'] = new FCKDialogCommand( 'Smiley' , FCKLang.DlgSmileyTitle, 'dialog/fck_smiley.html' , FCKConfig.SmileyWindowWidth, FCKConfig.SmileyWindowHeight, FCK.GetNamedCommandState, 'InsertImage' ) ;
FCKCommands['FontName'] = new FCKFontNameCommand() ;
FCKCommands['FontSize'] = new FCKFontSizeCommand() ;
FCKCommands['FontFormat'] = new FCKFormatBlockCommand() ;
FCKCommands['Source'] = new FCKSourceCommand() ;
FCKCommands['Preview'] = new FCKPreviewCommand() ;
FCKCommands['Save'] = new FCKSaveCommand() ;
FCKCommands['NewPage'] = new FCKNewPageCommand() ;
// Generic Undefined command (usually used when a command is under development).
FCKCommands['Undefined'] = new FCKUndefinedCommand() ;
--- NEW FILE: fckconfig.js ---
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2004 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* File Name: fckconfig.js
* Creates and initializes the FCKConfig object.
*
* Version: 2.0 Beta 1
* Modified: 2004-05-31 23:07:49
*
* File Authors:
* Frederico Caldeira Knabben (fr...@fc...)
*/
var FCKConfig = new Object() ;
// Editor Base Path
if ( document.location.protocol == 'file:' )
{
FCKConfig.BasePath = document.location.pathname.substr(1) ;
FCKConfig.BasePath = FCKConfig.BasePath.replace( /\\/gi, '/' ) ;
FCKConfig.BasePath = 'file://' + FCKConfig.BasePath.substring(0,FCKConfig.BasePath.lastIndexOf('/')+1) ;
}
else
FCKConfig.BasePath = document.location.pathname.substring(0,document.location.pathname.lastIndexOf('/')+1) ;
// Override the actual configuration values with the values passed throw the
// hidden field "<InstanceName>___Config".
FCKConfig.LoadHiddenField = function()
{
// Get the hidden field.
var oConfigField = window.parent.document.getElementById( FCK.Name + '___Config' ) ;
// Do nothing if the config field was not defined.
if ( ! oConfigField ) return ;
var aCouples = oConfigField.value.split('&') ;
for ( var i = 0 ; i < aCouples.length ; i++ )
{
var aConfig = aCouples[i].split('=') ;
var sConfigName = aConfig[0] ;
var sConfigValue = aConfig[1] ;
if ( sConfigValue == "true" ) // If it is a boolean TRUE.
FCKConfig[sConfigName] = true ;
else if ( sConfigValue == "false" ) // If it is a boolean FALSE.
FCKConfig[sConfigName] = false ;
else if ( ! isNaN(sConfigValue) ) // If it is a number.
FCKConfig[sConfigName] = parseInt( sConfigValue ) ;
else // In any other case it is a string.
FCKConfig[sConfigName] = sConfigValue ;
}
}
--- NEW FILE: fckcontextmenu.js ---
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2004 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* File Name: fckcontextmenu.js
* Defines the FCKContextMenu object that is responsible for all
* Context Menu operations.
*
* Version: 2.0 Beta 1
* Modified: 2004-05-31 23:07:49
*
* File Authors:
* Frederico Caldeira Knabben (fr...@fc...)
*/
var FCKContextMenu = new Object() ;
// This property is internally used to indicate that the context menu has been created.
FCKContextMenu._IsLoaded = false ;
// This method creates the context menu inside a DIV tag. Take a look at the end of this file for a sample output.
FCKContextMenu.Reload = function()
{
// Create the Main DIV that holds the Context Menu.
this._Div = this._Document.createElement( 'DIV' ) ;
this._Div.className = 'CM_ContextMenu' ;
this._Div.style.position = 'absolute' ;
this._Div.style.visibility = 'hidden' ;
this._Document.body.appendChild( this._Div );
// Create the main table for the menu items.
var oTable = this._Document.createElement( 'TABLE' ) ;
oTable.cellSpacing = 0 ;
oTable.cellPadding = 0 ;
oTable.border = 0 ;
this._Div.appendChild( oTable ) ;
// Create arrays with all Items to add.
this.Groups = new Object() ;
// Generic items that are always available.
this.Groups['Generic'] = new FCKContextMenuGroup() ;
with ( this.Groups['Generic'] )
{
Add( new FCKContextMenuItem( this, 'Cut' , FCKLang['Cut'] , true ) ) ;
Add( new FCKContextMenuItem( this, 'Copy' , FCKLang['Copy'] , true ) ) ;
Add( new FCKContextMenuItem( this, 'Paste' , FCKLang['Paste'] , true ) ) ;
}
// Link operations.
this.Groups['Link'] = new FCKContextMenuGroup() ;
with ( this.Groups['Link'] )
{
Add( new FCKContextMenuSeparator() ) ;
Add( new FCKContextMenuItem( this, 'Link' , FCKLang['EditLink'] , true ) ) ;
Add( new FCKContextMenuItem( this, 'Unlink' , FCKLang['RemoveLink'] , true ) ) ;
}
// Table Cell operations.
this.Groups['TableCell'] = new FCKContextMenuGroup() ;
with ( this.Groups['TableCell'] )
{
Add( new FCKContextMenuSeparator() ) ;
Add( new FCKContextMenuItem( this, 'Undefined', FCKLang["InsertRow"] ) ) ;
Add( new FCKContextMenuItem( this, 'Undefined', FCKLang["DeleteRows"] ) ) ;
Add( new FCKContextMenuSeparator() ) ;
Add( new FCKContextMenuItem( this, 'Undefined', FCKLang["InsertColumn"] ) ) ;
Add( new FCKContextMenuItem( this, 'Undefined', FCKLang["DeleteColumns"] ) ) ;
Add( new FCKContextMenuSeparator() ) ;
Add( new FCKContextMenuItem( this, 'Undefined', FCKLang["InsertCell"] ) ) ;
Add( new FCKContextMenuItem( this, 'Undefined', FCKLang["DeleteCells"] ) ) ;
Add( new FCKContextMenuItem( this, 'Undefined', FCKLang["MergeCells"] ) ) ;
Add( new FCKContextMenuItem( this, 'Undefined', FCKLang["SplitCell"] ) ) ;
Add( new FCKContextMenuSeparator() ) ;
Add( new FCKContextMenuItem( this, 'Undefined', FCKLang["CellProperties"] ) ) ;
Add( new FCKContextMenuItem( this, 'TableProp', FCKLang["TableProperties"], true ) ) ;
}
// Table operations.
this.Groups['Table'] = new FCKContextMenuGroup() ;
with ( this.Groups['Table'] )
{
Add( new FCKContextMenuSeparator() ) ;
Add( new FCKContextMenuItem( this, 'Table', FCKLang["TableProperties"], true ) ) ;
}
// Image operations.
this.Groups['Image'] = new FCKContextMenuGroup() ;
with ( this.Groups['Image'] )
{
Add( new FCKContextMenuSeparator() ) ;
Add( new FCKContextMenuItem( this, 'Undefined', FCKLang["ImageProperties"] ) ) ;
// Add( new FCKContextMenuItem( this, 'Image', FCKLang["ImageProperties"], true ) ) ;
}
// Select field operations.
this.Groups['Select'] = new FCKContextMenuGroup() ;
with ( this.Groups['Select'] )
{
Add( new FCKContextMenuSeparator() ) ;
Add( new FCKContextMenuItem( this, 'Undefined', "Selection Field Properties" ) ) ;
}
// Textarea operations.
this.Groups['Textarea'] = new FCKContextMenuGroup() ;
with ( this.Groups['Textarea'] )
{
Add( new FCKContextMenuSeparator() ) ;
Add( new FCKContextMenuItem( this, 'Undefined', "Textarea Properties" ) ) ;
}
// Create all table rows (representing the items) in the context menu.
for ( var o in this.Groups )
{
this.Groups[o].CreateTableRows( oTable ) ;
}
this._IsLoaded = true ;
}
FCKContextMenu.RefreshState = function()
{
// Get the actual selected tag (if any).
var oTag = FCKSelection.GetSelectedElement() ;
var sTagName ;
if ( oTag )
{
sTagName = oTag.tagName.toUpperCase() ;
}
// Set items visibility.
this.Groups['Link'].SetVisible( FCK.GetNamedCommandState( 'Unlink' ) != FCK_TRISTATE_DISABLED ) ;
this.Groups['TableCell'].SetVisible( FCKSelection.HasAncestorNode('TD') ) ; // TODO: Table Cell operations are not yet available.
this.Groups['Table'].SetVisible( sTagName == 'TABLE' ) ;
this.Groups['Image'].SetVisible( sTagName == 'IMG' ) ;
this.Groups['Select'].SetVisible( sTagName == 'SELECT' ) ;
this.Groups['Textarea'].SetVisible( sTagName == 'TEXTAREA' ) ;
// Refresh the state of all visible items (active/disactive)
for ( var o in this.Groups )
{
this.Groups[o].RefreshState() ;
}
}
/*
Sample Context Menu Output
-----------------------------------------
<div class="CM_ContextMenu">
<table cellSpacing="0" cellPadding="0" border="0">
<tr class="CM_Disabled">
<td class="CM_Icon"><img alt="" src="icons/button.cut.gif" width="21" height="20" unselectable="on"></td>
<td class="CM_Label" unselectable="on">Cut</td>
</tr>
<tr class="CM_Disabled">
<td class="CM_Icon"><img height="20" alt="" src="icons/button.copy.gif" width="21"></td>
<td class="CM_Label">Copy</td>
</tr>
<tr class="CM_Option" onmouseover="OnOver(this);" onmouseout="OnOut(this);">
<td class="CM_Icon"><img height="20" alt="" src="icons/button.paste.gif" width="21"></td>
<td class="CM_Label">Paste</td>
</tr>
<tr class="CM_Separator">
<td class="CM_Icon"></td>
<td class="CM_Label"><div></div></td>
</tr>
<tr class="CM_Option" onmouseover="OnOver(this);" onmouseout="OnOut(this);">
<td class="CM_Icon"><img height="20" alt="" src="icons/button.print.gif" width="21"></td>
<td class="CM_Label">Print</td>
</tr>
<tr class="CM_Separator">
<td class="CM_Icon"></td>
<td class="CM_Label"><div></div></td>
</tr>
<tr class="CM_Option" onmouseover="OnOver(this);" onmouseout="OnOut(this);">
<td class="CM_Icon"></td>
<td class="CM_Label">Do Something</td>
</tr>
<tr class="CM_Option" onmouseover="OnOver(this);" onmouseout="OnOut(this);">
<td class="CM_Icon"></td>
<td class="CM_Label">Just Testing</td>
</tr>
</table>
</div>
*/
--- NEW FILE: fckcontextmenu_gecko.js ---
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2004 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* File Name: fckcontextmenu_gecko.js
* Context Menu operations. (Gecko specific implementations)
*
* Version: 2.0 Beta 1
* Modified: 2004-05-31 23:07:49
*
* File Authors:
* Frederico Caldeira Knabben (fr...@fc...)
*/
// The Context Menu CSS must be added to the parent document.
FCKTools.AppendStyleSheet( window.parent.document, FCKConfig.SkinPath + 'fck_contextmenu.css' ) ;
FCKContextMenu.Show = function( x, y )
{
if ( ! this._Document )
{
this._Document = window.parent.document ;
}
// Create the context menu if needed.
if ( !this._IsLoaded )
{
this.Reload() ;
this._Div.style.zIndex = 10000 ;
this._Div.oncontextmenu = function() { return false ; }
}
this.RefreshState() ;
// The x and y parameters for Gecko are relative to the client
var oFrames = [ FCK.EditorWindow.frameElement, window.frameElement ] ;
for ( var i = 0 ; i < oFrames.length ; i++ )
{
var oParent = oFrames[i] ;
while ( oParent )
{
x += oParent.offsetLeft ;
y += oParent.offsetTop ;
oParent = oParent.offsetParent ;
}
}
// Verifies if the context menu is completely visible.
var iXSpace = x + this._Div.offsetWidth - this._Div.ownerDocument.defaultView.innerWidth ;
var iYSpace = y + this._Div.offsetHeight - this._Div.ownerDocument.defaultView.innerHeight ;
if ( iXSpace > 0 ) x -= this._Div.offsetWidth ;
if ( iYSpace > 0 ) y -= this._Div.offsetHeight ;
// Set the context menu DIV in the specified location.
this._Div.style.left = x + 'px' ;
this._Div.style.top = y + 'px' ;
// Watch the "OnClick" event for all windows to close the Context Menu.
var oActualWindow = FCK.EditorWindow ;
while ( oActualWindow )
{
oActualWindow.document.addEventListener( 'click', FCKContextMenu._OnDocumentClick, false ) ;
if ( oActualWindow != oActualWindow.parent )
oActualWindow = oActualWindow.parent ;
else if ( oActualWindow.opener == null )
oActualWindow = oActualWindow.opener ;
else
break ;
}
// Show it.
this._Div.style.visibility = '' ;
}
FCKContextMenu._OnDocumentClick = function( event )
{
var e = event.target ;
while ( e )
{
if ( e == FCKContextMenu._Div ) return ;
e = e.parentNode ;
}
FCKContextMenu.Hide() ;
}
FCKContextMenu.Hide = function()
{
this._Div.style.visibility = 'hidden' ;
this._Div.style.left = this._Div.style.top = '1px' ;
}
--- NEW FILE: fckcontextmenu_ie.js ---
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2004 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* File Name: fckcontextmenu_ie.js
* Context Menu operations. (IE specific implementations)
*
* Version: 2.0 Beta 1
* Modified: 2004-05-31 23:07:49
*
* File Authors:
* Frederico Caldeira Knabben (fr...@fc...)
*/
FCKContextMenu.Show = function( x, y )
{
// Create the Popup used to show the menu (this is a IE 5.5+ feature).
if ( ! this._Popup )
{
this._Popup = window.createPopup() ;
this._Document = this._Popup.document ;
this._Document.createStyleSheet( FCKConfig.SkinPath + 'fck_contextmenu.css' ) ;
this._Document.oncontextmenu = function() { return false ; }
}
// Create the context menu if needed.
if ( !this._IsLoaded )
{
this.Reload() ;
this._Div.style.visibility = '' ;
}
this.RefreshState() ;
// IE doenst get the offsetWidth and offsetHeight values if the element is not visible.
// So a temporary element is created to get this for us.
if ( !this._DivCopy )
{
this._DivCopy = document.createElement( 'DIV' ) ;
this._DivCopy.className = 'CM_ContextMenu' ;
this._DivCopy.style.position = 'absolute' ;
this._DivCopy.style.visibility = 'hidden' ;
document.body.appendChild( this._DivCopy );
}
this._DivCopy.innerHTML = this._Div.innerHTML ;
// Show the Popup at the specified location.
this._Popup.show( x, y, this._DivCopy.offsetWidth, this._DivCopy.offsetHeight ) ;
}
FCKContextMenu.Hide = function()
{
if ( this._Popup )
this._Popup.hide() ;
}
--- NEW FILE: fckdebug.js ---
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2004 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* File Name: fckdebug.js
* Debug window control and operations.
*
* Version: 2.0 Beta 1
* Modified: 2004-05-31 23:07:49
*
* File Authors:
* Frederico Caldeira Knabben (fr...@fc...)
*/
var FCKDebug = new Object() ;
if ( FCKConfig.Debug )
{
FCKDebug.Output = function( message, color )
{
if ( ! FCKConfig.Debug ) return ;
if ( message != null && isNaN( message ) )
{
message = message.replace(/</g, "<") ;
}
if ( !this.DebugWindow || this.DebugWindow.closed )
{
this.DebugWindow = window.open( 'fckdebug.html', 'FCKeditorDebug', 'menubar=no,scrollbars=no,resizable=yes,location=no,toolbar=no,width=600,height=500', true ) ;
}
if ( this.DebugWindow.Output)
{
this.DebugWindow.Output( message, color ) ;
}
}
}
else
{
FCKDebug.Output = function() {}
}
--- NEW FILE: fckdialog.js ---
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2004 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* File Name: fckdialog.js
* Dialog windows operations.
*
* Version: 2.0 Beta 1
* Modified: 2004-05-31 23:07:50
*
* File Authors:
* Frederico Caldeira Knabben (fr...@fc...)
*/
var FCKDialog = new Object() ;
// This method opens a dialog window using the standard dialog template.
FCKDialog.OpenDialog = function( dialogName, dialogTitle, dialogPage, width, height )
{
// Setup the dialog info.
var oDialogInfo = new Object() ;
oDialogInfo.Title = dialogTitle ;
oDialogInfo.Page = dialogPage ;
oDialogInfo.Editor = window ;
var sUrl = FCKConfig.BasePath + 'fckdialog.html' ;
this.Show( oDialogInfo, dialogName, sUrl, width, height ) ;
}
--- NEW FILE: fckdialog_gecko.js ---
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2004 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* File Name: fckdialog_gecko.js
* Dialog windows operations. (Gecko specific implementations)
*
* Version: 2.0 Beta 1
* Modified: 2004-05-31 23:07:50
*
* File Authors:
* Frederico Caldeira Knabben (fr...@fc...)
*/
FCKDialog.Show = function( dialogInfo, dialogName, pageUrl, dialogWidth, dialogHeight )
{
var iTop = (screen.height - dialogHeight) / 2 ;
var iLeft = (screen.width - dialogWidth) / 2 ;
var sOption = "location=no,menubar=no,resizable=no,toolbar=no,dependent=yes" +
",width=" + dialogWidth +
",height=" + dialogHeight +
",top=" + iTop +
",left=" + iLeft ;
var oWindow = window.open( '', 'FCKEditorDialog', sOption, true ) ;
oWindow.moveTo( iLeft, iTop ) ;
oWindow.resizeTo( dialogWidth, dialogHeight ) ;
oWindow.focus() ;
oWindow.location.href = pageUrl ;
oWindow.dialogArguments = dialogInfo ;
this.Window = oWindow ;
window.top.captureEvents( Event.CLICK | Event.MOUSEDOWN | Event.MOUSEUP | Event.FOCUS ) ;
window.top.parent.addEventListener( 'mousedown', this.CheckFocus, true ) ;
window.top.parent.addEventListener( 'mouseup', this.CheckFocus, true ) ;
window.top.parent.addEventListener( 'click', this.CheckFocus, true ) ;
window.top.parent.addEventListener( 'focus', this.CheckFocus, true ) ;
}
FCKDialog.CheckFocus = function()
{
if ( FCKDialog.Window && !FCKDialog.Window.closed )
{
FCKDialog.Window.focus() ;
return false ;
}
else
{
window.top.releaseEvents(Event.CLICK | Event.MOUSEDOWN | Event.MOUSEUP | Event.FOCUS) ;
window.top.parent.removeEventListener( 'onmousedown', FCKDialog.CheckFocus, true ) ;
window.top.parent.removeEventListener( 'mouseup', FCKDialog.CheckFocus, true ) ;
window.top.parent.removeEventListener( 'click', FCKDialog.CheckFocus, true ) ;
window.top.parent.removeEventListener( 'onfocus', FCKDialog.CheckFocus, true ) ;
}
}
--- NEW FILE: fckdialog_ie.js ---
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2004 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* File Name: fckdialog_ie.js
* Dialog windows operations. (IE specific implementations)
*
* Version: 2.0 Beta 1
* Modified: 2004-05-31 23:07:50
*
* File Authors:
* Frederico Caldeira Knabben (fr...@fc...)
*/
FCKDialog.Show = function( dialogInfo, dialogName, pageUrl, dialogWidth, dialogHeight )
{
window.showModalDialog( pageUrl, dialogInfo, "dialogWidth:" + dialogWidth + "px;dialogHeight:" + dialogHeight + "px;help:no;scroll:no;status:no") ;
}
--- NEW FILE: fcklanguagemanager.js ---
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2004 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* File Name: fcklanguagemanager.js
* Defines the FCKLanguageManager object that is used for language
* operations.
*
* Version: 2.0 Beta 1
* Modified: 2004-05-31 23:07:50
*
* File Authors:
* Frederico Caldeira Knabben (fr...@fc...)
*/
var FCKLanguageManager = new Object() ;
FCKLanguageManager.AvailableLanguages =
{
'ar' : 'Arabic',
'en' : 'English',
'it' : 'Italian'
}
FCKLanguageManager.GetActiveLanguage = function()
{
if ( FCKConfig.AutoDetectLanguage )
{
// IE accepts "navigator.userLanguage" while Gecko "navigator.language".
var sUserLang = navigator.language ? navigator.language.toLowerCase() : navigator.userLanguage.toLowerCase() ;
FCKDebug.Output( 'Navigator Language = ' + sUserLang ) ;
// Some language codes are set in 5 characters,
// like "pt-br" for Brasilian Portuguese.
if ( sUserLang.length >= 5 )
{
sUserLang = sUserLang.substr(0,5) ;
if ( this.AvailableLanguages[sUserLang] ) return sUserLang ;
}
// If the user's browser is set to, for example, "pt-br" but only the
// "pt" language file is available then get that file.
if ( sUserLang.length >= 2 )
{
sUserLang = sUserLang.substr(0,2) ;
if ( this.AvailableLanguages[sUserLang] ) return sUserLang ;
}
}
return FCKConfig.DefaultLanguage ;
}
FCKLanguageManager.TranslateElements = function( targetDocument, tag, propertyToSet )
{
var aInputs = targetDocument.getElementsByTagName(tag) ;
for ( var i = 0 ; i < aInputs.length ; i++ )
{
if ( aInputs[i].attributes['fckLang'] )
{
var s = FCKLang[ aInputs[i].attributes["fckLang"].value ] ;
eval( 'aInputs[i].' + propertyToSet + ' = s' ) ;
}
}
}
FCKLanguageManager.TranslatePage = function( targetDocument )
{
this.TranslateElements( targetDocument, 'INPUT', 'value' ) ;
this.TranslateElements( targetDocument, 'SPAN', 'innerHTML' ) ;
this.TranslateElements( targetDocument, 'OPTION', 'innerHTML' ) ;
}
FCKLanguageManager.ActiveLanguage = new Object() ;
FCKLanguageManager.ActiveLanguage.Code = FCKLanguageManager.GetActiveLanguage() ;
FCKLanguageManager.ActiveLanguage.Name = FCKLanguageManager.AvailableLanguages[ FCKLanguageManager.ActiveLanguage.Code ] ;
FCK.Language = FCKLanguageManager ;
FCKScriptLoader.AddScript( 'lang/' + FCKLanguageManager.ActiveLanguage.Code + '.js' ) ;
--- NEW FILE: fckscriptloader.js ---
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2004 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* File Name: fckscriptloader.js
* Defines the FCKScriptLoader object that is used to dynamically load
* scripts in the editor.
*
* Version: 2.0 Beta 1
* Modified: 2004-05-31 23:07:50
*
* File Authors:
* Frederico Caldeira Knabben (fr...@fc...)
*/
// This object is used to download scripts and css files sequentialy.
// A file download is not started until the previous file was not completelly
// downloaded.
var FCKScriptLoader = new Object() ;
FCKScriptLoader.IsLoading = false ;
FCKScriptLoader.Queue = new Array() ;
// Adds a script or css to the queue.
FCKScriptLoader.AddScript = function( scriptPath )
{
FCKScriptLoader.Queue[ FCKScriptLoader.Queue.length ] = scriptPath ;
if ( !this.IsLoading )
this.CheckQueue() ;
}
// Checks the queue to see if there is something to load.
// This function should not be called by code. It's a internal function
// that's called recursively.
FCKScriptLoader.CheckQueue = function()
{
// Check if the queue is not empty.
if ( this.Queue.length > 0 )
{
this.IsLoading = true ;
// Get the first item in the queue
var sScriptPath = this.Queue[0] ;
// Removes the first item from the queue
var oTempArray = new Array() ;
for ( i = 1 ; i < this.Queue.length ; i++ )
oTempArray[ i - 1 ] = this.Queue[ i ] ;
this.Queue = oTempArray ;
// window.status = ( 'Loading ' + sScriptPath + '...' ) ;
// Dynamically load the file (it can be a CSS or a JS)
var e ;
// If is a CSS
if ( sScriptPath.lastIndexOf( '.css' ) > 0 )
{
e = document.createElement( 'LINK' ) ;
e.rel = 'stylesheet' ;
e.type = 'text/css' ;
}
// It is a JS
else
{
e = document.createElement( "script" ) ;
e.type = "text/javascript" ;
}
// Add the new object to the HEAD.
document.getElementsByTagName("head")[0].appendChild( e ) ;
var oEvent = function()
{
// Gecko doesn't have a "readyState" property
if ( this.tagName == 'LINK' || !this.readyState || this.readyState == 'loaded' )
// Load the next script available in the queue
FCKScriptLoader.CheckQueue() ;
}
// Start downloading it.
if ( e.tagName == 'LINK' )
{
// IE must wait for the file to be downloaded.
if ( FCKBrowserInfo.IsIE )
e.onload = oEvent ;
// Gecko doens't fire any event when the CSS is loaded, so we
// can't wait for it.
else
FCKScriptLoader.CheckQueue() ;
e.href = sScriptPath ;
}
else
{
// Gecko fires the "onload" event and IE fires "onreadystatechange"
e.onload = e.onreadystatechange = oEvent ;
e.src = sScriptPath ;
}
}
else
{
this.IsLoading = false ;
// Call the "OnEmpty" event.
if ( this.OnEmpty )
this.OnEmpty() ;
}
}
--- NEW FILE: fckselection.js ---
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2004 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* File Name: fckselection.js
* Active selection functions.
*
* Version: 2.0 Beta 1
* Modified: 2004-05-31 23:07:50
*
* File Authors:
* Frederico Caldeira Knabben (fr...@fc...)
*/
var FCKSelection = new Object() ;
FCK.Selection = FCKSelection ;
--- NEW FILE: fckselection_gecko.js ---
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2004 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* File Name: fckselection_gecko.js
* Active selection functions. (Gecko specific implementation)
*
* Version: 2.0 Beta 1
* Modified: 2004-05-31 23:07:50
*
* File Authors:
* Frederico Caldeira Knabben (fr...@fc...)
*/
// Retrieves the selected element (if any), just in the case that a single
// element is selected.
FCKSelection.GetSelectedElement = function()
{
var oSel = FCK.EditorWindow.getSelection() ;
if ( oSel.rangeCount == 1 )
{
var oRange = oSel.getRangeAt(0) ;
if ( oRange.startContainer == oRange.endContainer && (oRange.endOffset - oRange.startOffset) == 1 )
return oSel.anchorNode.childNodes[ oSel.anchorOffset ] ;
}
}
FCKSelection.MoveToNode = function( node )
{
var oSel = FCK.EditorWindow.getSelection() ;
for ( i = oSel.rangeCount - 1 ; i >= 0 ; i-- )
{
if ( i == 0 )
{
oSel.getRangeAt(i).selectNodeContents( node ) ;
}
else
{
oSel.removeRange( oSel.getRangeAt(i) ) ;
}
}
}
FCKSelection.HasAncestorNode = function( nodeTagName )
{
var oContainer = this.GetSelectedElement() ;
if ( ! oContainer && FCK.EditorWindow )
{
try { oContainer = FCK.EditorWindow.getSelection().getRangeAt(0).startContainer ; }
catch(e){}
}
while ( oContainer )
{
if ( oContainer.tagName == nodeTagName ) return true ;
oContainer = oContainer.parentNode ;
}
return false ;
}
FCKSelection.MoveToAncestorNode = function( nodeTagName )
{
var oNode ;
var oContainer = this.GetSelectedElement() ;
if ( ! oContainer )
{
oContainer = FCK.EditorWindow.getSelection().getRangeAt(0).startContainer ;
}
while ( oContainer )
{
if ( oContainer.tagName == nodeTagName ) return oContainer ;
oContainer = oContainer.parentNode ;
}
}
FCKSelection.Delete = function()
{
// Gets the actual selection.
var oSel = FCK.EditorWindow.getSelection() ;
// Deletes the actual selection contents.
for ( var i = 0 ; i < oSel.rangeCount ; i++ )
{
oSel.getRangeAt(i).deleteContents() ;
}
return oSel ;
}
--- NEW FILE: fckselection_ie.js ---
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2004 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* File Name: fckselection_ie.js
* Active selection functions. (IE specific implementation)
*
* Version: 2.0 Beta 1
* Modified: 2004-05-31 23:07:50
*
* File Authors:
* Frederico Caldeira Knabben (fr...@fc...)
*/
// Retrieves the selected element (if any), just in the case that a single
// element is selected.
FCKSelection.GetSelectedElement = function()
{
var oRange = FCK.EditorDocument.selection.createRange() ;
if ( FCK.EditorDocument.selection.type != 'Text' && oRange.length == 1)
{
return oRange.item(0) ;
}
}
FCKSelection.MoveToNode = function( node )
{
FCK.EditorDocument.selection.empty() ;
var oRange = FCK.EditorDocument.selection.createRange() ;
oRange.moveToElementText( node ) ;
oRange.select() ;
}
FCKSelection.HasAncestorNode = function( nodeTagName )
{
var oContainer ;
if ( FCK.EditorDocument.selection.type == "Control" )
{
oContainer = this.GetSelectedElement() ;
}
else
{
var oRange = FCK.EditorDocument.selection.createRange() ;
oContainer = oRange.parentElement() ;
}
while ( oContainer )
{
if ( oContainer.tagName == nodeTagName ) return true ;
oContainer = oContainer.parentNode ;
}
return false ;
}
FCKSelection.MoveToAncestorNode = function( nodeTagName )
{
var oNode ;
if ( FCK.EditorDocument.selection.type == "Control" )
{
var oRange = FCK.EditorDocument.selection.createRange() ;
for ( i = 0 ; i < oRange.length ; i++ )
{
if (oRange(i).parentNode)
{
oNode = oRange(i).parentNode ;
break ;
}
}
}
else
{
var oRange = FCK.EditorDocument.selection.createRange() ;
oNode = oRange.parentElement() ;
}
while ( oNode && oNode.nodeName != nodeTagName )
oNode = oNode.parentNode ;
return oNode ;
}
FCKSelection.Delete = function()
{
// Gets the actual selection.
var oSel = FCK.EditorDocument.selection ;
// Deletes the actual selection contents.
if ( oSel.type.toLowerCase() != "none" )
{
oSel.clear() ;
}
return oSel ;
}
--- NEW FILE: fcktoolbaritems.js ---
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2004 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* File Name: fcktoolbaritems.js
* Toolbar items definitions.
*
* Version: 2.0 Beta 1
* Modified: 2004-05-31 23:07:50
*
* File Authors:
* Frederico Caldeira Knabben (fr...@fc...)
*/
var FCKToolbarItems = new Object() ;
FCKToolbarItems['Source'] = new FCKToolbarButton( 'Source', 'Source', null, FCK_TOOLBARITEM_ICONTEXT, true ) ;
FCKToolbarItems['Save'] = new FCKToolbarButton( 'Save', null, null, null, true ) ;
FCKToolbarItems['NewPage'] = new FCKToolbarButton( 'NewPage', null, null, null, true ) ;
FCKToolbarItems['Preview'] = new FCKToolbarButton( 'Preview', null, null, null, true ) ;
FCKToolbarItems['About'] = new FCKToolbarButton( 'About', FCKLang.About ) ;
FCKToolbarItems['Cut'] = new FCKToolbarButton( 'Cut', FCKLang.Cut, null, null, true ) ;
FCKToolbarItems['Copy'] = new FCKToolbarButton( 'Copy', FCKLang.Copy, null, null, true ) ;
FCKToolbarItems['Paste'] = new FCKToolbarButton( 'Paste', FCKLang.Paste, null, null, true ) ;
FCKToolbarItems['Print'] = new FCKToolbarButton( 'Print', null, null, null, true ) ;
FCKToolbarItems['Undo'] = new FCKToolbarButton( 'Undo', null, null, null, true ) ;
FCKToolbarItems['Redo'] = new FCKToolbarButton( 'Redo', null, null, null, true ) ;
FCKToolbarItems['Find'] = new FCKToolbarButton( 'Find', null, null, null, true ) ;
FCKToolbarItems['SelectAll'] = new FCKToolbarButton( 'SelectAll', 'Select All', null, null, true ) ;
FCKToolbarItems['RemoveFormat'] = new FCKToolbarButton( 'RemoveFormat', 'Remove Format' ) ;
FCKToolbarItems['Unlink'] = new FCKToolbarButton( 'Unlink' ) ;
FCKToolbarItems['Bold...
[truncated message content] |