Fixed upload dialog being showed after pressing "x" button (#2577)

* Fixed upload dialog being showed on clear #2476

* Changelog update

* Formatting fix

* click replaced with disable_click

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
Co-authored-by: Dawood Khan <dawoodkhan82@gmail.com>
This commit is contained in:
Vladimir Repin 2022-11-03 02:28:38 +03:00 committed by GitHub
parent a6e72f7814
commit ad62a8a8a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 5 deletions

View File

@ -1137,6 +1137,7 @@ We've introduced a lot of new components in `3.0`, including `Model3D`, `Dataset
* Mobile responsive guides by [@aliabd](https://github.com/aliabd) in [PR 1293](https://github.com/gradio-app/gradio/pull/1293)
* Update readme by [@abidlabs](https://github.com/abidlabs) in [PR 1292](https://github.com/gradio-app/gradio/pull/1292)
* gif by [@abidlabs](https://github.com/abidlabs) in [PR 1296](https://github.com/gradio-app/gradio/pull/1296)
* Fixed issue #2476 with upload dialog [@mezotaken](https://github.com/mezotaken) in [PR 2577](https://github.com/gradio-app/gradio/pull/2577)
## Contributors Shoutout:

View File

@ -8,5 +8,11 @@
<div class="z-50 top-2 right-2 justify-end flex gap-1 absolute">
<IconButton Icon={Undo} on:click={() => dispatch("undo")} />
<IconButton Icon={Clear} on:click={() => dispatch("clear")} />
<IconButton
Icon={Clear}
on:click={(event) => {
dispatch("clear");
event.stopPropagation();
}}
/>
</div>

View File

@ -510,7 +510,7 @@
flex={false}
center={false}
boundedheight={false}
click={false}
disable_click={true}
on:load={(e) => blob_to_string(data_uri_to_blob(e.detail.data))}
bind:dragging
>

View File

@ -21,5 +21,11 @@
<IconButton Icon={Edit} on:click={() => dispatch("edit")} />
{/if}
<IconButton Icon={Clear} on:click={() => dispatch("clear")} />
<IconButton
Icon={Clear}
on:click={(event) => {
dispatch("clear");
event.stopPropagation();
}}
/>
</div>

View File

@ -6,7 +6,6 @@
export let include_file_metadata = true;
export let dragging = false;
export let boundedheight: boolean = true;
export let click: boolean = true;
export let center: boolean = true;
export let flex: boolean = true;
export let file_count: string = "single";
@ -21,8 +20,8 @@
};
const openFileUpload = () => {
if (!click) return;
if (disable_click) return;
hidden_upload.value = "";
hidden_upload.click();
};