Skip to content

Commit 3a19e69

Browse files
whitphxgradio-pr-botfreddyaboulton
authored
Revert text disable (#9677)
* Revert change on MultimodalTextbox in #9593 * Revert "Disable the submit button and enter-key submit when the text is empty (#9583)" This reverts commit b92a762. * add changeset --------- Co-authored-by: gradio-pr-bot <[email protected]> Co-authored-by: Freddy Boulton <[email protected]>
1 parent d86c282 commit 3a19e69

File tree

3 files changed

+20
-16
lines changed

3 files changed

+20
-16
lines changed

.changeset/smart-bears-think.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@gradio/multimodaltextbox": minor
3+
"@gradio/textbox": minor
4+
"gradio": minor
5+
---
6+
7+
feat:Revert text disable

js/multimodaltextbox/shared/MultimodalTextbox.svelte

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@
6868
6969
$: if (value === null) value = { text: "", files: [] };
7070
$: value, el && lines !== max_lines && resize(el, lines, max_lines);
71-
$: can_submit = value.text !== "" || value.files.length > 0;
7271
7372
const dispatch = createEventDispatcher<{
7473
change: typeof value;
@@ -128,19 +127,15 @@
128127
await tick();
129128
if (e.key === "Enter" && e.shiftKey && lines > 1) {
130129
e.preventDefault();
131-
if (can_submit) {
132-
dispatch("submit");
133-
}
130+
dispatch("submit");
134131
} else if (
135132
e.key === "Enter" &&
136133
!e.shiftKey &&
137134
lines === 1 &&
138135
max_lines >= 1
139136
) {
140137
e.preventDefault();
141-
if (can_submit) {
142-
dispatch("submit");
143-
}
138+
dispatch("submit");
144139
}
145140
}
146141
@@ -346,7 +341,6 @@
346341
class="submit-button"
347342
class:padded-button={submit_btn !== true}
348343
on:click={handle_submit}
349-
disabled={!can_submit}
350344
>
351345
{#if submit_btn === true}
352346
<Send />
@@ -463,6 +457,11 @@
463457
background: var(--button-secondary-background-fill);
464458
cursor: initial;
465459
}
460+
.stop-button:active,
461+
.upload-button:active,
462+
.submit-button:active {
463+
box-shadow: var(--button-shadow-active);
464+
}
466465
467466
.submit-button :global(svg) {
468467
height: 22px;

js/textbox/shared/Textbox.svelte

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
const show_textbox_border = !submit_btn;
4242
4343
$: value, el && lines !== max_lines && resize({ target: el });
44-
$: can_submit = value !== "";
4544
4645
$: if (value === null) value = "";
4746
@@ -113,19 +112,15 @@
113112
await tick();
114113
if (e.key === "Enter" && e.shiftKey && lines > 1) {
115114
e.preventDefault();
116-
if (can_submit) {
117-
dispatch("submit");
118-
}
115+
dispatch("submit");
119116
} else if (
120117
e.key === "Enter" &&
121118
!e.shiftKey &&
122119
lines === 1 &&
123120
max_lines >= 1
124121
) {
125122
e.preventDefault();
126-
if (can_submit) {
127-
dispatch("submit");
128-
}
123+
dispatch("submit");
129124
}
130125
}
131126
@@ -304,7 +299,6 @@
304299
class="submit-button"
305300
class:padded-button={submit_btn !== true}
306301
on:click={handle_submit}
307-
disabled={!can_submit}
308302
>
309303
{#if submit_btn === true}
310304
<Send />
@@ -448,6 +442,10 @@
448442
background: var(--button-secondary-background-fill);
449443
cursor: pointer;
450444
}
445+
.stop-button:active,
446+
.submit-button:active {
447+
box-shadow: var(--button-shadow-active);
448+
}
451449
.submit-button :global(svg) {
452450
height: 22px;
453451
width: 22px;

0 commit comments

Comments
 (0)