Subversion Repositories Applications.papyrus

Rev

Rev 1371 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1075 ddelon 1
/*
2
 * FCKeditor - The text editor for internet
3
 * Copyright (C) 2003-2006 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: fcktablehandler_ie.js
14
 * 	Manage table operations (IE specific).
15
 *
16
 * File Authors:
17
 * 		Frederico Caldeira Knabben (fredck@fckeditor.net)
18
 */
19
 
20
FCKTableHandler.GetSelectedCells = function()
21
{
22
	var aCells = new Array() ;
23
 
24
	var oRange = FCK.EditorDocument.selection.createRange() ;
25
//	var oParent = oRange.parentElement() ;
26
	var oParent = FCKSelection.GetParentElement() ;
27
 
28
	if ( oParent && oParent.tagName.Equals( 'TD', 'TH' ) )
29
		aCells[0] = oParent ;
30
	else
31
	{
32
		var oParent = FCKSelection.MoveToAncestorNode( "TABLE" ) ;
33
 
34
		if ( oParent )
35
		{
36
			// Loops throw all cells checking if the cell is, or part of it, is inside the selection
37
			// and then add it to the selected cells collection.
38
			for ( var i = 0 ; i < oParent.cells.length ; i++ )
39
			{
40
				var oCellRange = FCK.EditorDocument.selection.createRange() ;
41
				oCellRange.moveToElementText( oParent.cells[i] ) ;
42
 
43
				if ( oRange.inRange( oCellRange )
44
					|| ( oRange.compareEndPoints('StartToStart',oCellRange) >= 0 &&  oRange.compareEndPoints('StartToEnd',oCellRange) <= 0 )
45
					|| ( oRange.compareEndPoints('EndToStart',oCellRange) >= 0 &&  oRange.compareEndPoints('EndToEnd',oCellRange) <= 0 ) )
46
				{
47
					aCells[aCells.length] = oParent.cells[i] ;
48
				}
49
			}
50
		}
51
	}
52
 
53
	return aCells ;
54
}