// TODO: Research if there is a way to disable languageTool & Grammarly extensions in CKEditor
// TODO: Revise absolute/relative placement of auxiliary
we inject into DOM. Absolute is more
// controllable, but lacks PlacementObserver; relative is tricky to prevent document flow
// issues, but moves with the DOM element.
/**
* Collection of all grammar checking services in the document
*
* We dispatch relevant window messages to all services registered here.
*/
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. Switch to relative placement for our
// auxiliary
s?
window.addEventListener('resize', () =>
besServices.forEach(service => service.onReposition())
)
/**************************************************************************************************
*
* Base class for all grammar-checking services
*
* This class provides properties and implementations of methods common to all types of HTML
* controls.
*
* This is an intermediate class and may not be used directly in client code.
*
*************************************************************************************************/
class BesService {
/**
* Constructs class.
*
* @param {Element} hostElement The element in DOM tree we are providing grammar-checking service
* for
* @param {Element} textElement The element in DOM tree that hosts coordinate-measurable clone of
* the text to proof. Same as hostElement for