diff --git a/package-lock.json b/package-lock.json index 89709625..fa8ceb84 100644 --- a/package-lock.json +++ b/package-lock.json @@ -236,6 +236,11 @@ "@xtuc/long": "4.2.1" } }, + "@webcomponents/custom-elements": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@webcomponents/custom-elements/-/custom-elements-1.2.1.tgz", + "integrity": "sha512-flmTp4rVbBkcUIF3eBO3LNoAaYvleTdhPZKzdzr6iztWLLrxCctcK+7MAQeC3/SPjc3JDdC3jYLMRF4R6C3f9g==" + }, "@xtuc/ieee754": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", @@ -4528,6 +4533,11 @@ "remedial": ">= 1.0.7" } }, + "file-drop-element": { + "version": "0.0.9", + "resolved": "https://registry.npmjs.org/file-drop-element/-/file-drop-element-0.0.9.tgz", + "integrity": "sha512-LfcczsUadIDGh9uyVLF3fjHr1bT/E7NzyD/9m+/ANJTiys8k0IhLkb7ZWdFWNZPlvF8sdTuvnqZWYDPlmqj+rw==" + }, "file-entry-cache": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-2.0.0.tgz", diff --git a/package.json b/package.json index e1482576..1ca58556 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ }, "dependencies": { "@gamestdio/websocket": "^0.2.8", + "@webcomponents/custom-elements": "^1.2.1", "browserslist": "^4.3.5", "cheerio": "^1.0.0-rc.2", "child-process-promise": "^2.2.1", @@ -56,6 +57,7 @@ "events-light": "^1.0.5", "express": "^4.16.4", "file-api": "^0.10.4", + "file-drop-element": "0.0.9", "font-awesome-svg-png": "^1.2.2", "form-data": "^2.3.3", "glob": "^7.1.3", diff --git a/scss/themes/_base.scss b/scss/themes/_base.scss index 997c75a9..e5e5102c 100644 --- a/scss/themes/_base.scss +++ b/scss/themes/_base.scss @@ -93,4 +93,6 @@ --compose-autosuggest-outline: #{lighten($focus-outline, 5%)}; --compose-button-halo: #{rgba(255, 255, 255, 0.1)}; + + --file-drop-mask: #{rgba(255, 255, 255, 0.8)}; } diff --git a/scss/themes/_dark.scss b/scss/themes/_dark.scss index b4068d5a..ad554cf5 100644 --- a/scss/themes/_dark.scss +++ b/scss/themes/_dark.scss @@ -29,4 +29,6 @@ --compose-autosuggest-item-hover: #{lighten($main-bg-color, 10%)}; --compose-autosuggest-item-active: #{lighten($main-bg-color, 15%)}; --compose-autosuggest-outline: #{lighten($border-color, 20%)}; + + --file-drop-mask: #{rgba(30, 30, 30, 0.8)}; } diff --git a/src/routes/_actions/media.js b/src/routes/_actions/media.js index 3f31b481..d9d733fa 100644 --- a/src/routes/_actions/media.js +++ b/src/routes/_actions/media.js @@ -9,6 +9,9 @@ export async function doMediaUpload (realm, file) { try { let response = await uploadMedia(currentInstance, accessToken, file) let composeMedia = store.getComposeData(realm, 'media') || [] + if (composeMedia.length === 4) { + throw new Error('Only 4 media max are allowed') + } composeMedia.push({ data: response, file: { name: file.name }, diff --git a/src/routes/_components/compose/ComposeBox.html b/src/routes/_components/compose/ComposeBox.html index 94d861ac..99031035 100644 --- a/src/routes/_components/compose/ComposeBox.html +++ b/src/routes/_components/compose/ComposeBox.html @@ -1,20 +1,22 @@ {#if realm === 'home'}