From 2e231982a384f797671343a8de7021a6e879f233 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Sat, 5 Oct 2024 03:21:22 -0700 Subject: [PATCH] refac --- .../components/chat/Messages/ContentRenderer.svelte | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/lib/components/chat/Messages/ContentRenderer.svelte b/src/lib/components/chat/Messages/ContentRenderer.svelte index 6ee0743a1..f6393dbe4 100644 --- a/src/lib/components/chat/Messages/ContentRenderer.svelte +++ b/src/lib/components/chat/Messages/ContentRenderer.svelte @@ -27,12 +27,15 @@ // Adjust based on parent rect const top = rect.bottom - parentRect.top; const left = rect.left - parentRect.left; - - buttonsContainerElement.style.display = 'block'; - buttonsContainerElement.style.left = `${left}px`; - buttonsContainerElement.style.top = `${top + 5}px`; // +5 to add some spacing + if (buttonsContainerElement) { + buttonsContainerElement.style.display = 'block'; + buttonsContainerElement.style.left = `${left}px`; + buttonsContainerElement.style.top = `${top + 5}px`; // +5 to add some spacing + } } else { - buttonsContainerElement.style.display = 'none'; + if (buttonsContainerElement) { + buttonsContainerElement.style.display = 'none'; + } } }, 0); };