File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,18 @@ export function fixupOvertype(instances: OverTypeInstance[]): OverTypeInstance {
77      `Expected OverType to return exactly 1 instance, got ${ instances . length }  ` 
88    ) 
99  } 
10-   return  instances [ 0 ] ! 
10+   const  overtype  =  instances [ 0 ] ! 
11+   // this works, but we're now updating twice as often as we need to, because 
12+   // overtype has a built-in update which usually works but not always (#101) 
13+   // and we're doing this which does always work 
14+   const  updateOnChange  =  new  MutationObserver ( ( )  =>  { 
15+     overtype . updatePreview ( ) 
16+   } ) 
17+   updateOnChange . observe ( overtype . textarea ,  { 
18+     attributes : true , 
19+     characterData : true , 
20+   } ) 
21+   return  overtype 
1122} 
1223
1324// Modify the DOM to trick overtype into adopting it instead of recreating it 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments