Ignore:
Timestamp:
01/28/07 03:43:05 (13 years ago)
Author:
ray
Message:

Ticket #900 retain editing position position between modes

File:
1 edited

Legend:

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

    r697 r703  
    400400  return element.outerHTML; 
    401401}; 
     402 
     403Xinha.prototype.setCC = function ( target ) 
     404{ 
     405  if ( target == "textarea" ) 
     406  { 
     407    var ta = this._textArea; 
     408    var pos = document.selection.createRange(); 
     409    pos.collapse(); 
     410    pos.text = this.cc; 
     411    var index = ta.value.indexOf( this.cc ); 
     412    var before = ta.value.substring( 0, index ); 
     413    var after  = ta.value.substring( index + this.cc.length , ta.value.length ); 
     414     
     415    if ( after.match(/^[^<]*>/) ) 
     416    { 
     417      var tagEnd = after.indexOf(">") + 1; 
     418      ta.value = before + after.substring( 0, tagEnd ) + this.cc + after.substring( tagEnd, after.length ); 
     419    } 
     420    else ta.value = before + this.cc + after; 
     421  } 
     422  else 
     423  { 
     424    var sel = this.getSelection(); 
     425    var r = sel.createRange();  
     426    r.collapse(); 
     427    r.text = this.cc; 
     428  } 
     429}; 
     430 
     431Xinha.prototype.findCC = function ( target ) 
     432{ 
     433  var findIn = ( target == 'textarea' ) ? this._textArea : this._doc.body; 
     434  range = findIn.createTextRange(); 
     435  if( range.findText( this.cc ) ) 
     436  { 
     437    range.select(); 
     438    range.text = ''; 
     439  } 
     440  if ( target == 'textarea' ) this._textArea.focus(); 
     441}; 
Note: See TracChangeset for help on using the changeset viewer.