fcktablehandler_ie.js
上传用户:li2971742
上传日期:2021-11-18
资源大小:39096k
文件大小:2k
源码类别:

OA系统

开发平台:

C#

  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. FCKTableHandler.GetSelectedCells = function()
  20. {
  21. var aCells = new Array() ;
  22. var oRange = FCK.EditorDocument.selection.createRange() ;
  23. // var oParent = oRange.parentElement() ;
  24. var oParent = FCKSelection.GetParentElement() ;
  25. if ( oParent && oParent.tagName.Equals( 'TD', 'TH' ) )
  26. aCells[0] = oParent ;
  27. else
  28. {
  29. var oParent = FCKSelection.MoveToAncestorNode( "TABLE" ) ;
  30. if ( oParent )
  31. {
  32. // Loops throw all cells checking if the cell is, or part of it, is inside the selection
  33. // and then add it to the selected cells collection.
  34. for ( var i = 0 ; i < oParent.cells.length ; i++ )
  35. {
  36. var oCellRange = FCK.EditorDocument.selection.createRange() ;
  37. oCellRange.moveToElementText( oParent.cells[i] ) ;
  38. if ( oRange.inRange( oCellRange ) 
  39. || ( oRange.compareEndPoints('StartToStart',oCellRange) >= 0 &&  oRange.compareEndPoints('StartToEnd',oCellRange) <= 0 )
  40. || ( oRange.compareEndPoints('EndToStart',oCellRange) >= 0 &&  oRange.compareEndPoints('EndToEnd',oCellRange) <= 0 ) )
  41. {
  42. aCells[aCells.length] = oParent.cells[i] ;
  43. }
  44. }
  45. }
  46. }
  47. return aCells ;
  48. }