/EQT_V1/EQTWebApp/fckeditor/editor/_source/internals/fcktablehandler_ie.js

http://sgsoft-las.googlecode.com/ · JavaScript · 64 lines · 32 code · 7 blank · 25 comment · 11 complexity · 8954347cda0fb0ecdc3fea29e939da2b MD5 · raw file

  1. /*
  2. * FCKeditor - The text editor for Internet - http://www.fckeditor.net
  3. * Copyright (C) 2003-2009 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', 'TH'] ) ;
  28. return td ? [ td ] : [] ;
  29. }
  30. var aCells = new Array() ;
  31. var oRange = FCKSelection.GetSelection().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. }