From 61606174582465c8f08688517fb702e1cf4bf395 Mon Sep 17 00:00:00 2001 From: saurabhg772244 Date: Fri, 13 Feb 2026 13:54:39 +0530 Subject: [PATCH] Fix AI inline popup issues and remove quick edit functionality --- ...GlyphPopup.svelte => AIPromptPopup.svelte} | 33 +++-- src/lib/components/DesktopEditor.svelte | 139 +++++++----------- src/lib/util/AIPromptViewZoneManager.ts | 71 +++++++++ 3 files changed, 145 insertions(+), 98 deletions(-) rename src/lib/components/{AIGlyphPopup.svelte => AIPromptPopup.svelte} (84%) create mode 100644 src/lib/util/AIPromptViewZoneManager.ts diff --git a/src/lib/components/AIGlyphPopup.svelte b/src/lib/components/AIPromptPopup.svelte similarity index 84% rename from src/lib/components/AIGlyphPopup.svelte rename to src/lib/components/AIPromptPopup.svelte index fb68de86..ded983f1 100644 --- a/src/lib/components/AIGlyphPopup.svelte +++ b/src/lib/components/AIPromptPopup.svelte @@ -4,18 +4,31 @@ import CloseIcon from '~icons/material-symbols/close-rounded'; interface Props { - top: number; show: boolean; - suggestion: string; + input: string; onClose: () => void; + onHeightChange?: (height: number) => void; onTryFree: () => void; } - let { top, show, suggestion = $bindable(), onClose, onTryFree }: Props = $props(); + let { show, input = $bindable(), onClose, onHeightChange, onTryFree }: Props = $props(); let textarea = $state(); let container = $state(); + $effect(() => { + if (!container || !onHeightChange) return; + const observer = new ResizeObserver((entries) => { + for (const entry of entries) { + if (entry.target instanceof HTMLElement) { + onHeightChange(entry.target.offsetHeight); + } + } + }); + observer.observe(container); + return () => observer.disconnect(); + }); + function resizeTextarea() { if (!textarea) return; const computed = globalThis.getComputedStyle(textarea); @@ -34,7 +47,7 @@ } $effect(() => { - if (suggestion !== undefined) { + if (input !== undefined) { resizeTextarea(); } }); @@ -58,21 +71,20 @@