Changeset 1042


Ignore:
Timestamp:
10/01/08 20:52:00 (6 years ago)
Author:
douglas
Message:

FIXED Ticket #1276 Update selectNodeContents to collapse in one direction or another, not to a specific location. Update docs to reflect this

Location:
branches/new-dialogs/modules
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/new-dialogs/modules/Gecko/Gecko.js

    r1035 r1042  
    589589 * 
    590590 * @param node DomNode  
    591  * @param pos  Set to a numeric position inside the node to collapse the cursor here if possible.  
    592  */ 
    593   
    594 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) 
    595595{ 
    596596  this.focusEditor(); 
    597597  this.forceRedraw(); 
    598598  var range; 
    599   var collapsed = typeof pos == "undefined" ? true : false; 
     599  var collapsed = typeof collapseToStart == "undefined" ? true : false; 
    600600  var sel = this.getSelection(); 
    601601  range = this._doc.createRange(); 
     
    616616  sel.removeAllRanges(); 
    617617  sel.addRange(range); 
    618   if (typeof pos != "undefined") 
    619   { 
    620     if (pos) 
     618  if (typeof collapseToStart != "undefined") 
     619  { 
     620    if (collapseToStart) 
    621621    { 
    622622      sel.collapse(range.startContainer, range.startOffset); 
  • branches/new-dialogs/modules/InternetExplorer/InternetExplorer.js

    r1041 r1042  
    576576 * 
    577577 * @param node DomNode  
    578  * @param pos  Set to a numeric position inside the node to collapse the cursor here if possible.  
    579  */ 
    580   
    581 Xinha.prototype.selectNodeContents = function(node, pos) 
     578 * @param collapseToStart A boolean that, when supplied, says to collapse the selection. True collapses to the start, and false to the end. 
     579 */ 
     580  
     581Xinha.prototype.selectNodeContents = function(node, collapseToStart) 
    582582{ 
    583583  this.focusEditor(); 
    584584  this.forceRedraw(); 
    585585  var range; 
    586   var collapsed = typeof pos == "undefined" ? true : false; 
     586  var collapsed = typeof collapseToStart == "undefined" ? true : false; 
    587587  // Tables and Images get selected as "objects" rather than the text contents 
    588588  if ( collapsed && node.tagName && node.tagName.toLowerCase().match(/table|img|input|select|textarea/) ) 
     
    679679    { 
    680680      range.moveToElementText(node); 
     681    } 
     682  } 
     683  if (typeof collapseToStart != "undefined") 
     684  { 
     685    range.collapse(collapseToStart); 
     686    if (!collapseToStart) 
     687    { 
     688      range.moveStart('character',-1); 
     689      range.moveEnd('character',-1); 
    681690    } 
    682691  } 
  • branches/new-dialogs/modules/Opera/Opera.js

    r1001 r1042  
    576576 * 
    577577 * @param node DomNode  
    578  * @param pos  Set to a numeric position inside the node to collapse the cursor here if possible.  
    579  */ 
    580   
    581 Xinha.prototype.selectNodeContents = function(node, pos) 
     578 * @param collapseToStart A boolean that, when supplied, says to collapse the selection. True collapses to the start, and false to the end. 
     579 */ 
     580  
     581Xinha.prototype.selectNodeContents = function(node, collapseToStart) 
    582582{ 
    583583  this.focusEditor(); 
    584584  this.forceRedraw(); 
    585585  var range; 
    586   var collapsed = typeof pos == "undefined" ? true : false; 
     586  var collapsed = typeof collapseToStart == "undefined" ? true : false; 
    587587  var sel = this.getSelection(); 
    588588  range = this._doc.createRange(); 
     
    595595  { 
    596596    range.selectNodeContents(node); 
    597     //(collapsed) && range.collapse(pos); 
    598597  } 
    599598  sel.removeAllRanges(); 
    600599  sel.addRange(range); 
     600  if (typeof collapseToStart != "undefined") 
     601  { 
     602    if (collapseToStart) 
     603    { 
     604      sel.collapse(range.startContainer, range.startOffset); 
     605    } else 
     606    { 
     607      sel.collapse(range.endContainer, range.endOffset); 
     608    } 
     609  } 
    601610}; 
    602611   
  • branches/new-dialogs/modules/WebKit/WebKit.js

    r1039 r1042  
    574574 * 
    575575 * @param node DomNode  
    576  * @param pos  Set to a numeric position inside the node to collapse the cursor here if possible.  
    577  */ 
    578   
    579 Xinha.prototype.selectNodeContents = function(node, pos) 
     576 * @param collapseToStart A boolean that, when supplied, says to collapse the selection. True collapses to the start, and false to the end. 
     577 */ 
     578  
     579Xinha.prototype.selectNodeContents = function(node, collapseToStart) 
    580580{ 
    581581  this.focusEditor(); 
    582582  this.forceRedraw(); 
    583583  var range; 
    584   var collapsed = typeof pos == "undefined" ? true : false; 
     584  var collapsed = typeof collapseToStart == "undefined" ? true : false; 
    585585  var sel = this.getSelection(); 
    586586  range = this._doc.createRange(); 
     
    596596  sel.removeAllRanges(); 
    597597  sel.addRange(range); 
    598   if (typeof pos != "undefined") 
    599   { 
    600     if (pos) 
     598  if (typeof collapseToStart != "undefined") 
     599  { 
     600    if (collapseToStart) 
    601601    { 
    602602      sel.collapse(range.startContainer, range.startOffset); 
Note: See TracChangeset for help on using the changeset viewer.