More send media optimization
This commit is contained in:
parent
7b4b35762a
commit
9b0a6ae225
5 changed files with 54 additions and 55 deletions
|
|
@ -22,14 +22,12 @@
|
|||
@dragleave.prevent="dropTarget = false"
|
||||
@dragenter.prevent="dropTarget = true"
|
||||
>
|
||||
<div v-if="currentAttachment && currentAttachment.status === 'loading'" class="filename">
|
||||
<div>{{ currentAttachment.file.name }}</div>
|
||||
<ThumbnailView :file="currentAttachment" />
|
||||
<div v-if="currentAttachment && currentAttachment.status === 'loading'" class="send-attachments__selecting__current-item__preparing">
|
||||
<div style="font-size: 0.7em; opacity: 0.7">
|
||||
{{ $t("message.preparing_to_upload") }}
|
||||
<v-progress-linear indeterminate class="mb-0"></v-progress-linear>
|
||||
<v-progress-circular indeterminate class="mb-0"></v-progress-circular>
|
||||
</div>
|
||||
</div>
|
||||
<ThumbnailView v-else :file="currentAttachment" />
|
||||
</div>
|
||||
<div class="file-drop-thumbnail-container">
|
||||
<v-tooltip location="top" v-for="(attachment, index) in batch.attachments" :key="index">
|
||||
|
|
@ -94,6 +92,7 @@
|
|||
elevation="0"
|
||||
color="black"
|
||||
@click.stop="showInformation"
|
||||
:disabled="currentAttachment?.status !== 'loaded'"
|
||||
></v-btn>
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -253,7 +252,7 @@ export default defineComponent({
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
currentItemIndex: 0,
|
||||
currentItemIndex: -1,
|
||||
messageInput: "",
|
||||
mainStatuses: Object.freeze({
|
||||
SELECTING: 0,
|
||||
|
|
@ -276,6 +275,9 @@ export default defineComponent({
|
|||
return !this.batch.canSend;
|
||||
},
|
||||
currentAttachment(): Attachment | undefined {
|
||||
if (this.currentItemIndex < 0 && this.batch.attachments.length > 0) {
|
||||
this.currentItemIndex = this.batch.attachments.length - 1;
|
||||
}
|
||||
if (this.currentItemIndex >= 0 && this.currentItemIndex < this.batch.attachments.length) {
|
||||
return this.batch.attachments[this.currentItemIndex];
|
||||
}
|
||||
|
|
@ -305,16 +307,18 @@ export default defineComponent({
|
|||
this.dropTarget = false;
|
||||
let droppedFiles: FileList | undefined = e.dataTransfer?.files;
|
||||
if (!droppedFiles) return;
|
||||
let files: File[] = [];
|
||||
for (let i = 0; i < droppedFiles.length; i++) {
|
||||
const file = droppedFiles.item(i);
|
||||
this.batch.addAttachment(this.$matrix.attachmentManager.createAttachment(file));
|
||||
if (file) files.push(file);
|
||||
}
|
||||
this.batch.addAttachments(files.map((f) => this.$matrix.attachmentManager.createAttachment(f)));
|
||||
},
|
||||
close() {
|
||||
this.batch.cancel();
|
||||
this.status = this.mainStatuses.SELECTING;
|
||||
this.messageInput = "";
|
||||
this.currentItemIndex = 0;
|
||||
this.currentItemIndex = -1;
|
||||
this.$emit("close");
|
||||
},
|
||||
sendAll() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue