From 7ee07df26a4c61b150912fe7b9b6364ac6ea6956 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Sat, 5 Oct 2024 22:23:06 -0700 Subject: [PATCH] refac --- src/lib/components/chat/Messages/ContentRenderer.svelte | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib/components/chat/Messages/ContentRenderer.svelte b/src/lib/components/chat/Messages/ContentRenderer.svelte index dc7206ab3..72829ce64 100644 --- a/src/lib/components/chat/Messages/ContentRenderer.svelte +++ b/src/lib/components/chat/Messages/ContentRenderer.svelte @@ -15,9 +15,13 @@ let contentContainerElement; let buttonsContainerElement; - const updateButtonPosition = () => { + const updateButtonPosition = (event) => { setTimeout(async () => { await tick(); + + // Check if the event target is within the content container + if (!contentContainerElement.contains(event.target)) return; + let selection = window.getSelection(); if (selection.toString().trim().length > 0) {