~ubuntu-branches/ubuntu/gutsy/moin/gutsy

« back to all changes in this revision

Viewing changes to wiki/htdocs/applets/FCKeditor/editor/_source/internals/fck_1.js

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2006-02-14 16:09:24 UTC
  • mfrom: (0.2.13 upstream)
  • Revision ID: james.westby@ubuntu.com-20060214160924-fyrx3gvknzqvt4vj
Tags: 1.5.2-1ubuntu1
Drop python2.3 package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 *              Frederico Caldeira Knabben (fredck@fckeditor.net)
19
19
 */
20
20
 
 
21
var FCK_StartupValue ;
 
22
 
21
23
FCK.Events      = new FCKEvents( FCK ) ;
22
24
FCK.Toolbar     = null ;
23
25
 
38
40
 
39
41
        // Set the editor's startup contents
40
42
        this.SetHTML( FCKTools.GetLinkedFieldValue() ) ;
 
43
        
 
44
        // Save the startup value for the "IsDirty()" check.
 
45
        this.ResetIsDirty() ;
41
46
 
42
47
        // Attach the editor to the form onsubmit event
43
48
        FCKTools.AttachToLinkedFieldFormSubmit( this.UpdateLinkedField ) ;
50
55
function Window_OnFocus()
51
56
{
52
57
        FCK.Focus() ;
 
58
        FCK.Events.FireEvent( "OnFocus" ) ;
 
59
}
 
60
 
 
61
function Window_OnBlur()
 
62
{
 
63
        if ( !FCKDialog.IsOpened )
 
64
                return FCK.Events.FireEvent( "OnBlur" ) ;
53
65
}
54
66
 
55
67
FCK.SetStatus = function( newStatus )
59
71
        if ( newStatus == FCK_STATUS_ACTIVE )
60
72
        {
61
73
                // Force the focus in the window to go to the editor.
62
 
                window.onfocus = window.document.body.onfocus = Window_OnFocus ;
 
74
                window.frameElement.onfocus     = window.document.body.onfocus = Window_OnFocus ;
 
75
                window.frameElement.onblur      = Window_OnBlur ;
63
76
 
64
77
                // Force the focus in the editor.
65
78
                if ( FCKConfig.StartupFocus )
108
121
                FCKScriptLoader.AddScript( '_source/classes/fckcontextmenuseparator.js' ) ;
109
122
                FCKScriptLoader.AddScript( '_source/classes/fckcontextmenugroup.js' ) ;
110
123
                FCKScriptLoader.AddScript( '_source/internals/fckcontextmenu.js' ) ;
111
 
                FCKScriptLoader.AddScript( '_source/internals/fckcontextmenu_' + sBrowserSuffix + '.js' ) ;
 
124
//              FCKScriptLoader.AddScript( '_source/internals/fckcontextmenu_' + sBrowserSuffix + '.js' ) ;
112
125
                FCKScriptLoader.AddScript( '_source/classes/fckplugin.js' ) ;
113
126
                FCKScriptLoader.AddScript( '_source/internals/fckplugins.js' ) ;
114
127
                FCKScriptLoader.AddScript( '_source/internals/fck_last.js' ) ;
127
140
        this.Events.FireEvent( 'OnStatusChange', newStatus ) ;
128
141
}
129
142
 
 
143
// Deprecated : returns the same value as GetXHTML.
130
144
FCK.GetHTML = function( format )
131
145
{
 
146
        FCK.GetXHTML( format ) ;
 
147
/*      
132
148
        var sHTML ;
133
149
 
134
150
        if ( FCK.EditMode == FCK_EDITMODE_WYSIWYG )
149
165
                return FCKCodeFormatter.Format( sHTML ) ;
150
166
        else
151
167
                return sHTML ;
 
168
*/
152
169
}
153
170
 
154
171
FCK.GetXHTML = function( format )
158
175
        if ( bSource )
159
176
                this.SwitchEditMode() ;
160
177
 
161
 
        // TODO: Wait stable version and remove the following commented lines.
162
 
//      if ( FCKBrowserInfo.IsIE )
163
 
//              FCK.CheckRelativeLinks() ;
164
 
 
165
178
        var sXHTML ;
166
179
        
167
180
        if ( FCKConfig.FullPage )
191
204
 
192
205
FCK.UpdateLinkedField = function()
193
206
{
194
 
        if ( FCKConfig.EnableXHTML )
 
207
        // EnableXHTML has been deprecated
 
208
//      if ( FCKConfig.EnableXHTML )
195
209
                FCK.LinkedField.value = FCK.GetXHTML( FCKConfig.FormatOutput ) ;
196
 
        else
197
 
                FCK.LinkedField.value = FCK.GetHTML( FCKConfig.FormatOutput ) ;
 
210
//      else
 
211
//              FCK.LinkedField.value = FCK.GetHTML( FCKConfig.FormatOutput ) ;
198
212
                
199
213
        FCK.Events.FireEvent( 'OnAfterLinkedFieldUpdate' ) ;
200
214
}
232
246
        this.Events.FireEvent( 'OnAfterSetHTML' ) ;
233
247
}
234
248
 
 
249
// Saves URLs on links and images on special attributes, so they don't change when 
 
250
// moving around.
 
251
FCK.ProtectUrls = function( html )
 
252
{
 
253
        // <A> href
 
254
        html = html.replace( FCKRegexLib.ProtectUrlsAApo        , '$1$2$3$2 _fcksavedurl=$2$3$2' ) ;
 
255
        html = html.replace( FCKRegexLib.ProtectUrlsANoApo      , '$1$2 _fcksavedurl="$2"' ) ;
 
256
 
 
257
        // <IMG> src
 
258
        html = html.replace( FCKRegexLib.ProtectUrlsImgApo      , '$1$2$3$2 _fcksavedurl=$2$3$2' ) ;
 
259
        html = html.replace( FCKRegexLib.ProtectUrlsImgNoApo, '$1$2 _fcksavedurl="$2"' ) ;
 
260
        
 
261
        return html ;
 
262
}
 
263
 
 
264
FCK.IsDirty = function()
 
265
{
 
266
        return ( FCK_StartupValue != FCK.EditorDocument.body.innerHTML ) ;
 
267
}
 
268
 
 
269
FCK.ResetIsDirty = function()
 
270
{
 
271
        if ( FCK.EditorDocument.body )
 
272
                FCK_StartupValue = FCK.EditorDocument.body.innerHTML ;
 
273
}
 
274
 
235
275
// Advanced document processors.
236
276
 
237
277
var FCKDocumentProcessors = new Array() ;
270
310
 
271
311
FCKDocumentProcessors.addItem( FCKAnchorsProcessor ) ;
272
312
 
 
313
// Page Breaks
 
314
var FCKPageBreaksProcessor = new Object() ;
 
315
FCKPageBreaksProcessor.ProcessDocument = function( document )
 
316
{
 
317
        var aDIVs = document.getElementsByTagName( 'DIV' ) ;
 
318
 
 
319
        var eDIV ;
 
320
        var i = aDIVs.length - 1 ;
 
321
        while ( i >= 0 && ( eDIV = aDIVs[i--] ) )
 
322
        {
 
323
                if ( eDIV.style.pageBreakAfter == 'always' && eDIV.childNodes.length == 1 && eDIV.childNodes[0].style && eDIV.childNodes[0].style.display == 'none' )
 
324
                {
 
325
                        var oFakeImage = FCKDocumentProcessors_CreateFakeImage( 'FCK__PageBreak', eDIV.cloneNode(true) ) ;
 
326
                        
 
327
                        eDIV.parentNode.insertBefore( oFakeImage, eDIV ) ;
 
328
                        eDIV.parentNode.removeChild( eDIV ) ;
 
329
                }
 
330
        }
 
331
/*
 
332
        var aCenters = document.getElementsByTagName( 'CENTER' ) ;
 
333
 
 
334
        var oCenter ;
 
335
        var i = aCenters.length - 1 ;
 
336
        while ( i >= 0 && ( oCenter = aCenters[i--] ) )
 
337
        {
 
338
                if ( oCenter.style.pageBreakAfter == 'always' && oCenter.innerHTML.trim().length == 0 )
 
339
                {
 
340
                        var oFakeImage = FCKDocumentProcessors_CreateFakeImage( 'FCK__PageBreak', oCenter.cloneNode(true) ) ;
 
341
                        
 
342
                        oCenter.parentNode.insertBefore( oFakeImage, oCenter ) ;
 
343
                        oCenter.parentNode.removeChild( oCenter ) ;
 
344
                }
 
345
        }
 
346
*/
 
347
}
 
348
 
 
349
FCKDocumentProcessors.addItem( FCKPageBreaksProcessor ) ;
 
350
 
273
351
// Flash Embeds.
274
352
var FCKFlashProcessor = new Object() ;
275
353
FCKFlashProcessor.ProcessDocument = function( document )
287
365
        {
288
366
                if ( oEmbed.src.endsWith( '.swf', true ) )
289
367
                {
290
 
                        var oImg = FCKDocumentProcessors_CreateFakeImage( 'FCK__Flash', oEmbed.cloneNode(true) ) ;
 
368
                        var oCloned = oEmbed.cloneNode( true ) ;
 
369
                        
 
370
                        // On IE, some properties are not getting clonned properly, so we 
 
371
                        // must fix it. Thanks to Alfonso Martinez.
 
372
                        if ( FCKBrowserInfo.IsIE )
 
373
                        {
 
374
                                oCloned.setAttribute( 'scale', oEmbed.getAttribute( 'scale' ) );
 
375
                                oCloned.setAttribute( 'play', oEmbed.getAttribute( 'play' ) );
 
376
                                oCloned.setAttribute( 'loop', oEmbed.getAttribute( 'loop' ) );
 
377
                                oCloned.setAttribute( 'menu', oEmbed.getAttribute( 'menu' ) );
 
378
                        }
 
379
                
 
380
                        var oImg = FCKDocumentProcessors_CreateFakeImage( 'FCK__Flash', oCloned ) ;
291
381
                        oImg.setAttribute( '_fckflash', 'true', 0 ) ;
292
382
                        
293
383
                        FCKFlashProcessor.RefreshView( oImg, oEmbed ) ;
328
418
        
329
419
        return e ;
330
420
}
 
421
 
331
422
// START iCM MODIFICATIONS
 
423
/*
332
424
var FCKTablesProcessor = new Object() ;
333
425
FCKTablesProcessor.ProcessDocument = function( document )
334
426
{
381
473
}               
382
474
 
383
475
FCKDocumentProcessors.addItem( FCKTablesProcessor ) ;
384
 
 
 
476
*/
385
477
// END iCM MODIFICATIONS
 
 
b'\\ No newline at end of file'