fcktablehandler_ie.js
上传用户:ah_jiwei
上传日期:2022-07-24
资源大小:54044k
文件大小:2k
源码类别:

数据库编程

开发平台:

Visual C++

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