From 9d92e5bdf400227aa35e52176bbc05ee62c8e7d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20=20Sk=C3=B6ld?= Date: Thu, 6 Feb 2025 01:05:38 +0100 Subject: [PATCH] Do not show tag tooltip when typing --- web/js/textHighlight.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/web/js/textHighlight.js b/web/js/textHighlight.js index 4098613..ab4fc01 100644 --- a/web/js/textHighlight.js +++ b/web/js/textHighlight.js @@ -49,8 +49,27 @@ function enhanceTextarea(textarea) { let currentTooltipTag = null; let tooltipTimeout = null; + let isTyping = false; + let typingTimeout = null; + textarea.style.background = "transparent"; + + // Add input handler for typing state + textarea.addEventListener("input", () => { + isTyping = true; + if (typingTimeout) { + clearTimeout(typingTimeout); + } + typingTimeout = setTimeout(() => { + isTyping = false; + }, 1000); // Reset typing state after 1 second of no input + }); + textarea.addEventListener("mousemove", (e) => { + if (isTyping) { + return; + } + // Clear existing timeout if (tooltipTimeout) { clearTimeout(tooltipTimeout);