From 6e555fa35aad848fb9617c60945a0c88c6a22551 Mon Sep 17 00:00:00 2001 From: Manuel Schmid Date: Sun, 2 Jun 2024 01:50:42 +0200 Subject: [PATCH 1/2] wip: auto-resize positive prompt on new line dirty approach as container is hidden and 1px padding is applied for border shadow to actually work --- css/style.css | 8 ++++++++ javascript/viewer.js | 1 + webui.py | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/css/style.css b/css/style.css index 04b12d11..a216d482 100644 --- a/css/style.css +++ b/css/style.css @@ -74,6 +74,14 @@ progress::after { text-align: right; width: 215px; } +div:has(> #positive_prompt) { + border: none; +} + +#positive_prompt { + padding: 1px; + background: var(--background-fill-primary); +} #positive_prompt textarea { height: 80px; diff --git a/javascript/viewer.js b/javascript/viewer.js index 3df32ccf..d3153734 100644 --- a/javascript/viewer.js +++ b/javascript/viewer.js @@ -55,6 +55,7 @@ window.addEventListener('resize', (e) => { onUiLoaded(async () => { resized(); + setTimeout(() => document.querySelector("#positive_prompt textarea").style.height = "80px"); }); function on_style_selection_blur() { diff --git a/webui.py b/webui.py index d7bc7765..63ff6813 100644 --- a/webui.py +++ b/webui.py @@ -115,7 +115,7 @@ with shared.gradio_root: with gr.Row(): with gr.Column(scale=17): prompt = gr.Textbox(show_label=False, placeholder="Type prompt here or paste parameters.", elem_id='positive_prompt', - container=False, autofocus=True, lines=1024) + autofocus=True, lines=3) default_prompt = modules.config.default_prompt if isinstance(default_prompt, str) and default_prompt != '': From 12bc7af0671ac7d2f9a6bd4d344031818fb24a43 Mon Sep 17 00:00:00 2001 From: Manuel Schmid Date: Sun, 2 Jun 2024 01:54:55 +0200 Subject: [PATCH 2/2] feat: set row height to 84, exactly matching 3 lines for positive prompt eliminate need for JS to resize positive prompt onUiLoaded --- css/style.css | 8 ++------ javascript/viewer.js | 1 - 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/css/style.css b/css/style.css index a216d482..6ed0f628 100644 --- a/css/style.css +++ b/css/style.css @@ -83,16 +83,12 @@ div:has(> #positive_prompt) { background: var(--background-fill-primary); } -#positive_prompt textarea { - height: 80px; -} - .type_row { - height: 80px !important; + height: 84px !important; } .type_row_half { - height: 32px !important; + height: 34px !important; } .refresh_button { diff --git a/javascript/viewer.js b/javascript/viewer.js index d3153734..3df32ccf 100644 --- a/javascript/viewer.js +++ b/javascript/viewer.js @@ -55,7 +55,6 @@ window.addEventListener('resize', (e) => { onUiLoaded(async () => { resized(); - setTimeout(() => document.querySelector("#positive_prompt textarea").style.height = "80px"); }); function on_style_selection_blur() {