From 804997756321abcd0140760517bd45a07e8c8bf0 Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Tue, 19 Feb 2019 22:24:03 -0800 Subject: [PATCH] =?UTF-8?q?chore:=20Update=20file-drop-element=20to=20the?= =?UTF-8?q?=20latest=20version=20=F0=9F=9A=80=20(#1017)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(package): update file-drop-element to version 0.2.0 * chore(package): update lockfile yarn.lock * fix: update for file drop 0.2.0 --- package.json | 2 +- src/routes/_components/compose/ComposeFileDrop.html | 8 +++++--- src/routes/_components/compose/ComposeToolbar.html | 6 ------ tests/utils.js | 7 ++++--- yarn.lock | 8 ++++---- 5 files changed, 14 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index ee504c10..53f3f606 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,7 @@ "events-light": "^1.0.5", "express": "^4.16.4", "file-api": "^0.10.4", - "file-drop-element": "0.0.9", + "file-drop-element": "0.2.0", "form-data": "^2.3.3", "glob": "^7.1.3", "helmet": "^3.15.1", diff --git a/src/routes/_components/compose/ComposeFileDrop.html b/src/routes/_components/compose/ComposeFileDrop.html index 18eb93dc..9cb5cb31 100644 --- a/src/routes/_components/compose/ComposeFileDrop.html +++ b/src/routes/_components/compose/ComposeFileDrop.html @@ -73,10 +73,12 @@ mediaAccept }), methods: { - onFileDrop (e) { - let { file } = e + async onFileDrop (e) { + let { files } = e let { realm } = this.get() - /* no await */ doMediaUpload(realm, file) + for (let file of files) { // upload one at a time to avoid hitting limits + await doMediaUpload(realm, file) + } } } } diff --git a/src/routes/_components/compose/ComposeToolbar.html b/src/routes/_components/compose/ComposeToolbar.html index 20b84460..86fe8b31 100644 --- a/src/routes/_components/compose/ComposeToolbar.html +++ b/src/routes/_components/compose/ComposeToolbar.html @@ -53,12 +53,6 @@ import { mediaAccept } from '../../_static/media' export default { - oncreate () { - window.__composeToolbar = this // for testing - }, - ondestroy () { - window.__composeToolbar = null - }, components: { IconButton, ComposeAutosuggest diff --git a/tests/utils.js b/tests/utils.js index 4194bc7f..161df581 100644 --- a/tests/utils.js +++ b/tests/utils.js @@ -131,9 +131,10 @@ export const uploadKittenImage = i => (exec(() => { let image = images[`kitten${i}`] let blob = blobUtils.base64StringToBlob(image.data, 'image/png') blob.name = image.name - window.__composeToolbar.onFileChange({ - target: { files: [blob] } - }) + let fileDrop = document.querySelector('file-drop') + let event = new Event('filedrop', { bubbles: false }) + event.files = [blob] + fileDrop.dispatchEvent(event) }, { dependencies: { images, diff --git a/yarn.lock b/yarn.lock index 3908fea5..b91e99ec 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3120,10 +3120,10 @@ file-api@^0.10.4: mime ">= 1.2.11" remedial ">= 1.0.7" -file-drop-element@0.0.9: - version "0.0.9" - resolved "https://registry.yarnpkg.com/file-drop-element/-/file-drop-element-0.0.9.tgz#d05fb6d3ab5d8e58e1978256057d14a3bdfa0746" - integrity sha512-LfcczsUadIDGh9uyVLF3fjHr1bT/E7NzyD/9m+/ANJTiys8k0IhLkb7ZWdFWNZPlvF8sdTuvnqZWYDPlmqj+rw== +file-drop-element@0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/file-drop-element/-/file-drop-element-0.2.0.tgz#c9214515b9d6b11f32c7fcee299f3a671939409e" + integrity sha512-BGDdaJ4U2Cz0qhv6YGLnuhVtKcN8fp7F/4dS7lGSL1Fbe8m4cbGk+8awwHW0xcFqutMojxGchMVuWYQpEpP/Qg== file-entry-cache@^2.0.0: version "2.0.0"