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_gecko.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 oSelection = FCK.EditorWindow.getSelection() ; |
---|
25 | |
---|
26 | // If the selection is a text. |
---|
27 | if ( oSelection.rangeCount == 1 && oSelection.anchorNode.nodeType == 3 ) |
---|
28 | { |
---|
29 | var oParent = FCKTools.GetElementAscensor( oSelection.anchorNode, 'TD,TH' ) ; |
---|
30 | |
---|
31 | if ( oParent ) |
---|
32 | { |
---|
33 | aCells[0] = oParent ; |
---|
34 | return aCells ; |
---|
35 | } |
---|
36 | } |
---|
37 | |
---|
38 | for ( var i = 0 ; i < oSelection.rangeCount ; i++ ) |
---|
39 | { |
---|
40 | var oRange = oSelection.getRangeAt(i) ; |
---|
41 | var oCell ; |
---|
42 | |
---|
43 | if ( oRange.startContainer.tagName.Equals( 'TD', 'TH' ) ) |
---|
44 | oCell = oRange.startContainer ; |
---|
45 | else |
---|
46 | oCell = oRange.startContainer.childNodes[ oRange.startOffset ] ; |
---|
47 | |
---|
48 | if ( oCell.tagName.Equals( 'TD', 'TH' ) ) |
---|
49 | aCells[aCells.length] = oCell ; |
---|
50 | } |
---|
51 | |
---|
52 | return aCells ; |
---|
53 | } |
---|