~ubuntu-branches/ubuntu/natty/moin/natty-updates

« 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): Jonas Smedegaard
  • Date: 2008-06-22 21:17:13 UTC
  • mto: This revision was merged to the branch mainline in revision 18.
  • Revision ID: james.westby@ubuntu.com-20080622211713-inlv5k4eifxckelr
ImportĀ upstreamĀ versionĀ 1.7.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
ļ»æ/*
 
2
 * FCKeditor - The text editor for internet
 
3
 * Copyright (C) 2003-2005 Frederico Caldeira Knabben
 
4
 * 
 
5
 * Licensed under the terms of the GNU Lesser General Public License:
 
6
 *              http://www.opensource.org/licenses/lgpl-license.php
 
7
 * 
 
8
 * For further information visit:
 
9
 *              http://www.fckeditor.net/
 
10
 * 
 
11
 * "Support Open Source software. What about a donation today?"
 
12
 * 
 
13
 * File Name: fck_1.js
 
14
 *      This is the first part of the "FCK" object creation. This is the main
 
15
 *      object that represents an editor instance.
 
16
 * 
 
17
 * File Authors:
 
18
 *              Frederico Caldeira Knabben (fredck@fckeditor.net)
 
19
 */
 
20
 
 
21
var FCK_StartupValue ;
 
22
 
 
23
FCK.Events      = new FCKEvents( FCK ) ;
 
24
FCK.Toolbar     = null ;
 
25
 
 
26
FCK.TempBaseTag = FCKConfig.BaseHref.length > 0 ? '<base href="' + FCKConfig.BaseHref + '" _fcktemp="true"></base>' : '' ;
 
27
 
 
28
FCK.StartEditor = function()
 
29
{
 
30
        // Get the editor's window and document (DOM)
 
31
        this.EditorWindow       = window.frames[ 'eEditorArea' ] ;
 
32
        this.EditorDocument     = this.EditorWindow.document ;
 
33
 
 
34
        // TODO: Wait stable version and remove the following commented lines.
 
35
        // The Base Path of the editor is saved to rebuild relative URL (IE issue).
 
36
//      this.BaseUrl = this.EditorDocument.location.protocol + '//' + this.EditorDocument.location.host ;
 
37
 
 
38
//      if ( FCKBrowserInfo.IsGecko )
 
39
//              this.MakeEditable() ;
 
40
 
 
41
        // Set the editor's startup contents
 
42
        this.SetHTML( FCKTools.GetLinkedFieldValue() ) ;
 
43
        
 
44
        // Save the startup value for the "IsDirty()" check.
 
45
        this.ResetIsDirty() ;
 
46
 
 
47
        // Attach the editor to the form onsubmit event
 
48
        FCKTools.AttachToLinkedFieldFormSubmit( this.UpdateLinkedField ) ;
 
49
 
 
50
        FCKUndo.SaveUndoStep() ;
 
51
 
 
52
        this.SetStatus( FCK_STATUS_ACTIVE ) ;
 
53
}
 
54
 
 
55
function Window_OnFocus()
 
56
{
 
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" ) ;
 
65
}
 
66
 
 
67
FCK.SetStatus = function( newStatus )
 
68
{
 
69
        this.Status = newStatus ;
 
70
 
 
71
        if ( newStatus == FCK_STATUS_ACTIVE )
 
72
        {
 
73
                // Force the focus in the window to go to the editor.
 
74
                window.frameElement.onfocus     = window.document.body.onfocus = Window_OnFocus ;
 
75
                window.frameElement.onblur      = Window_OnBlur ;
 
76
 
 
77
                // Force the focus in the editor.
 
78
                if ( FCKConfig.StartupFocus )
 
79
                        FCK.Focus() ;
 
80
 
 
81
                // @Packager.Compactor.Remove.Start
 
82
                var sBrowserSuffix = FCKBrowserInfo.IsIE ? "ie" : "gecko" ;
 
83
 
 
84
                FCKScriptLoader.AddScript( '_source/internals/fck_2.js' ) ;
 
85
                FCKScriptLoader.AddScript( '_source/internals/fck_2_' + sBrowserSuffix + '.js' ) ;
 
86
                FCKScriptLoader.AddScript( '_source/internals/fckselection.js' ) ;
 
87
                FCKScriptLoader.AddScript( '_source/internals/fckselection_' + sBrowserSuffix + '.js' ) ;
 
88
                FCKScriptLoader.AddScript( '_source/classes/fckpanel_' + sBrowserSuffix + '.js' ) ;
 
89
                FCKScriptLoader.AddScript( '_source/internals/fcktablehandler.js' ) ;
 
90
                FCKScriptLoader.AddScript( '_source/internals/fcktablehandler_' + sBrowserSuffix + '.js' ) ;
 
91
                FCKScriptLoader.AddScript( '_source/classes/fckxml_' + sBrowserSuffix + '.js' ) ;
 
92
                FCKScriptLoader.AddScript( '_source/classes/fckstyledef.js' ) ;
 
93
                FCKScriptLoader.AddScript( '_source/classes/fckstyledef_' + sBrowserSuffix + '.js' ) ;
 
94
                FCKScriptLoader.AddScript( '_source/classes/fckstylesloader.js' ) ;
 
95
 
 
96
                FCKScriptLoader.AddScript( '_source/commandclasses/fcknamedcommand.js' ) ;
 
97
                FCKScriptLoader.AddScript( '_source/commandclasses/fck_othercommands.js' ) ;
 
98
                FCKScriptLoader.AddScript( '_source/commandclasses/fckspellcheckcommand_' + sBrowserSuffix + '.js' ) ;
 
99
                FCKScriptLoader.AddScript( '_source/commandclasses/fcktextcolorcommand.js' ) ;
 
100
                FCKScriptLoader.AddScript( '_source/commandclasses/fckpasteplaintextcommand.js' ) ;
 
101
                FCKScriptLoader.AddScript( '_source/commandclasses/fckpastewordcommand.js' ) ;
 
102
                FCKScriptLoader.AddScript( '_source/commandclasses/fcktablecommand.js' ) ;
 
103
                FCKScriptLoader.AddScript( '_source/commandclasses/fckstylecommand.js' ) ;
 
104
 
 
105
                FCKScriptLoader.AddScript( '_source/internals/fckcommands.js' ) ;
 
106
                FCKScriptLoader.AddScript( '_source/classes/fcktoolbarbutton.js' ) ;
 
107
                FCKScriptLoader.AddScript( '_source/classes/fckspecialcombo.js' ) ;
 
108
                FCKScriptLoader.AddScript( '_source/classes/fcktoolbarspecialcombo.js' ) ;
 
109
                FCKScriptLoader.AddScript( '_source/classes/fcktoolbarfontscombo.js' ) ;
 
110
                FCKScriptLoader.AddScript( '_source/classes/fcktoolbarfontsizecombo.js' ) ;
 
111
                FCKScriptLoader.AddScript( '_source/classes/fcktoolbarfontformatcombo.js' ) ;
 
112
                FCKScriptLoader.AddScript( '_source/classes/fcktoolbarstylecombo.js' ) ;
 
113
                FCKScriptLoader.AddScript( '_source/classes/fcktoolbarpanelbutton.js' ) ;
 
114
                FCKScriptLoader.AddScript( '_source/internals/fcktoolbaritems.js' ) ;
 
115
                FCKScriptLoader.AddScript( '_source/classes/fcktoolbar.js' ) ;
 
116
                FCKScriptLoader.AddScript( '_source/classes/fcktoolbarbreak_' + sBrowserSuffix + '.js' ) ;
 
117
                FCKScriptLoader.AddScript( '_source/internals/fcktoolbarset.js' ) ;
 
118
                FCKScriptLoader.AddScript( '_source/internals/fckdialog.js' ) ;
 
119
                FCKScriptLoader.AddScript( '_source/internals/fckdialog_' + sBrowserSuffix + '.js' ) ;
 
120
                FCKScriptLoader.AddScript( '_source/classes/fckcontextmenuitem.js' ) ;
 
121
                FCKScriptLoader.AddScript( '_source/classes/fckcontextmenuseparator.js' ) ;
 
122
                FCKScriptLoader.AddScript( '_source/classes/fckcontextmenugroup.js' ) ;
 
123
                FCKScriptLoader.AddScript( '_source/internals/fckcontextmenu.js' ) ;
 
124
//              FCKScriptLoader.AddScript( '_source/internals/fckcontextmenu_' + sBrowserSuffix + '.js' ) ;
 
125
                FCKScriptLoader.AddScript( '_source/classes/fckplugin.js' ) ;
 
126
                FCKScriptLoader.AddScript( '_source/internals/fckplugins.js' ) ;
 
127
                FCKScriptLoader.AddScript( '_source/internals/fck_last.js' ) ;
 
128
                // @Packager.Compactor.Remove.End
 
129
 
 
130
                /* @Packager.Compactor.RemoveLine
 
131
 
 
132
                if ( FCKBrowserInfo.IsIE )
 
133
                        FCKScriptLoader.AddScript( 'js/fckeditorcode_ie_2.js' ) ;
 
134
                else
 
135
                        FCKScriptLoader.AddScript( 'js/fckeditorcode_gecko_2.js' ) ;
 
136
 
 
137
                @Packager.Compactor.RemoveLine */
 
138
        }
 
139
 
 
140
        this.Events.FireEvent( 'OnStatusChange', newStatus ) ;
 
141
}
 
142
 
 
143
// Deprecated : returns the same value as GetXHTML.
 
144
FCK.GetHTML = function( format )
 
145
{
 
146
        FCK.GetXHTML( format ) ;
 
147
/*      
 
148
        var sHTML ;
 
149
 
 
150
        if ( FCK.EditMode == FCK_EDITMODE_WYSIWYG )
 
151
        {
 
152
                // TODO: Wait stable version and remove the following commented lines.
 
153
//              if ( FCKBrowserInfo.IsIE )
 
154
//                      FCK.CheckRelativeLinks() ;
 
155
 
 
156
                if ( FCKBrowserInfo.IsIE )
 
157
                        sHTML = this.EditorDocument.body.innerHTML.replace( FCKRegexLib.ToReplace, '$1' ) ;
 
158
                else
 
159
                        sHTML = this.EditorDocument.body.innerHTML ;
 
160
        }
 
161
        else
 
162
                sHTML = document.getElementById('eSourceField').value ;
 
163
 
 
164
        if ( format )
 
165
                return FCKCodeFormatter.Format( sHTML ) ;
 
166
        else
 
167
                return sHTML ;
 
168
*/
 
169
}
 
170
 
 
171
FCK.GetXHTML = function( format )
 
172
{
 
173
        var bSource = ( FCK.EditMode == FCK_EDITMODE_SOURCE ) ;
 
174
 
 
175
        if ( bSource )
 
176
                this.SwitchEditMode() ;
 
177
 
 
178
        var sXHTML ;
 
179
        
 
180
        if ( FCKConfig.FullPage )
 
181
                sXHTML = FCKXHtml.GetXHTML( this.EditorDocument.getElementsByTagName( 'html' )[0], true, format ) ;
 
182
        else
 
183
        {
 
184
                if ( FCKConfig.IgnoreEmptyParagraphValue && this.EditorDocument.body.innerHTML == '<P>&nbsp;</P>' )
 
185
                        sXHTML = '' ;
 
186
                else
 
187
                        sXHTML = FCKXHtml.GetXHTML( this.EditorDocument.body, false, format ) ;
 
188
        }
 
189
 
 
190
        if ( bSource )
 
191
                this.SwitchEditMode() ;
 
192
 
 
193
        if ( FCKBrowserInfo.IsIE )
 
194
                sXHTML = sXHTML.replace( FCKRegexLib.ToReplace, '$1' ) ;
 
195
 
 
196
        if ( FCK.DocTypeDeclaration && FCK.DocTypeDeclaration.length > 0 )
 
197
                sXHTML = FCK.DocTypeDeclaration + '\n' + sXHTML ;
 
198
 
 
199
        if ( FCK.XmlDeclaration && FCK.XmlDeclaration.length > 0 )
 
200
                sXHTML = FCK.XmlDeclaration + '\n' + sXHTML ;
 
201
 
 
202
        return FCKConfig.ProtectedSource.Revert( sXHTML ) ;
 
203
}
 
204
 
 
205
FCK.UpdateLinkedField = function()
 
206
{
 
207
        // EnableXHTML has been deprecated
 
208
//      if ( FCKConfig.EnableXHTML )
 
209
                FCK.LinkedField.value = FCK.GetXHTML( FCKConfig.FormatOutput ) ;
 
210
//      else
 
211
//              FCK.LinkedField.value = FCK.GetHTML( FCKConfig.FormatOutput ) ;
 
212
                
 
213
        FCK.Events.FireEvent( 'OnAfterLinkedFieldUpdate' ) ;
 
214
}
 
215
 
 
216
FCK.ShowContextMenu = function( x, y )
 
217
{
 
218
        if ( this.Status != FCK_STATUS_COMPLETE )
 
219
                return ;
 
220
 
 
221
        FCKContextMenu.Show( x, y ) ;
 
222
        this.Events.FireEvent( "OnContextMenu" ) ;
 
223
}
 
224
 
 
225
FCK.RegisteredDoubleClickHandlers = new Object() ;
 
226
 
 
227
FCK.OnDoubleClick = function( element )
 
228
{
 
229
        var oHandler = FCK.RegisteredDoubleClickHandlers[ element.tagName ] ;
 
230
        if ( oHandler )
 
231
                oHandler( element ) ;
 
232
}
 
233
 
 
234
// Register objects that can handle double click operations.
 
235
FCK.RegisterDoubleClickHandler = function( handlerFunction, tag )
 
236
{
 
237
        FCK.RegisteredDoubleClickHandlers[ tag.toUpperCase() ] = handlerFunction ;
 
238
}
 
239
 
 
240
FCK.OnAfterSetHTML = function()
 
241
{
 
242
        var oProcessor, i = 0 ;
 
243
        while( ( oProcessor = FCKDocumentProcessors[i++] ) )
 
244
                oProcessor.ProcessDocument( FCK.EditorDocument ) ;
 
245
 
 
246
        this.Events.FireEvent( 'OnAfterSetHTML' ) ;
 
247
}
 
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
 
 
275
// Advanced document processors.
 
276
 
 
277
var FCKDocumentProcessors = new Array() ;
 
278
 
 
279
var FCKDocumentProcessors_CreateFakeImage = function( fakeClass, realElement )
 
280
{
 
281
        var oImg = FCK.EditorDocument.createElement( 'IMG' ) ;
 
282
        oImg.className = fakeClass ;
 
283
        oImg.src = FCKConfig.FullBasePath + 'images/spacer.gif' ;
 
284
        oImg.setAttribute( '_fckfakelement', 'true', 0 ) ;
 
285
        oImg.setAttribute( '_fckrealelement', FCKTempBin.AddElement( realElement ), 0 ) ;
 
286
        return oImg ;
 
287
}
 
288
 
 
289
// Link Anchors
 
290
var FCKAnchorsProcessor = new Object() ;
 
291
FCKAnchorsProcessor.ProcessDocument = function( document )
 
292
{
 
293
        var aLinks = document.getElementsByTagName( 'A' ) ;
 
294
 
 
295
        var oLink ;
 
296
        var i = aLinks.length - 1 ;
 
297
        while ( i >= 0 && ( oLink = aLinks[i--] ) )
 
298
        {
 
299
                // If it is anchor.
 
300
                if ( oLink.name.length > 0 && ( !oLink.getAttribute('href') || oLink.getAttribute('href').length == 0 ) )
 
301
                {
 
302
                        var oImg = FCKDocumentProcessors_CreateFakeImage( 'FCK__Anchor', oLink.cloneNode(true) ) ;
 
303
                        oImg.setAttribute( '_fckanchor', 'true', 0 ) ;
 
304
                        
 
305
                        oLink.parentNode.insertBefore( oImg, oLink ) ;
 
306
                        oLink.parentNode.removeChild( oLink ) ;
 
307
                }
 
308
        }
 
309
}
 
310
 
 
311
FCKDocumentProcessors.addItem( FCKAnchorsProcessor ) ;
 
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
 
 
351
// Flash Embeds.
 
352
var FCKFlashProcessor = new Object() ;
 
353
FCKFlashProcessor.ProcessDocument = function( document )
 
354
{
 
355
        /*
 
356
        Sample code:
 
357
        This is some <embed src="/UserFiles/Flash/Yellow_Runners.swf"></embed><strong>sample text</strong>. You are&nbsp;<a name="fred"></a> using <a href="http://www.fckeditor.net/">FCKeditor</a>.
 
358
        */
 
359
 
 
360
        var aEmbeds = document.getElementsByTagName( 'EMBED' ) ;
 
361
 
 
362
        var oEmbed ;
 
363
        var i = aEmbeds.length - 1 ;
 
364
        while ( i >= 0 && ( oEmbed = aEmbeds[i--] ) )
 
365
        {
 
366
                if ( oEmbed.src.endsWith( '.swf', true ) )
 
367
                {
 
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 ) ;
 
381
                        oImg.setAttribute( '_fckflash', 'true', 0 ) ;
 
382
                        
 
383
                        FCKFlashProcessor.RefreshView( oImg, oEmbed ) ;
 
384
 
 
385
                        oEmbed.parentNode.insertBefore( oImg, oEmbed ) ;
 
386
                        oEmbed.parentNode.removeChild( oEmbed ) ;
 
387
 
 
388
//                      oEmbed.setAttribute( '_fckdelete', 'true', 0) ;
 
389
//                      oEmbed.style.display = 'none' ;
 
390
//                      oEmbed.hidden = true ;
 
391
                }
 
392
        }
 
393
}
 
394
 
 
395
FCKFlashProcessor.RefreshView = function( placholderImage, originalEmbed )
 
396
{
 
397
        if ( originalEmbed.width > 0 )
 
398
                placholderImage.style.width = FCKTools.ConvertHtmlSizeToStyle( originalEmbed.width ) ;
 
399
                
 
400
        if ( originalEmbed.height > 0 )
 
401
                placholderImage.style.height = FCKTools.ConvertHtmlSizeToStyle( originalEmbed.height ) ;
 
402
}
 
403
 
 
404
FCKDocumentProcessors.addItem( FCKFlashProcessor ) ;
 
405
 
 
406
FCK.GetRealElement = function( fakeElement )
 
407
{
 
408
        var e = FCKTempBin.Elements[ fakeElement.getAttribute('_fckrealelement') ] ;
 
409
 
 
410
        if ( fakeElement.getAttribute('_fckflash') )
 
411
        {
 
412
                if ( fakeElement.style.width.length > 0 )
 
413
                                e.width = FCKTools.ConvertStyleSizeToHtml( fakeElement.style.width ) ;
 
414
                
 
415
                if ( fakeElement.style.height.length > 0 )
 
416
                                e.height = FCKTools.ConvertStyleSizeToHtml( fakeElement.style.height ) ;
 
417
        }
 
418
        
 
419
        return e ;
 
420
}
 
421
 
 
422
// START iCM MODIFICATIONS
 
423
/*
 
424
var FCKTablesProcessor = new Object() ;
 
425
FCKTablesProcessor.ProcessDocument = function( document )
 
426
{
 
427
        FCKTablesProcessor.CheckTablesNesting( document ) ;
 
428
}
 
429
 
 
430
// Ensure that tables are not incorrectly nested within P, H1, H2, etc tags
 
431
FCKTablesProcessor.CheckTablesNesting = function( document )
 
432
{
 
433
        var aTables = document.getElementsByTagName( "TABLE" ) ;
 
434
        var oParentNode ;
 
435
        
 
436
        for ( var i=0; i<aTables.length; i++ )
 
437
        {
 
438
                FCKTablesProcessor.CheckTableNesting( aTables[i] ) ;
 
439
        }
 
440
}
 
441
 
 
442
// Corrects nesting of the supplied table as necessary.
 
443
// Also called by fck_table.html to check that a newly inserted table is correctly nested.
 
444
FCKTablesProcessor.CheckTableNesting = function( oTableNode )
 
445
{
 
446
        var oParentBlockNode = FCKTools.GetParentBlockNode( oTableNode.parentNode ) ;
 
447
        
 
448
        if ( oParentBlockNode && !FCKRegexLib.TableBlockElements.test( oParentBlockNode.nodeName ) )
 
449
        {
 
450
                // Create a new tag which holds the content of the child nodes located before the table
 
451
                var oNode1 = FCK.EditorDocument.createElement( oParentBlockNode.tagName ) ;
 
452
                var oFragment1 = FCKTools.GetDocumentFragment( oParentBlockNode, oParentBlockNode.firstChild, oTableNode, true, false, true ) ;
 
453
                oNode1.appendChild( oFragment1 ) ;
 
454
                FCKTools.SetElementAttributes( oNode1, oParentBlockNode.attributes ) ;  // Transfer across any class attributes, etc
 
455
        
 
456
                // Create a new tag which holds the content of the child nodes located after the table
 
457
                var oNode2 = FCK.EditorDocument.createElement( oParentBlockNode.tagName );
 
458
                var oFragment2 = FCKTools.GetDocumentFragment( oParentBlockNode, oTableNode, oParentBlockNode.lastChild, false, true, true ) ;
 
459
                oNode2.appendChild( oFragment2 ) ;
 
460
                FCKTools.SetElementAttributes( oNode2, oParentBlockNode.attributes ) ;  // Transfer across any class attributes, etc
 
461
                
 
462
                // Create a document fragment that contains the two new elements with the table element inbetween
 
463
                var oNewNode = FCK.EditorDocument.createDocumentFragment() ;
 
464
                if ( !FCKTools.NodeIsEmpty( oNode1 ) )
 
465
                        oNewNode.appendChild( oNode1 ) ;
 
466
                oNewNode.appendChild( oTableNode ) ;
 
467
                if ( !FCKTools.NodeIsEmpty( oNode2 ) )
 
468
                        oNewNode.appendChild( oNode2 ) ; 
 
469
                
 
470
                // Replace the existing parent node with the nodes in the fragment
 
471
                oParentBlockNode.parentNode.replaceChild( oNewNode, oParentBlockNode ) ;
 
472
        }
 
473
}               
 
474
 
 
475
FCKDocumentProcessors.addItem( FCKTablesProcessor ) ;
 
476
*/
 
477
// END iCM MODIFICATIONS
 
 
b'\\ No newline at end of file'