Changeset 261


Ignore:
Timestamp:
05/02/07 14:28:42 (5 years ago)
Author:
jf.hovinne
Message:

Added Moxide's setFocusToNode (MSIE version) in 0.2 branch.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/0.2/editor/wym.js

    r249 r261  
    495495                        } 
    496496                         
    497                         if(moz && newNode) setFocusToNode(newNode); 
     497                        if(newNode) setFocusToNode(newNode); 
    498498                } 
    499499        } 
     
    10231023 
    10241024//Moxide's patch to re-set the focus on the container 
    1025 //while calling setContainer() (Gecko only) 
     1025//while calling setContainer() 
    10261026//see #21 
    10271027function setFocusToNode(node) 
    10281028{ 
     1029  if (ie) { 
     1030    r=document.body.createTextRange(); 
     1031    r.moveToElementText(node); 
     1032    r.collapse(false); 
     1033    r.move('character',-1); 
     1034    r.select(); 
     1035    node.focus(); 
     1036  } 
     1037  else if (moz) { 
    10291038    r=document.createRange(); 
    10301039    r.selectNode(node); 
    10311040    sel=iframe().contentWindow.getSelection(); 
    10321041    sel.addRange(r); 
    1033     sel.collapse(node, 1); 
     1042    sel.collapse(node, node.childNodes.length); 
    10341043    iframe().contentWindow.focus(); 
    1035 } 
     1044  } 
     1045} 
Note: See TracChangeset for help on using the changeset viewer.