2
* FCKeditor - The text editor for internet
3
* Copyright (C) 2003-2005 Frederico Caldeira Knabben
5
* Licensed under the terms of the GNU Lesser General Public License:
6
* http://www.opensource.org/licenses/lgpl-license.php
8
* For further information visit:
9
* http://www.fckeditor.net/
11
* "Support Open Source software. What about a donation today?"
13
* File Name: fck_onload.js
14
* This is the script that is called when the editor page is loaded inside
15
* its IFRAME. It's the editor startup.
18
* Frederico Caldeira Knabben (fredck@fckeditor.net)
21
// Disable the context menu in the editor (areas outside the editor area).
22
function Window_OnContextMenu( e )
25
e.preventDefault() ; // The Gecko way.
28
if ( event.srcElement == document.getElementById('eSourceField') )
32
return false ; // The IE way.
34
window.document.oncontextmenu = Window_OnContextMenu ;
36
// Gecko browsers doens't calculate well that IFRAME size so we must
37
// recalculate it every time the window size changes.
38
if ( FCKBrowserInfo.IsGecko )
40
function Window_OnResize()
42
var oFrame = document.getElementById('eEditorArea') ;
45
var oCell = document.getElementById( FCK.EditMode == FCK_EDITMODE_WYSIWYG ? 'eWysiwygCell' : 'eSource' ) ;
46
var iHeight = oCell.offsetHeight ;
48
oFrame.height = iHeight - 2 ;
50
window.onresize = Window_OnResize ;
53
if ( FCKBrowserInfo.IsIE )
55
var aCleanupDocs = new Array() ;
56
aCleanupDocs[0] = document ;
58
// On IE, some circular references must be cleared to avoid memory leak.
59
function Window_OnBeforeUnload()
61
// if ( typeof( FCKToolbarSet ) != 'undefined' )
62
// FCKToolbarSet.Collapse() ;
67
while ( ( d = aCleanupDocs[j++] ) )
70
while ( ( e = d.getElementsByTagName("DIV").item(i++) ) )
72
if ( e.FCKToolbarButton )
73
e.FCKToolbarButton = null ;
75
if ( e.FCKSpecialCombo )
76
e.FCKSpecialCombo = null ;
83
while ( ( e = d.getElementsByTagName("TR").item(i++) ) )
85
if ( e.FCKContextMenuItem )
86
e.FCKContextMenuItem = null ;
89
aCleanupDocs[j] = null ;
92
if ( typeof( FCKTempBin ) != 'undefined' )
95
window.attachEvent( "onunload", Window_OnBeforeUnload ) ;
98
// The editor startup follows these steps:
99
// 1. Load the editor main page (fckeditor.html).
100
// 2. Load the main configuration file (fckconfig.js)
101
// 3. Process the configurations set directly in the page code (just load then).
102
// 4. Override the configurations with the custom config file (if set).
103
// 5. Override the configurations with that ones set directly in the page code.
104
// 6. Load the editor skin styles CSS files.
105
// 7. Load the first part of tha main scripts.
106
// 8. Load the language file.
107
// 9. Start the editor.
109
// Start the editor as soon as the window is loaded.
110
function Window_OnLoad()
112
// There is a bug on Netscape when rendering the frame. It goes over the
113
// right border. So we must correct it.
114
if ( FCKBrowserInfo.IsNetscape )
115
document.getElementById('eWysiwygCell').style.paddingRight = '2px' ;
119
window.onload = Window_OnLoad ;
121
function LoadConfigFile()
123
FCKScriptLoader.OnEmpty = ProcessHiddenField ;
125
// First of all load the configuration file.
126
FCKScriptLoader.AddScript( '../fckconfig.js' ) ;
129
function ProcessHiddenField()
131
FCKConfig.ProcessHiddenField() ;
133
LoadCustomConfigFile() ;
136
function LoadCustomConfigFile()
138
// Load the custom configurations file (if defined).
139
if ( FCKConfig.CustomConfigurationsPath.length > 0 )
141
// Wait for the configuration file to be loaded to call the "LoadPageConfig".
142
FCKScriptLoader.OnEmpty = LoadPageConfig ;
144
FCKScriptLoader.AddScript( FCKConfig.CustomConfigurationsPath ) ;
148
// Load the page defined configurations immediately.
153
function LoadPageConfig()
155
FCKConfig.LoadPageConfig() ;
157
if ( FCKConfig.AllowQueryStringDebug && (/fckdebug=true/i).test( window.top.location.search ) )
158
FCKConfig.Debug = true ;
160
// Load the styles for the configured skin.
164
function LoadStyles()
166
if( window.console ) window.console.log( 'LoadStyles()' ) ; // @Packager.Compactor.RemoveLine
168
FCKScriptLoader.OnEmpty = LoadScripts ;
170
// Load the active skin CSS.
171
FCKScriptLoader.AddScript( FCKConfig.SkinPath + 'fck_editor.css' ) ;
172
FCKScriptLoader.AddScript( FCKConfig.SkinPath + 'fck_contextmenu.css' ) ;
175
function LoadScripts()
177
if( window.console ) window.console.log( 'LoadScripts()' ) ; // @Packager.Compactor.RemoveLine
179
FCKScriptLoader.OnEmpty = null ;
181
// @Packager.Compactor.Remove.Start
182
var sSuffix = FCKBrowserInfo.IsIE ? 'ie' : 'gecko' ;
184
FCKScriptLoader.AddScript( '_source/internals/fckdebug.js' ) ;
185
FCKScriptLoader.AddScript( '_source/internals/fcktools.js' ) ;
186
FCKScriptLoader.AddScript( '_source/internals/fcktools_' + sSuffix + '.js' ) ;
187
FCKScriptLoader.AddScript( '_source/internals/fckregexlib.js' ) ;
188
FCKScriptLoader.AddScript( '_source/internals/fcklanguagemanager.js' ) ;
189
FCKScriptLoader.AddScript( '_source/classes/fckevents.js' ) ;
190
FCKScriptLoader.AddScript( '_source/internals/fckxhtmlentities.js' ) ;
191
FCKScriptLoader.AddScript( '_source/internals/fckxhtml.js' ) ;
192
FCKScriptLoader.AddScript( '_source/internals/fckxhtml_' + sSuffix + '.js' ) ;
193
FCKScriptLoader.AddScript( '_source/internals/fckcodeformatter.js' ) ;
194
FCKScriptLoader.AddScript( '_source/internals/fckundo_' + sSuffix + '.js' ) ;
195
FCKScriptLoader.AddScript( '_source/internals/fck_1.js' ) ;
196
FCKScriptLoader.AddScript( '_source/internals/fck_1_' + sSuffix + '.js' ) ;
197
// @Packager.Compactor.Remove.End
199
/* @Packager.Compactor.RemoveLine
200
if ( FCKBrowserInfo.IsIE )
201
FCKScriptLoader.AddScript( 'js/fckeditorcode_ie_1.js' ) ;
203
FCKScriptLoader.AddScript( 'js/fckeditorcode_gecko_1.js' ) ;
204
@Packager.Compactor.RemoveLine */
207
function LoadLanguageFile()
209
if( window.console ) window.console.log( 'LoadLanguageFile()' ) ; // @Packager.Compactor.RemoveLine
211
FCKScriptLoader.OnEmpty = LoadEditor ;
213
if( window.console ) window.console.log( 'Active Language: ' + FCKLanguageManager.ActiveLanguage.Code ) ; // @Packager.Compactor.RemoveLine
215
FCKScriptLoader.AddScript( 'lang/' + FCKLanguageManager.ActiveLanguage.Code + '.js' ) ;
218
function LoadEditor()
220
if( window.console ) window.console.log( 'LoadEditor()' ) ; // @Packager.Compactor.RemoveLine
222
// Removes the OnEmpty listener.
223
FCKScriptLoader.OnEmpty = null ;
225
// Correct the editor layout to the correct language direction.
227
window.document.dir = FCKLang.Dir ;
229
// Starts the editor.
b'\\ No newline at end of file'