Auto-fit Beat Prompt node height

This commit is contained in:
2026-08-27 07:17:51 +00:00
parent d24f9b262f
commit 0a0692db40
+13 -5
View File
@@ -44,10 +44,6 @@ function injectCSS() {
.dh3bp-root { .dh3bp-root {
box-sizing: border-box; box-sizing: border-box;
width: 100%; width: 100%;
height: 100%;
display: flex;
flex-direction: column;
overflow: auto;
pointer-events: auto; pointer-events: auto;
color: #e8e8e8; color: #e8e8e8;
font: 12px/1.35 "Segoe UI", sans-serif; font: 12px/1.35 "Segoe UI", sans-serif;
@@ -80,7 +76,6 @@ function injectCSS() {
} }
.dh3bp-list { .dh3bp-list {
display: flex; display: flex;
flex: 1 1 auto;
flex-direction: column; flex-direction: column;
gap: 10px; gap: 10px;
} }
@@ -306,6 +301,18 @@ function stopCanvasKeyboard(event) {
if (isInteractiveTarget(event.target)) event.stopImmediatePropagation(); 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) { function renderUI(node) {
const ui = node._dh3bpUI; const ui = node._dh3bpUI;
if (!ui) return; if (!ui) return;
@@ -474,6 +481,7 @@ function renderUI(node) {
updateTextareaHeight(textarea); updateTextareaHeight(textarea);
}); });
fitNodeHeight(node);
node.setDirtyCanvas?.(true, true); node.setDirtyCanvas?.(true, true);
} }