Subversion Repositories Applications.papyrus

Rev

Rev 1925 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1925 Rev 2048
Line 1... Line 1...
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
2
<!--
2
<!--
3
 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
3
 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
4
 * Copyright (C) 2003-2008 Frederico Caldeira Knabben
4
 * Copyright (C) 2003-2009 Frederico Caldeira Knabben
5
 *
5
 *
6
 * == BEGIN LICENSE ==
6
 * == BEGIN LICENSE ==
7
 *
7
 *
8
 * Licensed under the terms of any of the following licenses at your
8
 * Licensed under the terms of any of the following licenses at your
9
 * choice:
9
 * choice:
Line 201... Line 201...
201
	}
201
	}
Line 202... Line 202...
202
 
202
 
203
	var iterator = new FCKDomRangeIterator( range ) ;
203
	var iterator = new FCKDomRangeIterator( range ) ;
Line 204... Line -...
204
	var block ;
-
 
205
 
204
	var block ;
-
 
205
 
-
 
206
	var paragraphs = [] ;
-
 
207
	while ( ( block = iterator.GetNextParagraph() ) )
-
 
208
		paragraphs.push( block ) ;
-
 
209
 
-
 
210
	// Make sure all paragraphs have the same parent.
-
 
211
	var commonParent = paragraphs[0].parentNode ;
-
 
212
	var tmp = [] ;
-
 
213
	for ( var i = 0 ; i < paragraphs.length ; i++ )
-
 
214
	{
-
 
215
		block = paragraphs[i] ;
-
 
216
		commonParent = FCKDomTools.GetCommonParents( block.parentNode, commonParent ).pop() ;
-
 
217
	}
-
 
218
 
-
 
219
	// The common parent must not be the following tags: table, tbody, tr, ol, ul.
-
 
220
	while ( commonParent.nodeName.IEquals( 'table', 'tbody', 'tr', 'ol', 'ul' ) )
-
 
221
		commonParent = commonParent.parentNode ;
-
 
222
 
-
 
223
	// Reconstruct the block list to be processed such that all resulting blocks
-
 
224
	// satisfy parentNode == commonParent.
-
 
225
	var lastBlock = null ;
-
 
226
	while ( paragraphs.length > 0 )
-
 
227
	{
-
 
228
		block = paragraphs.shift() ;
-
 
229
		while ( block.parentNode != commonParent )
-
 
230
			block = block.parentNode ;
-
 
231
		if ( block != lastBlock )
-
 
232
			tmp.push( block ) ;
-
 
233
		lastBlock = block ;
-
 
234
	}
-
 
235
	paragraphs = tmp ;
206
	iterator.EnforceRealBlocks = true ;
236
 
207
	var paragraphs = [] ;
237
	// Split the paragraphs into groups depending on their BlockLimit element.
208
	var groups = [] ;
238
	var groups = [] ;
209
	var lastBlockLimit = null ;
239
	var lastBlockLimit = null ;
-
 
240
	for ( var i = 0 ; i < paragraphs.length ; i++ )
210
	while ( ( block = iterator.GetNextParagraph() ) )
241
	{
211
	{
242
		block = paragraphs[i] ;
212
		var elementPath = new FCKElementPath( block ) ;
243
		var elementPath = new FCKElementPath( block ) ;
213
		if ( elementPath.BlockLimit != lastBlockLimit )
244
		if ( elementPath.BlockLimit != lastBlockLimit )
214
		{
245
		{
215
			groups.push( [] ) ;
246
			groups.push( [] ) ;
216
			lastBlockLimit = elementPath.BlockLimit ;
247
			lastBlockLimit = elementPath.BlockLimit ;
217
		}
248
		}
Line -... Line 249...
-
 
249
		groups[groups.length - 1].push( block ) ;
218
		groups[groups.length - 1].push( block ) ;
250
	}
219
	}
251
 
220
 
252
	// Create a DIV container for each group.
221
	for ( var i = 0 ; i < groups.length ; i++ )
253
	for ( var i = 0 ; i < groups.length ; i++ )
222
	{
254
	{