Ticket #656: selectNodeContents.patch

File selectNodeContents.patch, 1.5 KB (added by mokhet, 14 years ago)
  • htmlarea.js

     
    31743174}; 
    31753175 
    31763176// Selects the contents inside the given node 
    3177 HTMLArea.prototype.selectNodeContents = function(node, pos) { 
    3178   this.focusEditor(); 
    3179   this.forceRedraw(); 
    3180   var range; 
    3181   var collapsed = typeof pos == "undefined" ? true : false; 
    3182   if (HTMLArea.is_ie) { 
     3177if (HTMLArea.is_ie) { 
     3178  HTMLArea.prototype.selectNodeContents = function(node, pos) { 
     3179    this.focusEditor(); 
     3180    this.forceRedraw(); 
     3181    var range; 
     3182    var collapsed = typeof pos == "undefined" ? true : false; 
    31833183    // Tables and Images get selected as "objects" rather than the text contents 
    31843184    if(collapsed && node.tagName && node.tagName.toLowerCase().match(/table|img|input|select|textarea/)) 
    31853185    { 
     
    31933193      //(collapsed) && range.collapse(pos); 
    31943194    } 
    31953195    range.select(); 
    3196   } else { 
     3196  }; 
     3197} else { 
     3198  HTMLArea.prototype.selectNodeContents = function(node, pos) { 
     3199    this.focusEditor(); 
     3200    this.forceRedraw(); 
     3201    var range; 
     3202    var collapsed = typeof pos == "undefined" ? true : false; 
    31973203    var sel = this._getSelection(); 
    31983204    range = this._doc.createRange(); 
    31993205    // Tables and Images get selected as "objects" rather than the text contents 
     
    32083214    } 
    32093215    sel.removeAllRanges(); 
    32103216    sel.addRange(range); 
    3211   } 
    3212 }; 
     3217  }; 
     3218} 
    32133219 
    32143220/** Call this function to insert HTML code at the current position.  It deletes 
    32153221 * the selection, if any.