From f24bec9cd590115e3645c080d9714b887962461b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillem=20C=C3=B3rdoba?= Date: Fri, 2 Jun 2023 18:14:47 +0200 Subject: [PATCH] Css fixes --- ui/demo/index.html | 2 +- ui/package.json | 4 ++-- ui/src/elements/upload-files.ts | 13 +++++++------ 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/ui/demo/index.html b/ui/demo/index.html index 0afb45a0..d1362813 100644 --- a/ui/demo/index.html +++ b/ui/demo/index.html @@ -64,7 +64,7 @@ .oneFile=${true} required name="file_hash" - style="flex: 1" + style="max-width: 20px; max-height:20px" @file-uploaded=${(e) => { this.hash = e.detail.file.hash; }} diff --git a/ui/package.json b/ui/package.json index 3a3bf269..37e9c5b9 100644 --- a/ui/package.json +++ b/ui/package.json @@ -1,6 +1,6 @@ { "name": "@holochain-open-dev/file-storage", - "version": "0.4.2", + "version": "0.4.3", "description": "File storage utilities to store and retrieve files in a holochain DHT", "author": "guillem.cordoba@gmail.com", "license": "MIT", @@ -25,7 +25,7 @@ "@lit-labs/context": "^0.2.0", "@lit-labs/task": "^2.0.0", "@lit/localize": "^0.11.4", - "@scoped-elements/dropzone": "^0.2.0", + "@scoped-elements/dropzone": "^0.2.1", "@shoelace-style/shoelace": "^2.3.0", "lit": "^2.6.0" }, diff --git a/ui/src/elements/upload-files.ts b/ui/src/elements/upload-files.ts index c5108c8b..583eacc3 100644 --- a/ui/src/elements/upload-files.ts +++ b/ui/src/elements/upload-files.ts @@ -75,7 +75,13 @@ export class UploadFiles extends DropzoneElement implements FormField { async firstUpdated() { super.firstUpdated(); - if (this.defaultValue !== undefined) { + + this.reset(); + } + + async reset() { + this.clear(); + if (this.defaultValue) { if (Array.isArray(this.defaultValue)) { for (const fileHash of this.defaultValue) { const image = await this._client.downloadFile(fileHash); @@ -88,11 +94,6 @@ export class UploadFiles extends DropzoneElement implements FormField { } } - reset() { - this.dropzone.removeAllFiles(true); - this.clear(); - } - /** * @internal */