**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. **
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();
};
}, []);