2021-01-13 12:36:25 +00:00
|
|
|
<template>
|
|
|
|
<div class="bottom-box" :class="wrapClass">
|
|
|
|
<div class="left-wrap">
|
2021-01-18 05:50:19 +00:00
|
|
|
<button
|
|
|
|
class="button clear button--emoji"
|
|
|
|
:title="$t('CONVERSATION.REPLYBOX.TIP_EMOJI_ICON')"
|
|
|
|
@click="toggleEmojiPicker"
|
|
|
|
>
|
2021-01-13 12:36:25 +00:00
|
|
|
<emoji-or-icon icon="ion-happy-outline" emoji="😊" />
|
|
|
|
</button>
|
|
|
|
<button
|
|
|
|
v-if="showAttachButton"
|
|
|
|
class="button clear button--emoji button--upload"
|
2021-01-18 05:50:19 +00:00
|
|
|
:title="$t('CONVERSATION.REPLYBOX.TIP_ATTACH_ICON')"
|
2021-01-13 12:36:25 +00:00
|
|
|
>
|
|
|
|
<file-upload
|
|
|
|
:size="4096 * 4096"
|
|
|
|
accept="image/*, application/pdf, audio/mpeg, video/mp4, audio/ogg, text/csv"
|
|
|
|
@input-file="onFileUpload"
|
|
|
|
>
|
|
|
|
<emoji-or-icon icon="ion-android-attach" emoji="📎" />
|
|
|
|
</file-upload>
|
|
|
|
</button>
|
2021-01-18 05:50:19 +00:00
|
|
|
<button
|
|
|
|
v-if="enableRichEditor"
|
|
|
|
class="button clear button--emoji"
|
|
|
|
:title="$t('CONVERSATION.REPLYBOX.TIP_FORMAT_ICON')"
|
|
|
|
@click="toggleFormatMode"
|
|
|
|
>
|
|
|
|
<emoji-or-icon icon="ion-quote" emoji="🖊️" />
|
|
|
|
</button>
|
2021-01-13 12:36:25 +00:00
|
|
|
</div>
|
|
|
|
<div class="right-wrap">
|
2021-01-19 13:58:40 +00:00
|
|
|
<div v-if="isFormatMode" class="enter-to-send--checkbox">
|
|
|
|
<input
|
|
|
|
:checked="enterToSendEnabled"
|
|
|
|
type="checkbox"
|
|
|
|
value="enterToSend"
|
|
|
|
@input="toggleEnterToSend"
|
|
|
|
/>
|
|
|
|
<label for="enterToSend">
|
|
|
|
{{ $t('CONVERSATION.REPLYBOX.ENTER_TO_SEND') }}
|
|
|
|
</label>
|
|
|
|
</div>
|
2021-01-13 12:36:25 +00:00
|
|
|
<button
|
|
|
|
class="button nice primary button--send"
|
|
|
|
:class="buttonClass"
|
|
|
|
@click="onSend"
|
|
|
|
>
|
|
|
|
{{ sendButtonText }}
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import FileUpload from 'vue-upload-component';
|
|
|
|
import EmojiOrIcon from 'shared/components/EmojiOrIcon';
|
|
|
|
|
|
|
|
import { REPLY_EDITOR_MODES } from './constants';
|
|
|
|
export default {
|
|
|
|
name: 'ReplyTopPanel',
|
|
|
|
components: { EmojiOrIcon, FileUpload },
|
|
|
|
props: {
|
|
|
|
mode: {
|
|
|
|
type: String,
|
|
|
|
default: REPLY_EDITOR_MODES.REPLY,
|
|
|
|
},
|
|
|
|
onSend: {
|
|
|
|
type: Function,
|
|
|
|
default: () => {},
|
|
|
|
},
|
|
|
|
sendButtonText: {
|
|
|
|
type: String,
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
showFileUpload: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
onFileUpload: {
|
|
|
|
type: Function,
|
|
|
|
default: () => {},
|
|
|
|
},
|
|
|
|
showEmojiPicker: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
toggleEmojiPicker: {
|
|
|
|
type: Function,
|
|
|
|
default: () => {},
|
|
|
|
},
|
|
|
|
isSendDisabled: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
},
|
2021-01-18 05:50:19 +00:00
|
|
|
setFormatMode: {
|
|
|
|
type: Function,
|
|
|
|
default: () => {},
|
|
|
|
},
|
|
|
|
isFormatMode: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
enableRichEditor: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
},
|
2021-01-19 13:58:40 +00:00
|
|
|
enterToSendEnabled: {
|
|
|
|
type: Boolean,
|
|
|
|
default: true,
|
|
|
|
},
|
2021-01-13 12:36:25 +00:00
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
isNote() {
|
|
|
|
return this.mode === REPLY_EDITOR_MODES.NOTE;
|
|
|
|
},
|
|
|
|
wrapClass() {
|
|
|
|
return {
|
|
|
|
'is-note-mode': this.isNote,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
buttonClass() {
|
|
|
|
return {
|
|
|
|
'button--note': this.isNote,
|
|
|
|
'button--disabled': this.isSendDisabled,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
showAttachButton() {
|
|
|
|
return this.showFileUpload || this.isNote;
|
|
|
|
},
|
|
|
|
},
|
2021-01-18 05:50:19 +00:00
|
|
|
methods: {
|
|
|
|
toggleFormatMode() {
|
|
|
|
this.setFormatMode(!this.isFormatMode);
|
|
|
|
},
|
2021-01-19 13:58:40 +00:00
|
|
|
toggleEnterToSend() {
|
|
|
|
this.$emit('toggleEnterToSend', !this.enterToSendEnabled);
|
|
|
|
},
|
2021-01-18 05:50:19 +00:00
|
|
|
},
|
2021-01-13 12:36:25 +00:00
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
@import '~widget/assets/scss/variables.scss';
|
|
|
|
@import '~widget/assets/scss/mixins.scss';
|
|
|
|
|
|
|
|
.bottom-box {
|
|
|
|
display: flex;
|
|
|
|
justify-content: space-between;
|
|
|
|
padding: var(--space-slab) var(--space-normal);
|
|
|
|
|
|
|
|
&.is-note-mode {
|
|
|
|
background: var(--y-50);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.button {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
|
|
&.is-active {
|
|
|
|
background: white;
|
|
|
|
}
|
|
|
|
|
|
|
|
&.button--note {
|
|
|
|
background: var(--y-800);
|
|
|
|
color: white;
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
background: var(--y-700);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
&.button--disabled {
|
|
|
|
background: var(--b-100);
|
|
|
|
color: var(--b-400);
|
|
|
|
cursor: default;
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
background: var(--b-100);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.bottom-box.is-note-mode {
|
|
|
|
.button--emoji {
|
|
|
|
background: white;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.left-wrap {
|
|
|
|
align-items: center;
|
2021-01-19 13:58:40 +00:00
|
|
|
display: flex;
|
2021-01-13 12:36:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.button--reply {
|
|
|
|
border-right: 1px solid var(--color-border-light);
|
|
|
|
}
|
|
|
|
|
|
|
|
.icon--font {
|
|
|
|
color: var(--s-600);
|
|
|
|
font-size: var(--font-size-default);
|
|
|
|
}
|
2021-01-19 13:58:40 +00:00
|
|
|
|
|
|
|
.right-wrap {
|
|
|
|
display: flex;
|
|
|
|
|
|
|
|
.enter-to-send--checkbox {
|
|
|
|
align-items: center;
|
|
|
|
display: flex;
|
|
|
|
|
|
|
|
input {
|
|
|
|
margin: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
label {
|
|
|
|
color: var(--s-500);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-01-13 12:36:25 +00:00
|
|
|
</style>
|