Forward data to upload

This commit is contained in:
2026-06-11 10:55:53 +02:00
parent fc32b90ab1
commit 98ba49362d
2 changed files with 4 additions and 5 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@tp/tp-dropzone", "name": "@tp/tp-dropzone",
"version": "2.0.0", "version": "2.1.0",
"description": "", "description": "",
"main": "tp-dropzone.js", "main": "tp-dropzone.js",
"scripts": { "scripts": {
+3 -4
View File
@@ -82,16 +82,15 @@ class TpDropzone extends upload(dropzoneMixin(LitElement)) {
} }
} }
async upload() { async upload(data = null) {
if (this.file) { if (this.file) {
const params = { url: this.url, data: null };
document.dispatchEvent(new CustomEvent('before-upload', { document.dispatchEvent(new CustomEvent('before-upload', {
detail: params, detail: { url: this.url, data },
bubbles: true, bubbles: true,
composed: 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 // Clear file after successful upload
this.file = null; this.file = null;