diff --git a/images/turn-off-svgrepo-com.svg b/images/turn-off-svgrepo-com.svg new file mode 100644 index 0000000..6c31e9c --- /dev/null +++ b/images/turn-off-svgrepo-com.svg @@ -0,0 +1,7 @@ + + + \ No newline at end of file diff --git a/service.js b/service.js index dded9ca..cad462a 100644 --- a/service.js +++ b/service.js @@ -60,11 +60,13 @@ class BesService { false ) if (this.timer) clearTimeout(this.timer) - service.abortController.abort() + this.abortController.abort() besServices = besServices.filter(item => item !== this) this.hostElement.spellcheck = this.originalSpellcheck this.correctionPanel.remove() this.scrollPanel.remove() + this.statusDiv.remove() + this.statusIcon.remove() } /** @@ -223,6 +225,11 @@ class BesService { statusDiv.appendChild(statusIcon) this.setStatusDivPosition(hostElement, statusDiv) hostElement.parentNode.insertBefore(statusDiv, hostElement.nextSibling) + const statusPopup = document.createElement('bes-popup-status-el') + document.body.appendChild(statusPopup) + statusDiv.addEventListener('click', e => { + this.handleStatusClick(e, statusPopup) + }) return { correctionPanel, scrollPanel, statusDiv, statusIcon } } @@ -377,6 +384,10 @@ class BesService { this.statusIcon.classList.add(status) } + handleStatusClick(e, popup) { + popup.show(e.clientX, e.clientY, this) + } + /** * Tests if given element is block element. * @@ -1016,6 +1027,134 @@ class BesPopupEl extends HTMLElement { } } +class BesStatusPopup extends HTMLElement { + constructor() { + super() + this.attachShadow({ mode: 'open' }) + } + + render() { + this.shadowRoot.innerHTML = ` + +