79383596

Date: 2025-01-24 07:53:59
Score: 1
Natty:
Report link

**The link tooltip cut off by edge of the React quill editor Conditionally handle: If the link is -negative on the left than replace it with 10px else default position. **

enter image description here

useEffect(() => {
const adjustTooltipPosition = () => {
    const tooltip = document.querySelector('.ql-tooltip');
    if (tooltip) {
        const left = parseFloat(tooltip.style.left) || 0;
        if (left < 0) {
            tooltip.style.left = '10px';
        }
    }
};

const observer = new MutationObserver(adjustTooltipPosition);
const editorContainer = document.querySelector('.ql-container');

if (editorContainer) {
    observer.observe(editorContainer, {
        childList: true,
        subtree: true,
        attributes: true,
    });
}

return () => {
    observer.disconnect();
};

}, []);

enter image description here enter image description here

Reasons:
  • Blacklisted phrase (1): enter image description here
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Jaydeep Solanki