feat: Add drag and drop for images/files in the agent input box (#2546)

This commit is contained in:
Sivin Varghese 2021-06-30 20:32:17 +05:30 committed by GitHub
parent dd9d5e410c
commit e6e9916fdb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 1 deletions

View file

@ -12,8 +12,11 @@
/> />
<file-upload <file-upload
ref="upload"
:size="4096 * 4096" :size="4096 * 4096"
accept="image/*, application/pdf, audio/mpeg, video/mp4, audio/ogg, text/csv" accept="image/*, application/pdf, audio/mpeg, video/mp4, audio/ogg, text/csv"
:drop="true"
:drop-directory="false"
@input-file="onFileUpload" @input-file="onFileUpload"
> >
<woot-button <woot-button
@ -37,6 +40,17 @@
:title="$t('CONVERSATION.REPLYBOX.TIP_FORMAT_ICON')" :title="$t('CONVERSATION.REPLYBOX.TIP_FORMAT_ICON')"
@click="toggleFormatMode" @click="toggleFormatMode"
/> />
<transition name="modal-fade">
<div
v-show="$refs.upload && $refs.upload.dropActive"
class="modal-mask"
>
<i class="ion-ios-cloud-upload-outline icon"></i>
<h4 class="page-sub-title">
{{ $t('CONVERSATION.REPLYBOX.DRAG_DROP') }}
</h4>
</div>
</transition>
</div> </div>
<div class="right-wrap"> <div class="right-wrap">
<div v-if="isFormatMode" class="enter-to-send--checkbox"> <div v-if="isFormatMode" class="enter-to-send--checkbox">
@ -198,4 +212,18 @@ export default {
background: var(--s-100); background: var(--s-100);
} }
} }
.modal-mask {
color: var(--s-600);
background: var(--white-transparent);
flex-direction: column;
}
.page-sub-title {
color: var(--s-600);
}
.icon {
font-size: 8rem;
}
</style> </style>

View file

@ -56,7 +56,8 @@
"TIP_FORMAT_ICON": "Show rich text editor", "TIP_FORMAT_ICON": "Show rich text editor",
"TIP_EMOJI_ICON": "Show emoji selector", "TIP_EMOJI_ICON": "Show emoji selector",
"TIP_ATTACH_ICON": "Attach files", "TIP_ATTACH_ICON": "Attach files",
"ENTER_TO_SEND": "Enter to send" "ENTER_TO_SEND": "Enter to send",
"DRAG_DROP": "Drag and drop here to attach"
}, },
"VISIBLE_TO_AGENTS": "Private Note: Only visible to you and your team", "VISIBLE_TO_AGENTS": "Private Note: Only visible to you and your team",
"CHANGE_STATUS": "Conversation status changed", "CHANGE_STATUS": "Conversation status changed",

View file

@ -1,5 +1,6 @@
:root { :root {
--white: #fff; --white: #fff;
--white-transparent: rgba(255, 255, 255, 0.9);
--w-50: #E3F2FF; --w-50: #E3F2FF;
--w-100: #BBDDFF; --w-100: #BBDDFF;