From 50deba85e7908e5adee0c445043891168e47b2cf Mon Sep 17 00:00:00 2001 From: Manuel Schmid Date: Sun, 2 Jun 2024 00:31:43 +0200 Subject: [PATCH 1/3] feat: make textboxes (incl. positive prompt) resizable again --- css/style.css | 18 +++++++++--------- webui.py | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/css/style.css b/css/style.css index 18bacaaf6..04b12d115 100644 --- a/css/style.css +++ b/css/style.css @@ -75,30 +75,30 @@ progress::after { width: 215px; } -.type_row{ - height: 80px !important; +#positive_prompt textarea { + height: 80px; } -.type_row_half{ - height: 32px !important; +.type_row { + height: 80px !important; } -.scroll-hide{ - resize: none !important; +.type_row_half { + height: 32px !important; } -.refresh_button{ +.refresh_button { border: none !important; background: none !important; font-size: none !important; box-shadow: none !important; } -.advanced_check_row{ +.advanced_check_row { width: 250px !important; } -.min_check{ +.min_check { min-width: min(1px, 100%) !important; } diff --git a/webui.py b/webui.py index 0dd863506..d7bc7765d 100644 --- a/webui.py +++ b/webui.py @@ -112,10 +112,10 @@ def generate_clicked(task: worker.AsyncTask): gallery = gr.Gallery(label='Gallery', show_label=False, object_fit='contain', visible=True, height=768, elem_classes=['resizable_area', 'main_view', 'final_gallery', 'image_gallery'], elem_id='final_gallery') - with gr.Row(elem_classes='type_row'): + 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, elem_classes='type_row', lines=1024) + container=False, autofocus=True, lines=1024) default_prompt = modules.config.default_prompt if isinstance(default_prompt, str) and default_prompt != '': From 6e555fa35aad848fb9617c60945a0c88c6a22551 Mon Sep 17 00:00:00 2001 From: Manuel Schmid Date: Sun, 2 Jun 2024 01:50:42 +0200 Subject: [PATCH 2/3] 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 04b12d115..a216d4829 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 3df32ccf4..d31537349 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 d7bc7765d..63ff6813b 100644 --- a/webui.py +++ b/webui.py @@ -115,7 +115,7 @@ def generate_clicked(task: worker.AsyncTask): 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 3/3] 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 a216d4829..6ed0f6285 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 d31537349..3df32ccf4 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() {