[1349] | 1 | /* |
---|
| 2 | * FCKeditor - The text editor for Internet - http://www.fckeditor.net |
---|
| 3 | * Copyright (C) 2003-2007 Frederico Caldeira Knabben |
---|
| 4 | * |
---|
| 5 | * == BEGIN LICENSE == |
---|
| 6 | * |
---|
| 7 | * Licensed under the terms of any of the following licenses at your |
---|
| 8 | * choice: |
---|
| 9 | * |
---|
| 10 | * - GNU General Public License Version 2 or later (the "GPL") |
---|
| 11 | * http://www.gnu.org/licenses/gpl.html |
---|
| 12 | * |
---|
| 13 | * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") |
---|
| 14 | * http://www.gnu.org/licenses/lgpl.html |
---|
| 15 | * |
---|
| 16 | * - Mozilla Public License Version 1.1 or later (the "MPL") |
---|
| 17 | * http://www.mozilla.org/MPL/MPL-1.1.html |
---|
| 18 | * |
---|
| 19 | * == END LICENSE == |
---|
| 20 | * |
---|
| 21 | * Manage table operations (IE specific). |
---|
| 22 | */ |
---|
| 23 | |
---|
| 24 | FCKTableHandler.GetSelectedCells = function() |
---|
| 25 | { |
---|
| 26 | var aCells = new Array() ; |
---|
| 27 | |
---|
| 28 | var oSelection = FCK.EditorWindow.getSelection() ; |
---|
| 29 | |
---|
| 30 | // If the selection is a text. |
---|
| 31 | if ( oSelection.rangeCount == 1 && oSelection.anchorNode.nodeType == 3 ) |
---|
| 32 | { |
---|
| 33 | var oParent = FCKTools.GetElementAscensor( oSelection.anchorNode, 'TD,TH' ) ; |
---|
| 34 | |
---|
| 35 | if ( oParent ) |
---|
| 36 | { |
---|
| 37 | aCells[0] = oParent ; |
---|
| 38 | return aCells ; |
---|
| 39 | } |
---|
| 40 | } |
---|
| 41 | |
---|
| 42 | for ( var i = 0 ; i < oSelection.rangeCount ; i++ ) |
---|
| 43 | { |
---|
| 44 | var oRange = oSelection.getRangeAt(i) ; |
---|
| 45 | var oCell ; |
---|
| 46 | |
---|
| 47 | if ( oRange.startContainer.tagName.Equals( 'TD', 'TH' ) ) |
---|
| 48 | oCell = oRange.startContainer ; |
---|
| 49 | else |
---|
| 50 | oCell = oRange.startContainer.childNodes[ oRange.startOffset ] ; |
---|
| 51 | |
---|
| 52 | if ( oCell.tagName.Equals( 'TD', 'TH' ) ) |
---|
| 53 | aCells[aCells.length] = oCell ; |
---|
| 54 | } |
---|
| 55 | |
---|
| 56 | return aCells ; |
---|
| 57 | } |
---|