Changeset 1044 for trunk/modules/Gecko


Ignore:
Timestamp:
10/02/08 17:07:26 (11 years ago)
Author:
douglas
Message:

FIXED Ticket #1176 Merging new dialogs branch back to trunk.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/modules/Gecko/Gecko.js

    r1001 r1044  
    576576Xinha.prototype.restoreSelection = function(savedSelection) 
    577577{ 
     578  try  
     579  { 
    578580  var sel = this.getSelection(); 
    579581  sel.removeAllRanges(); 
    580582  sel.addRange(savedSelection); 
     583  } 
     584  catch (e) {} 
    581585} 
    582586/** 
     
    585589 * 
    586590 * @param node DomNode  
    587  * @param pos  Set to a numeric position inside the node to collapse the cursor here if possible.  
    588  */ 
    589   
    590 Xinha.prototype.selectNodeContents = function(node, pos) 
     591 * @param collapseToStart A boolean that, when supplied, says to collapse the selection. True collapses to the start, and false to the end. 
     592 */ 
     593  
     594Xinha.prototype.selectNodeContents = function(node, collapseToStart) 
    591595{ 
    592596  this.focusEditor(); 
    593597  this.forceRedraw(); 
    594598  var range; 
    595   var collapsed = typeof pos == "undefined" ? true : false; 
     599  var collapsed = typeof collapseToStart == "undefined" ? true : false; 
    596600  var sel = this.getSelection(); 
    597601  range = this._doc.createRange(); 
     
    609613  { 
    610614    range.selectNodeContents(node); 
    611     //(collapsed) && range.collapse(pos); 
    612615  } 
    613616  sel.removeAllRanges(); 
    614617  sel.addRange(range); 
     618  if (typeof collapseToStart != "undefined") 
     619  { 
     620    if (collapseToStart) 
     621    { 
     622      sel.collapse(range.startContainer, range.startOffset); 
     623    } else 
     624    { 
     625      sel.collapse(range.endContainer, range.endOffset); 
     626    } 
     627  } 
    615628}; 
    616629   
Note: See TracChangeset for help on using the changeset viewer.