From 0760bbaf0f58e79a4826d4b1f29f4520b02dc143 Mon Sep 17 00:00:00 2001 From: morethanwords Date: Fri, 16 Oct 2020 15:35:44 +0300 Subject: [PATCH] Fix upload more than 10 media --- src/components/popupNewMedia.ts | 4 ++++ src/components/wrappers.ts | 2 +- src/scss/partials/_document.scss | 14 +++++--------- src/scss/partials/popups/_mediaAttacher.scss | 4 ---- 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/components/popupNewMedia.ts b/src/components/popupNewMedia.ts index df30199d..c605cdd3 100644 --- a/src/components/popupNewMedia.ts +++ b/src/components/popupNewMedia.ts @@ -210,6 +210,10 @@ export default class PopupNewMedia extends PopupElement { const container = this.container; const willAttach = this.willAttach; + if(files.length > 10 && willAttach.type == 'media') { + willAttach.type = 'document'; + } + files = files.filter(file => { if(willAttach.type == 'media') { return ['image/', 'video/'].find(s => file.type.indexOf(s) === 0); diff --git a/src/components/wrappers.ts b/src/components/wrappers.ts index 99464194..e1d0391f 100644 --- a/src/components/wrappers.ts +++ b/src/components/wrappers.ts @@ -318,7 +318,7 @@ export function wrapDocument(doc: MyDocument, withTime = false, uploading = fals icoDiv.classList.add('document-ico'); if(doc.thumbs?.length || (uploading && doc.url)) { - docDiv.classList.add('photo'); + docDiv.classList.add('document-with-thumb'); if(uploading) { icoDiv.innerHTML = ``; diff --git a/src/scss/partials/_document.scss b/src/scss/partials/_document.scss index 2cd47f30..84616090 100644 --- a/src/scss/partials/_document.scss +++ b/src/scss/partials/_document.scss @@ -6,7 +6,10 @@ background-color: $color-blue; border-radius: .5rem; line-height: 10px; - padding: 0 .25rem; + + .document:not(.document-with-thumb) & { + padding: 1.5rem .25rem 0 .25rem; + } &:after { content: ""; @@ -60,14 +63,7 @@ } } - &:not(.photo) { - .document-ico { - padding-top: 1.5rem; - //background-image: url('../assets/img/doc-in.svg'); - } - } - - &.photo { + &.document-with-thumb { .document-ico { background: #000; border-radius: $border-radius; diff --git a/src/scss/partials/popups/_mediaAttacher.scss b/src/scss/partials/popups/_mediaAttacher.scss index 8cce0e16..6ad1db54 100644 --- a/src/scss/partials/popups/_mediaAttacher.scss +++ b/src/scss/partials/popups/_mediaAttacher.scss @@ -34,11 +34,7 @@ > div { position: absolute; } - } - } - &.is-document, &.is-album { - #{$parent}-photo { img, video { object-fit: cover; width: 100%;