[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 oRange = FCK.EditorDocument.selection.createRange() ; |
---|
| 29 | // var oParent = oRange.parentElement() ; |
---|
| 30 | var oParent = FCKSelection.GetParentElement() ; |
---|
| 31 | |
---|
| 32 | if ( oParent && oParent.tagName.Equals( 'TD', 'TH' ) ) |
---|
| 33 | aCells[0] = oParent ; |
---|
| 34 | else |
---|
| 35 | { |
---|
| 36 | oParent = FCKSelection.MoveToAncestorNode( 'TABLE' ) ; |
---|
| 37 | |
---|
| 38 | if ( oParent ) |
---|
| 39 | { |
---|
| 40 | // Loops throw all cells checking if the cell is, or part of it, is inside the selection |
---|
| 41 | // and then add it to the selected cells collection. |
---|
| 42 | for ( var i = 0 ; i < oParent.cells.length ; i++ ) |
---|
| 43 | { |
---|
| 44 | var oCellRange = FCK.EditorDocument.selection.createRange() ; |
---|
| 45 | oCellRange.moveToElementText( oParent.cells[i] ) ; |
---|
| 46 | |
---|
| 47 | if ( oRange.inRange( oCellRange ) |
---|
| 48 | || ( oRange.compareEndPoints('StartToStart',oCellRange) >= 0 && oRange.compareEndPoints('StartToEnd',oCellRange) <= 0 ) |
---|
| 49 | || ( oRange.compareEndPoints('EndToStart',oCellRange) >= 0 && oRange.compareEndPoints('EndToEnd',oCellRange) <= 0 ) ) |
---|
| 50 | { |
---|
| 51 | aCells[aCells.length] = oParent.cells[i] ; |
---|
| 52 | } |
---|
| 53 | } |
---|
| 54 | } |
---|
| 55 | } |
---|
| 56 | |
---|
| 57 | return aCells ; |
---|
| 58 | } |
---|