service2.js: Reintroduce window resize event listening
This is an emergency solution to track host element position changing.
This commit is contained in:
		
							
								
								
									
										16
									
								
								service2.js
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								service2.js
									
									
									
									
									
								
							@@ -9,6 +9,14 @@
 | 
			
		||||
 */
 | 
			
		||||
let besServices = []
 | 
			
		||||
 | 
			
		||||
// TODO: Window resize may cause host element(s) to move. That needs correction panel and status icon
 | 
			
		||||
// repositioning. Also, should any parent element of our service host element move, we should reposition
 | 
			
		||||
// correction panel and status icon. How to do this? Alas there is no PlacementObserver to monitor host
 | 
			
		||||
// element movements.
 | 
			
		||||
window.addEventListener('resize', () =>
 | 
			
		||||
  besServices.forEach(service => service.onReposition())
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
/*************************************************************************
 | 
			
		||||
 *
 | 
			
		||||
 * Base class for all grammar-checking services
 | 
			
		||||
@@ -135,6 +143,14 @@ class BesService {
 | 
			
		||||
    }, 500)
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Called to report repositioning
 | 
			
		||||
   */
 | 
			
		||||
  onReposition() {
 | 
			
		||||
    this.setCorrectionPanelSize()
 | 
			
		||||
    this.setStatusDivPosition()
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Called to report resizing
 | 
			
		||||
   */
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user