From d16640b8a9a0d57e64910f1f493acf6e21443c34 Mon Sep 17 00:00:00 2001 From: Chris Dumas Date: Thu, 15 Oct 2026 11:09:23 +0000 Subject: [PATCH] Anchor autocomplete inside prompt editor --- web/sequence_prompt_builder.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/web/sequence_prompt_builder.js b/web/sequence_prompt_builder.js index 7d590aa..eefc6f6 100644 --- a/web/sequence_prompt_builder.js +++ b/web/sequence_prompt_builder.js @@ -165,6 +165,7 @@ function configure(node) { let promptSelectionEnd = 0; let autocomplete = null; let autocompleteRange = null; + let promptFrame = null; const segments = []; const handles = []; const updateTimeline = () => { @@ -337,11 +338,9 @@ function configure(node) { closeAutocomplete(); autocompleteRange = { start: at, end: at + 1 }; const menu = el("div"); - menu.style.cssText = "position:absolute;z-index:30;min-width:220px;max-width:310px;padding:5px;background:#25282b;border:1px solid #4b5960;border-radius:8px;box-shadow:0 8px 24px #000b;color:#e7edf0;pointer-events:auto"; - const rect = prompt.getBoundingClientRect(); - const parentRect = panel.getBoundingClientRect(); - menu.style.left = `${Math.max(5, Math.min(panel.clientWidth - 230, rect.left - parentRect.left + 14))}px`; - menu.style.top = `${rect.top - parentRect.top + 26}px`; + menu.style.cssText = "position:absolute;z-index:30;left:4px;min-width:220px;max-width:310px;padding:5px;background:#25282b;border:1px solid #4b5960;border-radius:8px;box-shadow:0 8px 24px #000b;color:#e7edf0;pointer-events:auto"; + const line = prompt.value.slice(0, promptSelectionStart).split("\n").length - 1; + menu.style.top = `${Math.min(Math.max(4, prompt.clientHeight - 150), 4 + line * 17)}px`; const connected = Array.from({ length: 9 }, (_, offset) => offset + 1) .filter((index) => node.inputs?.some((input) => input.name === `reference_image_${index}` && input.link != null)); const addOption = (content, title, action) => { @@ -379,7 +378,7 @@ function configure(node) { syncPrompt(clip, clip.prompt); addSlot(clip); rebuildPromptAfterStructureChange(clip); closeAutocomplete(); setState(); render(); }); - panel.append(menu); autocomplete = menu; + promptFrame?.append(menu); autocomplete = menu; }; prompt.oninput = () => { rememberPromptSelection(); promptText = prompt.value; clip.prompt = prompt.value; }; prompt.onselect = rememberPromptSelection; @@ -401,7 +400,10 @@ function configure(node) { syncPrompt(clip, clip.prompt); persistState(); openAutocomplete(start); }; - panel.append(prompt); + promptFrame = el("div"); + promptFrame.style.cssText = "position:relative;width:100%;box-sizing:border-box"; + promptFrame.append(prompt); + panel.append(promptFrame); const checkLabel = el("div", "PROMPT CHECK"); checkLabel.style.cssText = "color:#8fa898;font-size:10px;letter-spacing:.08em;margin:7px 0 3px"; panel.append(checkLabel); const check = el("div", `${clip.slots.length} shot${clip.slots.length === 1 ? "" : "s"} · ${duration.toFixed(1)}s chunk · @ references preserved`); check.style.cssText = "padding:6px 8px;background:#171717;border:1px solid #444;border-radius:4px;color:#9bd0a8;font:11px monospace"; panel.append(check); const encoderLabel = el("div", "SENT TO ENCODER AS"); encoderLabel.style.cssText = "color:#8fa898;font-size:10px;letter-spacing:.08em;margin:7px 0 3px"; panel.append(encoderLabel);