mirror of
https://github.com/gradio-app/gradio.git
synced 2025-02-23 11:39:17 +08:00
Reset textbox value to empty string when value is None (#5114)
* reset value to empty string when null * add changeset --------- Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
This commit is contained in:
parent
61129052ed
commit
56d2609de9
6
.changeset/good-years-ask.md
Normal file
6
.changeset/good-years-ask.md
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
"@gradio/textbox": patch
|
||||
"gradio": patch
|
||||
---
|
||||
|
||||
fix:Reset textbox value to empty string when value is None
|
@ -28,6 +28,8 @@
|
||||
|
||||
$: value, el && lines !== max_lines && resize({ target: el });
|
||||
|
||||
$: if (value === null) value = "";
|
||||
|
||||
const dispatch = createEventDispatcher<{
|
||||
change: string;
|
||||
submit: undefined;
|
||||
@ -70,7 +72,7 @@
|
||||
const text = target.value;
|
||||
const index: [number, number] = [
|
||||
target.selectionStart as number,
|
||||
target.selectionEnd as number
|
||||
target.selectionEnd as number,
|
||||
];
|
||||
dispatch("select", { value: text.substring(...index), index: index });
|
||||
}
|
||||
@ -132,7 +134,7 @@
|
||||
resize({ target: _el });
|
||||
|
||||
return {
|
||||
destroy: () => _el.removeEventListener("input", resize)
|
||||
destroy: () => _el.removeEventListener("input", resize),
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user