From 98ba49362dc8c936125fc18dc1f986c2e5428cdb Mon Sep 17 00:00:00 2001 From: pk Date: Thu, 11 Jun 2026 10:55:53 +0200 Subject: [PATCH] Forward data to upload --- package.json | 2 +- tp-dropzone.js | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 388cb43..9e71112 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@tp/tp-dropzone", - "version": "2.0.0", + "version": "2.1.0", "description": "", "main": "tp-dropzone.js", "scripts": { diff --git a/tp-dropzone.js b/tp-dropzone.js index 33ec628..1c2523f 100644 --- a/tp-dropzone.js +++ b/tp-dropzone.js @@ -82,16 +82,15 @@ class TpDropzone extends upload(dropzoneMixin(LitElement)) { } } - async upload() { + async upload(data = null) { if (this.file) { - const params = { url: this.url, data: null }; document.dispatchEvent(new CustomEvent('before-upload', { - detail: params, + detail: { url: this.url, data }, bubbles: true, composed: true })); - await this.uploadFiles(params.url, [this.file], params.data); + await this.uploadFiles(this.url, [this.file], data); // Clear file after successful upload this.file = null;