Server IP : 23.254.227.96 / Your IP : 216.73.216.46 Web Server : Apache/2.4.62 (Unix) OpenSSL/1.1.1k System : Linux hwsrv-1277026.hostwindsdns.com 4.18.0-477.13.1.el8_8.x86_64 #1 SMP Tue May 30 14:53:41 EDT 2023 x86_64 User : viralblo ( 1001) PHP Version : 8.1.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/viralblo/public_html/quill/ui/ |
Upload File : |
class Tooltip { constructor(quill, boundsContainer) { this.quill = quill; this.boundsContainer = boundsContainer || document.body; this.root = quill.addContainer('ql-tooltip'); this.root.innerHTML = this.constructor.TEMPLATE; if (this.quill.root === this.quill.scrollingContainer) { this.quill.root.addEventListener('scroll', () => { this.root.style.marginTop = (-1*this.quill.root.scrollTop) + 'px'; }); } this.hide(); } hide() { this.root.classList.add('ql-hidden'); } position(reference) { let left = reference.left + reference.width/2 - this.root.offsetWidth/2; // root.scrollTop should be 0 if scrollContainer !== root let top = reference.bottom + this.quill.root.scrollTop; this.root.style.left = left + 'px'; this.root.style.top = top + 'px'; this.root.classList.remove('ql-flip'); let containerBounds = this.boundsContainer.getBoundingClientRect(); let rootBounds = this.root.getBoundingClientRect(); let shift = 0; if (rootBounds.right > containerBounds.right) { shift = containerBounds.right - rootBounds.right; this.root.style.left = (left + shift) + 'px'; } if (rootBounds.left < containerBounds.left) { shift = containerBounds.left - rootBounds.left; this.root.style.left = (left + shift) + 'px'; } if (rootBounds.bottom > containerBounds.bottom) { let height = rootBounds.bottom - rootBounds.top; let verticalShift = reference.bottom - reference.top + height; this.root.style.top = (top - verticalShift) + 'px'; this.root.classList.add('ql-flip'); } return shift; } show() { this.root.classList.remove('ql-editing'); this.root.classList.remove('ql-hidden'); } } export default Tooltip;