From 0a0692db409f049cd4c68ae8768ff6137804c4bf Mon Sep 17 00:00:00 2001 From: Chris Dumas Date: Thu, 27 Aug 2026 07:17:51 +0000 Subject: [PATCH] Auto-fit Beat Prompt node height --- js/h3_beat_prompt/index.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/js/h3_beat_prompt/index.js b/js/h3_beat_prompt/index.js index 7896372..2493b7e 100644 --- a/js/h3_beat_prompt/index.js +++ b/js/h3_beat_prompt/index.js @@ -44,10 +44,6 @@ function injectCSS() { .dh3bp-root { box-sizing: border-box; width: 100%; - height: 100%; - display: flex; - flex-direction: column; - overflow: auto; pointer-events: auto; color: #e8e8e8; font: 12px/1.35 "Segoe UI", sans-serif; @@ -80,7 +76,6 @@ function injectCSS() { } .dh3bp-list { display: flex; - flex: 1 1 auto; flex-direction: column; gap: 10px; } @@ -306,6 +301,18 @@ function stopCanvasKeyboard(event) { if (isInteractiveTarget(event.target)) event.stopImmediatePropagation(); } +function fitNodeHeight(node) { + const root = node?._dh3bpUI?.root; + if (!root) return; + requestAnimationFrame(() => { + const contentHeight = Math.ceil(root.scrollHeight || 0); + const nextHeight = Math.max(DEFAULT_H, contentHeight + 6); + if (Math.abs((node.size?.[1] || 0) - nextHeight) < 2) return; + node.size[1] = nextHeight; + node.setDirtyCanvas?.(true, true); + }); +} + function renderUI(node) { const ui = node._dh3bpUI; if (!ui) return; @@ -474,6 +481,7 @@ function renderUI(node) { updateTextareaHeight(textarea); }); + fitNodeHeight(node); node.setDirtyCanvas?.(true, true); }