vue-intergrall-plugins 0.0.280 → 0.0.281
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +185 -185
- package/dist/vue-intergrall-plugins.esm.js +84 -58
- package/dist/vue-intergrall-plugins.min.js +1 -1
- package/dist/vue-intergrall-plugins.ssr.js +124 -124
- package/package.json +66 -66
- package/src/lib-components/Buttons/IconButton.vue +27 -27
- package/src/lib-components/Buttons/SimpleButton.vue +140 -140
- package/src/lib-components/Cards/Card.vue +412 -412
- package/src/lib-components/Cards/CardCheck.vue +35 -35
- package/src/lib-components/Cards/CardFile.vue +157 -157
- package/src/lib-components/Chat/BtnDownloadAllFiles.vue +32 -32
- package/src/lib-components/Chat/BtnEmojis.vue +124 -124
- package/src/lib-components/Chat/BtnExpand.vue +17 -17
- package/src/lib-components/Chat/BtnFiles.vue +415 -415
- package/src/lib-components/Chat/BtnMic.vue +60 -60
- package/src/lib-components/Chat/BtnScreenShare.vue +32 -32
- package/src/lib-components/Chat/BtnStandardMessages.vue +17 -17
- package/src/lib-components/Chat/ExpandTextarea.vue +410 -410
- package/src/lib-components/Chat/MultipleFilePreview.vue +266 -266
- package/src/lib-components/Chat/Picker.vue +368 -368
- package/src/lib-components/Chat/RemainingCharacters.vue +28 -28
- package/src/lib-components/Chat/SingleFilePreview.vue +94 -94
- package/src/lib-components/Chat/SkeletonPicker.vue +110 -110
- package/src/lib-components/Chat/StandardMessages.vue +245 -245
- package/src/lib-components/Chat/TextFooter.vue +817 -817
- package/src/lib-components/Email/EmailFile.vue +125 -125
- package/src/lib-components/Email/EmailItem.vue +185 -185
- package/src/lib-components/Loader/Loader.vue +78 -78
- package/src/lib-components/Messages/AnexoMensagem.vue +384 -384
- package/src/lib-components/Messages/CardAttachment.vue +61 -61
- package/src/lib-components/Messages/CardMessages.vue +452 -393
- package/src/lib-components/Messages/ChatMessages.vue +573 -573
- package/src/lib-components/Messages/InteratividadeBotoes.vue +165 -165
- package/src/lib-components/Messages/InteratividadeFormulario.vue +392 -392
- package/src/lib-components/Messages/InteratividadePopup.vue +88 -88
- package/src/lib-components/Messages/LinkPreview.vue +163 -163
- package/src/lib-components/Scroll/ScrollContent.vue +150 -150
- package/src/lib-components/Templates/TemplateGenerator.vue +576 -576
- package/src/lib-components/Templates/TemplateMessage.vue +83 -83
- package/src/lib-components/Templates/TemplateSingle.vue +481 -481
|
@@ -1,817 +1,817 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="text-footer-container" :class="{'bigger' : cssStyle.height}" v-on-clickaway="away" v-if="textId" @drop.stop="dropFile" @dragenter.prevent @dragover.prevent>
|
|
3
|
-
<div class="text-footer" :class="cssStyle.width ? cssStyle.width: ''" :style="`background-color: ${cssStyle.backgroundColor}`">
|
|
4
|
-
<BtnEmojis
|
|
5
|
-
v-show="buttons.hasEmojis && !audioFile"
|
|
6
|
-
:ref="`${this.textId}`"
|
|
7
|
-
:emojiId="`${this.textId}`"
|
|
8
|
-
:down="emojiSettings.openEmojisFrom == 'top' ? false : true"
|
|
9
|
-
:small="emojiSettings.smallEmojis"
|
|
10
|
-
:biggerTextarea="cssStyle.height ? true : false"
|
|
11
|
-
@insert-emoji="insertEmoji"
|
|
12
|
-
/>
|
|
13
|
-
<transition name="fade">
|
|
14
|
-
<Loader v-if="isSending" />
|
|
15
|
-
</transition>
|
|
16
|
-
<textarea
|
|
17
|
-
class="js-autoresize"
|
|
18
|
-
v-if="!audioFile"
|
|
19
|
-
v-model="message"
|
|
20
|
-
:id="`text-footer-${this.textId}`"
|
|
21
|
-
:disabled="textareaSettings.disabled"
|
|
22
|
-
:placeholder="textareaSettings.placeholderMessage"
|
|
23
|
-
@input="sendFinalMessage"
|
|
24
|
-
@keydown.up="toggleStandardMessages"
|
|
25
|
-
@keydown.down="toggleStandardMessages"
|
|
26
|
-
@keydown.esc="closeEmojis"
|
|
27
|
-
@keydown.enter="sendMessageHandler"
|
|
28
|
-
@paste="pasteImage"
|
|
29
|
-
></textarea>
|
|
30
|
-
<div class="text-footer-audio" v-else>
|
|
31
|
-
<audio :src="audioSource" controls="controls"></audio>
|
|
32
|
-
<span class="delete-audio" title="Cancelar" @click="deleteAudio">
|
|
33
|
-
<fa-icon :icon="['fas', 'times']" />
|
|
34
|
-
</span>
|
|
35
|
-
</div>
|
|
36
|
-
<RemainingCharacters
|
|
37
|
-
:class="{'d-none' : audioFile}"
|
|
38
|
-
:message="message"
|
|
39
|
-
:maxCharacters="textareaSettings.maxCharacters"
|
|
40
|
-
/>
|
|
41
|
-
<div v-if="buttons.hasFiles || buttons.hasAudio || buttons.hasExpand || formattedMessageSettings.hasStandardMessages || buttons.hasScreenShare || buttons.hasDownloadAll" class="text-footer-actions" :class="{'outside-buttons' : cssStyle.outsideButtons && !audioFile}">
|
|
42
|
-
<BtnDownloadAllFiles
|
|
43
|
-
v-show="buttons.hasDownloadAll && !audioFile"
|
|
44
|
-
@click-trigger="$emit('handle-download-files')"
|
|
45
|
-
:dictionary="dictionary"
|
|
46
|
-
:ref="`${textId}-download-files`"
|
|
47
|
-
/>
|
|
48
|
-
<BtnScreenShare
|
|
49
|
-
v-show="buttons.hasScreenShare && !audioFile"
|
|
50
|
-
@handle-screen-share="handleScreenShare"
|
|
51
|
-
:dictionary="dictionary"
|
|
52
|
-
:ref="`${textId}-screen-share`"
|
|
53
|
-
/>
|
|
54
|
-
<BtnMic
|
|
55
|
-
v-show="buttons.hasAudio && !audioFile"
|
|
56
|
-
:dictionary="dictionary"
|
|
57
|
-
@set-audio="setAudio"
|
|
58
|
-
:ref="`${textId}-mic`"
|
|
59
|
-
/>
|
|
60
|
-
<BtnStandardMessages
|
|
61
|
-
v-show="formattedMessageSettings.hasStandardMessages && !audioFile"
|
|
62
|
-
:dictionary="dictionary"
|
|
63
|
-
:ref="`${textId}-standard-messages`"
|
|
64
|
-
@toggle-standard-messages="toggleStandardMessages"
|
|
65
|
-
/>
|
|
66
|
-
<BtnFiles
|
|
67
|
-
v-show="buttons.hasFiles && !audioFile"
|
|
68
|
-
:textId="textId"
|
|
69
|
-
:dictionary="dictionary"
|
|
70
|
-
:fileSettings="fileSettings"
|
|
71
|
-
:cssStyle="cssStyle"
|
|
72
|
-
:ref="`${textId}-file`"
|
|
73
|
-
:hasButtonFiles="hasButtonFiles"
|
|
74
|
-
:externalFiles="externalFiles"
|
|
75
|
-
@set-file-vars="setFileVars"
|
|
76
|
-
@open-image="openImage"
|
|
77
|
-
@open-file-system="openFileSystem"
|
|
78
|
-
@reset-file-system="resetFileSystem"
|
|
79
|
-
@handle-file-preview="$emit('handle-file-preview')"
|
|
80
|
-
@handle-file-click="$emit('handle-file-click')"
|
|
81
|
-
/>
|
|
82
|
-
<BtnExpand
|
|
83
|
-
v-show="buttons.hasExpand && !audioFile"
|
|
84
|
-
:ref="`${textId}-expand`"
|
|
85
|
-
@expand-textarea="$emit('expand-textarea')"
|
|
86
|
-
:dictionary="dictionary"
|
|
87
|
-
/>
|
|
88
|
-
</div>
|
|
89
|
-
<div class="text-footer-actions" v-if="buttons.hasSendButton">
|
|
90
|
-
<span class="text-footer-actions--btn" :title="dictionary.title_enviar_msg" @click="sendMessageHandler">
|
|
91
|
-
<fa-icon :icon="['fas', 'paper-plane']" />
|
|
92
|
-
</span>
|
|
93
|
-
</div>
|
|
94
|
-
</div>
|
|
95
|
-
<transition name="fade">
|
|
96
|
-
<StandardMessages
|
|
97
|
-
v-if="showStandardMessages"
|
|
98
|
-
:class="cssStyle.width ? cssStyle.width: ''"
|
|
99
|
-
:dictionary="dictionary"
|
|
100
|
-
:backgroundColor="cssStyle.backgroundColor"
|
|
101
|
-
:token_cliente="formattedMessageSettings.token_cliente ? formattedMessageSettings.token_cliente : ''"
|
|
102
|
-
:message="message"
|
|
103
|
-
:messageType="messageType"
|
|
104
|
-
:hasStandardMessages="formattedMessageSettings.hasStandardMessages && showStandardMessages"
|
|
105
|
-
|
|
106
|
-
@close-standard-messages="closeStandardMessages"
|
|
107
|
-
@open-blocker-standard-message="openBlockerStandardMessage"
|
|
108
|
-
@close-blocker-standard-message="closeBlockerStandardMessage"
|
|
109
|
-
@set-message-type="setMessageType"
|
|
110
|
-
@set-standard-infos="setStandardInfos"
|
|
111
|
-
@add-standard-message="addStandardMessage"
|
|
112
|
-
@error-standard-message="$emit('error-standard-message')"
|
|
113
|
-
/>
|
|
114
|
-
</transition>
|
|
115
|
-
</div>
|
|
116
|
-
</template>
|
|
117
|
-
|
|
118
|
-
<script>
|
|
119
|
-
import { setResizeListeners, resetTargets } from "../../services/autoResize"
|
|
120
|
-
import { mixin as clickaway } from "vue-clickaway"
|
|
121
|
-
import { returnMessageWithHexa } from "../../services/textFormatting"
|
|
122
|
-
|
|
123
|
-
import BtnEmojis from "./BtnEmojis"
|
|
124
|
-
import Loader from "../Loader/Loader"
|
|
125
|
-
import RemainingCharacters from "./RemainingCharacters"
|
|
126
|
-
import BtnMic from "./BtnMic"
|
|
127
|
-
import BtnFiles from "./BtnFiles"
|
|
128
|
-
import BtnExpand from "./BtnExpand"
|
|
129
|
-
import BtnStandardMessages from "./BtnStandardMessages"
|
|
130
|
-
import StandardMessages from "./StandardMessages"
|
|
131
|
-
import BtnScreenShare from "./BtnScreenShare"
|
|
132
|
-
import BtnDownloadAllFiles from './BtnDownloadAllFiles'
|
|
133
|
-
|
|
134
|
-
export default {
|
|
135
|
-
components: { BtnEmojis, Loader, BtnMic, BtnFiles, BtnExpand, RemainingCharacters, BtnStandardMessages, StandardMessages, BtnScreenShare, BtnDownloadAllFiles },
|
|
136
|
-
mixins: [ clickaway ],
|
|
137
|
-
props: {
|
|
138
|
-
buttons: {
|
|
139
|
-
type: Object,
|
|
140
|
-
default: () => { return { hasEmojis: false, hasSendButton: false, hasFiles: false, hasAudio: false, hasExpand: false, hasScreenShare: false } },
|
|
141
|
-
required: false
|
|
142
|
-
},
|
|
143
|
-
cssStyle: {
|
|
144
|
-
type: Object,
|
|
145
|
-
default: () => { return { height: false, width: "full", backgroundColor: "#FFF", outsideButtons: false } },
|
|
146
|
-
required: false
|
|
147
|
-
},
|
|
148
|
-
textareaSettings: {
|
|
149
|
-
type: Object,
|
|
150
|
-
default: () => { return { placeholderMessage: "", maxCharacters: 0, sendOnEnter: false, disabled: false } },
|
|
151
|
-
required: false
|
|
152
|
-
},
|
|
153
|
-
emojiSettings: {
|
|
154
|
-
type: Object,
|
|
155
|
-
default: () => { return { openEmojisFrom: "top", smallEmojis: false } },
|
|
156
|
-
required: false
|
|
157
|
-
},
|
|
158
|
-
formattedMessageSettings: {
|
|
159
|
-
type: Object,
|
|
160
|
-
default: () => { return { hasStandardMessages: false, msgType: 0, token_cliente: "" } },
|
|
161
|
-
required: false
|
|
162
|
-
},
|
|
163
|
-
fileSettings: {
|
|
164
|
-
type: Object,
|
|
165
|
-
default: () => { return { docsExtensions: "", imagesExtensions: "", multiple: false, systemButton: false, max: 3, handleFilePreview: false, filePreviewStyle: 1, stackFiles: false, handleFileClick: false } },
|
|
166
|
-
required: false
|
|
167
|
-
},
|
|
168
|
-
textId: {
|
|
169
|
-
type: String,
|
|
170
|
-
required: true
|
|
171
|
-
},
|
|
172
|
-
isMainChat: {
|
|
173
|
-
type: Boolean,
|
|
174
|
-
default: false,
|
|
175
|
-
required: false
|
|
176
|
-
},
|
|
177
|
-
isSending: {
|
|
178
|
-
type: Boolean,
|
|
179
|
-
default: false,
|
|
180
|
-
required: false
|
|
181
|
-
},
|
|
182
|
-
dictionary: {
|
|
183
|
-
type: Object,
|
|
184
|
-
required: true
|
|
185
|
-
},
|
|
186
|
-
hasButtonFiles: {
|
|
187
|
-
type: Boolean,
|
|
188
|
-
required: false
|
|
189
|
-
},
|
|
190
|
-
externalFiles: {
|
|
191
|
-
type: Array,
|
|
192
|
-
required: false
|
|
193
|
-
}
|
|
194
|
-
},
|
|
195
|
-
data() {
|
|
196
|
-
return {
|
|
197
|
-
message: "",
|
|
198
|
-
openFiles: false,
|
|
199
|
-
file: [],
|
|
200
|
-
hasAnyFile: false,
|
|
201
|
-
imagePreview: "",
|
|
202
|
-
isDoc: false,
|
|
203
|
-
fileFormatError: false,
|
|
204
|
-
audioFile: "",
|
|
205
|
-
audioSource: "",
|
|
206
|
-
showStandardMessages: false,
|
|
207
|
-
messageType: 1
|
|
208
|
-
}
|
|
209
|
-
},
|
|
210
|
-
created() {
|
|
211
|
-
this.$root.$refs[`tf-${this.textId}`] = this
|
|
212
|
-
},
|
|
213
|
-
mounted() {
|
|
214
|
-
setResizeListeners(this.$el, ".js-autoresize", ".js-parentresize")
|
|
215
|
-
window.addEventListener("message", this.listenerPostMessage, false)
|
|
216
|
-
|
|
217
|
-
// this.$root.$on("drop-file", (file, type) => { if(this.buttons.hasFiles) this.fileUpload(file, type, true) })
|
|
218
|
-
// this.$root.$on("toggle-msg-formatada", () => { this.toggleStandardMessages() })
|
|
219
|
-
// this.$root.$on("textarea-focus", () => { this.focusTextarea() })
|
|
220
|
-
// this.$root.$on("resize-footer-template", () => { this.adjustChatHeight() })
|
|
221
|
-
// this.$root.$on("clear-footer-message", () => { this.message = "" })
|
|
222
|
-
// if(this.cssStyle.outsideButtons) if(this.$root.$refs.chatCorpo) this.$root.$refs.chatCorpo.setOutsideButtons(this.cssStyle.outsideButtons)
|
|
223
|
-
},
|
|
224
|
-
methods: {
|
|
225
|
-
listenerPostMessage(event){
|
|
226
|
-
const baseURL = window.location.hostname == 'localhost' ? `https://linux07` : `https://${window.location.hostname}`
|
|
227
|
-
if(!this.formattedMessageSettings.hasStandardMessages) return
|
|
228
|
-
if(event.data.gerenciador || event.data.abrirFishing || event.data.multiplos_contatos || event.data.inserir_cliente_omni || event.data.multiple_contatos) return
|
|
229
|
-
if(event.origin == baseURL) {
|
|
230
|
-
if(event.data == '' && this.showStandardMessages){
|
|
231
|
-
this.closeBlockerStandardMessage()
|
|
232
|
-
this.toggleStandardMessages()
|
|
233
|
-
this.$toasted.global.defaultInfo({msg: this.dictionary.msg_erro_sem_msg_formatada})
|
|
234
|
-
}else if(typeof event.data === "string" && this.showStandardMessages){
|
|
235
|
-
this.message = event.data
|
|
236
|
-
this.focusTextarea()
|
|
237
|
-
this.closeBlockerStandardMessage()
|
|
238
|
-
this.toggleStandardMessages()
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
},
|
|
242
|
-
closeEmojis() {
|
|
243
|
-
try {
|
|
244
|
-
this.$root.$refs[`etf-${this.textId}`].showEmojis ? this.$root.$refs[`etf-${this.textId}`].away() : ''
|
|
245
|
-
}catch(e) {
|
|
246
|
-
console.error("Nao foi possivel fechar os emojis")
|
|
247
|
-
console.error(e)
|
|
248
|
-
}
|
|
249
|
-
},
|
|
250
|
-
away() {
|
|
251
|
-
if(this.$refs[`${this.textId}-file`]) this.$refs[`${this.textId}-file`].openFiles = false
|
|
252
|
-
},
|
|
253
|
-
setDefaultMessage(msg) {
|
|
254
|
-
this.message = msg
|
|
255
|
-
this.sendFinalMessage()
|
|
256
|
-
},
|
|
257
|
-
insertEmoji(emoji) {
|
|
258
|
-
try {
|
|
259
|
-
if(!emoji) return
|
|
260
|
-
const textarea = document.querySelector(`#text-footer-${this.textId}`)
|
|
261
|
-
if (document.activeElement === textarea) {
|
|
262
|
-
const cursorStart = textarea.selectionStart
|
|
263
|
-
const cursorEnd = textarea.selectionEnd
|
|
264
|
-
if (cursorEnd == textarea.value.length) {
|
|
265
|
-
this.message += emoji.finalEmoji
|
|
266
|
-
textarea.setSelectionRange(textarea.value.length, textarea.value.length);
|
|
267
|
-
} else {
|
|
268
|
-
const initValue = textarea.value.slice(0, cursorStart) + emoji.finalEmoji;
|
|
269
|
-
const endValue = textarea.value.slice(cursorEnd)
|
|
270
|
-
this.message = initValue + endValue
|
|
271
|
-
textarea.setSelectionRange(initValue.length, initValue.length);
|
|
272
|
-
}
|
|
273
|
-
} else {
|
|
274
|
-
this.message += emoji.finalEmoji
|
|
275
|
-
}
|
|
276
|
-
this.sendFinalMessage()
|
|
277
|
-
}catch(e) {
|
|
278
|
-
console.error("Erro ao inserir emoji")
|
|
279
|
-
console.error(e)
|
|
280
|
-
}
|
|
281
|
-
},
|
|
282
|
-
verifyMessage() {
|
|
283
|
-
if(this.textareaSettings.maxCharacters && this.message) {
|
|
284
|
-
if(this.message.length > this.textareaSettings.maxCharacters) {
|
|
285
|
-
if (!document.querySelector(".toasted.toasted-primary.error")) this.$toasted.global.limiteCaracter()
|
|
286
|
-
return false
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
if((!this.message || !this.message.trim()) && !this.hasAnyFile && !this.audioFile) return false
|
|
291
|
-
|
|
292
|
-
if(this.textareaSettings.disabled) return false
|
|
293
|
-
|
|
294
|
-
if(this.fileFormatError && this.hasAnyFile) {
|
|
295
|
-
if (!document.querySelector(".toasted.toasted-primary.error")) this.$toasted.global.defaultError({ msg: this.dictionary.msg_formato_invalido })
|
|
296
|
-
const str = {
|
|
297
|
-
img: this.fileSettings.imagesExtensions.split("|").join(", "),
|
|
298
|
-
doc: this.fileSettings.docsExtensions.split("|").join(", ")
|
|
299
|
-
}
|
|
300
|
-
if (!document.querySelector(".toasted.toasted-primary.info")) this.$toasted.global.showValidFormats({ msg: `Imagens: ${str.img} - Documentos: ${str.doc} ${this.dictionary.msg_extensoes_aceitas}` })
|
|
301
|
-
return false
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
return true
|
|
305
|
-
},
|
|
306
|
-
removeHTMLElementsFromMessage(message) {
|
|
307
|
-
const regexTags = /<\/?[\d\w\s=\-:./'";]+>/gi
|
|
308
|
-
if(message.match(regexTags)) message = message.replace(regexTags, ' ')
|
|
309
|
-
return message
|
|
310
|
-
},
|
|
311
|
-
formatMessage(message) {
|
|
312
|
-
if(!message) return ""
|
|
313
|
-
message = message.trim()
|
|
314
|
-
message = message.replace(/\n$/, "", message)
|
|
315
|
-
message = returnMessageWithHexa(message)
|
|
316
|
-
message = this.removeHTMLElementsFromMessage(message)
|
|
317
|
-
return message
|
|
318
|
-
},
|
|
319
|
-
sendFinalMessage() {
|
|
320
|
-
const messageAux = this.formatMessage(this.message)
|
|
321
|
-
this.$emit("final-message", messageAux)
|
|
322
|
-
},
|
|
323
|
-
sendMessageHandler(event) {
|
|
324
|
-
this.sendMessage(event)
|
|
325
|
-
},
|
|
326
|
-
sendMessage(event) {
|
|
327
|
-
if(this.isSending) return
|
|
328
|
-
|
|
329
|
-
if(this.isMainChat && event){
|
|
330
|
-
if(this.textareaSettings.sendOnEnter){
|
|
331
|
-
if(event.keyCode == 13 && !event.shiftKey) event.preventDefault()
|
|
332
|
-
if(event.shiftKey) return
|
|
333
|
-
}else{
|
|
334
|
-
if(event.keyCode == 13) {
|
|
335
|
-
if(!event.shiftKey) return
|
|
336
|
-
event.preventDefault()
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
if(!this.buttons.hasSendButton) return
|
|
342
|
-
|
|
343
|
-
const messageAux = this.formatMessage(this.message)
|
|
344
|
-
if(this.verifyMessage()){
|
|
345
|
-
if(messageAux || this.hasAnyFile || this.audioFile) {
|
|
346
|
-
this.$emit("send-message", messageAux)
|
|
347
|
-
const objMessage = this.returnObjectMessage(messageAux)
|
|
348
|
-
this.$emit("obj-message", objMessage)
|
|
349
|
-
|
|
350
|
-
if(this.$refs[`emoji-text-${this.textId}`] && this.$refs[`emoji-text-${this.textId}`].showEmojis) this.$refs[`emoji-text-${this.textId}`].toggleEmojiSelection()
|
|
351
|
-
|
|
352
|
-
this.resetFooterData()
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
},
|
|
356
|
-
focusTextarea() {
|
|
357
|
-
const textarea = document.querySelector(`#text-footer-${this.textId}`)
|
|
358
|
-
if(textarea) textarea.focus()
|
|
359
|
-
},
|
|
360
|
-
resetFooterData() {
|
|
361
|
-
if(this.audioFile) this.deleteAudio()
|
|
362
|
-
if(this.hasAnyFile) this.$refs[`${this.textId}-file`].deleteFile()
|
|
363
|
-
this.message = ""
|
|
364
|
-
this.sendFinalMessage()
|
|
365
|
-
resetTargets(this.$el, ".js-autoresize", ".js-parentresize", "38px")
|
|
366
|
-
this.focusTextarea()
|
|
367
|
-
},
|
|
368
|
-
returnObjectMessage(message) {
|
|
369
|
-
return {
|
|
370
|
-
message,
|
|
371
|
-
attachment: this.hasAnyFile ? this.file : false,
|
|
372
|
-
isDoc: this.isDoc,
|
|
373
|
-
imagePreview: this.imagePreview,
|
|
374
|
-
isAudio: this.audioFile ? true : false,
|
|
375
|
-
audioAttachment: this.audioSource
|
|
376
|
-
}
|
|
377
|
-
},
|
|
378
|
-
setFileVars(fileObj) {
|
|
379
|
-
const { file, imagePreview, isDoc, fileFormatError, hasAnyFile } = fileObj;
|
|
380
|
-
|
|
381
|
-
this.file = file
|
|
382
|
-
this.imagePreview = imagePreview ? imagePreview : ""
|
|
383
|
-
this.isDoc = isDoc
|
|
384
|
-
this.fileFormatError = fileFormatError
|
|
385
|
-
this.hasAnyFile = hasAnyFile
|
|
386
|
-
|
|
387
|
-
this.$emit("set-file-vars", fileObj)
|
|
388
|
-
},
|
|
389
|
-
openImage(imagePreview) {
|
|
390
|
-
this.$emit("open-image", imagePreview)
|
|
391
|
-
},
|
|
392
|
-
openFileSystem() {
|
|
393
|
-
this.$emit("open-file-system")
|
|
394
|
-
},
|
|
395
|
-
resetFileSystem() {
|
|
396
|
-
this.$emit("reset-file-system")
|
|
397
|
-
},
|
|
398
|
-
setAudio(audioObj) {
|
|
399
|
-
const { audioFile, audioSource } = audioObj
|
|
400
|
-
this.audioFile = audioFile
|
|
401
|
-
this.audioSource = audioSource
|
|
402
|
-
},
|
|
403
|
-
deleteAudio() {
|
|
404
|
-
this.$refs[`${this.textId}-mic`].deleteMediaRecorder()
|
|
405
|
-
this.audioFile = ""
|
|
406
|
-
this.audioSource = ""
|
|
407
|
-
},
|
|
408
|
-
returnFileType(file, stopAlert) {
|
|
409
|
-
if(!this.fileSettings.imagesExtensions && !this.fileSettings.docsExtensions) return false
|
|
410
|
-
const imgRegex = new RegExp("\.("+this.fileSettings.imagesExtensions+")", "i")
|
|
411
|
-
if(imgRegex.test(file.name)) return "img"
|
|
412
|
-
|
|
413
|
-
const docRegex = new RegExp("\.("+this.fileSettings.docsExtensions+")", "i")
|
|
414
|
-
if(docRegex.test(file.name)) return "doc"
|
|
415
|
-
|
|
416
|
-
if(!stopAlert) return false
|
|
417
|
-
if (!document.querySelector(".toasted.toasted-primary.error")) this.$toasted.global.defaultError({ msg: this.dictionary.msg_formato_invalido })
|
|
418
|
-
const str = {
|
|
419
|
-
img: this.fileSettings.imagesExtensions.split("|").join(", "),
|
|
420
|
-
doc: this.fileSettings.docsExtensions.split("|").join(", ")
|
|
421
|
-
}
|
|
422
|
-
if (!document.querySelector(".toasted.toasted-primary.info")) this.$toasted.global.showValidFormats({ msg: `Imagens: ${str.img} - Documentos: ${str.doc} ${this.dictionary.msg_extensoes_aceitas}` })
|
|
423
|
-
return false
|
|
424
|
-
},
|
|
425
|
-
filesHandler(files) {
|
|
426
|
-
if(!Array.isArray(files)) files = Array.from(files)
|
|
427
|
-
const fileType = this.returnFileType(files[0], true)
|
|
428
|
-
let invalidFile = false
|
|
429
|
-
try {
|
|
430
|
-
files.forEach(file => {
|
|
431
|
-
const singleFileType = this.returnFileType(file, true)
|
|
432
|
-
if(!singleFileType) {
|
|
433
|
-
invalidFile = true
|
|
434
|
-
file.invalid = true
|
|
435
|
-
}
|
|
436
|
-
file.imgOrDoc = singleFileType ? singleFileType : ""
|
|
437
|
-
})
|
|
438
|
-
}catch(e) {
|
|
439
|
-
console.error("Erro ao tentar percorrer os arquivos")
|
|
440
|
-
console.error(e)
|
|
441
|
-
invalidFile = true
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
if(!invalidFile) {
|
|
445
|
-
this.$refs[`${this.textId}-file`].fileUpload(files, fileType, true)
|
|
446
|
-
}else {
|
|
447
|
-
if (!document.querySelector(".toasted.toasted-primary.error")) this.$toasted.global.defaultError({ msg: this.dictionary.msg_formato_invalido })
|
|
448
|
-
const str = {
|
|
449
|
-
img: this.fileSettings.imagesExtensions.split("|").join(", "),
|
|
450
|
-
doc: this.fileSettings.docsExtensions.split("|").join(", ")
|
|
451
|
-
}
|
|
452
|
-
if (!document.querySelector(".toasted.toasted-primary.info")) this.$toasted.global.showValidFormats({ msg: `Imagens: ${str.img} - Documentos: ${str.doc} ${this.dictionary.msg_extensoes_aceitas}` })
|
|
453
|
-
}
|
|
454
|
-
},
|
|
455
|
-
dropFile(e) {
|
|
456
|
-
try {
|
|
457
|
-
e.stopPropagation()
|
|
458
|
-
e.preventDefault()
|
|
459
|
-
if(!this.buttons.hasFiles || this.fileSettings.handleFileClick) return false
|
|
460
|
-
const files = e.dataTransfer.files.length ? e.dataTransfer.files : ""
|
|
461
|
-
this.filesHandler(files)
|
|
462
|
-
}catch(e) {
|
|
463
|
-
console.error("Erro drop file")
|
|
464
|
-
console.error(e)
|
|
465
|
-
}
|
|
466
|
-
},
|
|
467
|
-
pasteImage(e) {
|
|
468
|
-
try {
|
|
469
|
-
if(e.clipboardData.files.length && !this.buttons.hasFiles) {
|
|
470
|
-
e.preventDefault()
|
|
471
|
-
return
|
|
472
|
-
}else if(e.clipboardData.files.length && this.buttons.hasFiles) {
|
|
473
|
-
const files = e.clipboardData.files
|
|
474
|
-
this.filesHandler(files)
|
|
475
|
-
}
|
|
476
|
-
}catch(e) {
|
|
477
|
-
console.error("Nao foi possivel colar a/o imagem/documento")
|
|
478
|
-
console.error(e)
|
|
479
|
-
}
|
|
480
|
-
},
|
|
481
|
-
handleScreenShare() {
|
|
482
|
-
this.$emit("handle-screen-share")
|
|
483
|
-
},
|
|
484
|
-
toggleStandardMessages() {
|
|
485
|
-
this.showStandardMessages = !this.showStandardMessages
|
|
486
|
-
},
|
|
487
|
-
openBlockerStandardMessage() {
|
|
488
|
-
this.$emit("open-blocker-standard-message")
|
|
489
|
-
},
|
|
490
|
-
closeBlockerStandardMessage() {
|
|
491
|
-
this.$emit("close-blocker-standard-message")
|
|
492
|
-
},
|
|
493
|
-
setMessageType(type) {
|
|
494
|
-
this.messageType = type
|
|
495
|
-
},
|
|
496
|
-
setStandardInfos(infos) {
|
|
497
|
-
this.$emit("set-standard-infos", infos)
|
|
498
|
-
},
|
|
499
|
-
addStandardMessage(message) {
|
|
500
|
-
this.message = message
|
|
501
|
-
this.sendFinalMessage()
|
|
502
|
-
},
|
|
503
|
-
closeStandardMessages() {
|
|
504
|
-
this.showStandardMessages = false
|
|
505
|
-
}
|
|
506
|
-
},
|
|
507
|
-
destroyed() {
|
|
508
|
-
// this.$root.$off("drop-file")
|
|
509
|
-
// this.$root.$off("toggle-msg-formatada")
|
|
510
|
-
// this.$root.$off("textarea-focus")
|
|
511
|
-
// this.$root.$off("clear-footer-message")
|
|
512
|
-
// this.$root.$off("resize-footer-template")
|
|
513
|
-
|
|
514
|
-
window.removeEventListener("message", this.listenerPostMessage)
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
</script>
|
|
518
|
-
|
|
519
|
-
<style>
|
|
520
|
-
.toasted svg {
|
|
521
|
-
margin-right: 10px; }
|
|
522
|
-
|
|
523
|
-
.d-none {
|
|
524
|
-
display: none; }
|
|
525
|
-
|
|
526
|
-
ul {
|
|
527
|
-
list-style-type: none; }
|
|
528
|
-
|
|
529
|
-
.text-footer-container {
|
|
530
|
-
display: flex;
|
|
531
|
-
justify-content: center;
|
|
532
|
-
align-items: center;
|
|
533
|
-
flex-direction: column;
|
|
534
|
-
width: 100%;
|
|
535
|
-
position: relative; }
|
|
536
|
-
.text-footer-container .text-footer {
|
|
537
|
-
min-height: 48px;
|
|
538
|
-
box-shadow: 0px 3px 7px -2px rgba(0, 0, 0, 0.45);
|
|
539
|
-
position: relative;
|
|
540
|
-
display: flex;
|
|
541
|
-
justify-content: center;
|
|
542
|
-
align-items: center;
|
|
543
|
-
border: 1px solid #ccc;
|
|
544
|
-
padding: 5px 2px 5px 5px;
|
|
545
|
-
border-radius: 5px; }
|
|
546
|
-
.text-footer-container .text-footer.full {
|
|
547
|
-
width: 100%; }
|
|
548
|
-
.text-footer-container .text-footer.almostFull {
|
|
549
|
-
width: 95%; }
|
|
550
|
-
.text-footer-container .text-footer.medium {
|
|
551
|
-
width: 75%; }
|
|
552
|
-
.text-footer-container.bigger .text-footer {
|
|
553
|
-
height: 80px;
|
|
554
|
-
}
|
|
555
|
-
.text-footer-container.bigger .text-footer > textarea {
|
|
556
|
-
font-size: .875rem;
|
|
557
|
-
height: 75px;
|
|
558
|
-
max-height: 75px;
|
|
559
|
-
min-height: 75px;
|
|
560
|
-
}
|
|
561
|
-
.text-footer-container textarea {
|
|
562
|
-
margin: 0 5px;
|
|
563
|
-
border: unset;
|
|
564
|
-
flex: 1;
|
|
565
|
-
resize: none;
|
|
566
|
-
min-height: 30px;
|
|
567
|
-
max-height: 60px;
|
|
568
|
-
font-size: .875rem;
|
|
569
|
-
font-family: inherit;
|
|
570
|
-
background: inherit; }
|
|
571
|
-
.text-footer-container textarea:focus {
|
|
572
|
-
outline: unset; }
|
|
573
|
-
.text-footer-container textarea::placeholder {
|
|
574
|
-
font-size: .75rem;
|
|
575
|
-
}
|
|
576
|
-
.text-footer-container .text-footer-audio {
|
|
577
|
-
flex: 1;
|
|
578
|
-
display: flex;
|
|
579
|
-
justify-content: center;
|
|
580
|
-
align-items: center; }
|
|
581
|
-
.text-footer-container audio {
|
|
582
|
-
flex: 1;
|
|
583
|
-
outline: unset;
|
|
584
|
-
width: auto;
|
|
585
|
-
height: 38px; }
|
|
586
|
-
.text-footer-container .delete-audio {
|
|
587
|
-
display: flex;
|
|
588
|
-
justify-content: center;
|
|
589
|
-
align-items: center;
|
|
590
|
-
color: #E74C3C;
|
|
591
|
-
transition: background 300ms;
|
|
592
|
-
border-radius: 50%;
|
|
593
|
-
font-size: 1rem;
|
|
594
|
-
padding: 10px;
|
|
595
|
-
cursor: pointer;
|
|
596
|
-
margin: 0 5px;
|
|
597
|
-
width: 31px;
|
|
598
|
-
height: 31px; }
|
|
599
|
-
.text-footer-container .delete-audio:hover {
|
|
600
|
-
background-color: rgba(208, 0, 0, 0.2); }
|
|
601
|
-
.text-footer-container .max-characters {
|
|
602
|
-
font-size: .575rem;
|
|
603
|
-
z-index: 1;
|
|
604
|
-
color: #444;
|
|
605
|
-
position: relative;
|
|
606
|
-
top: 30px;
|
|
607
|
-
left: -30px; }
|
|
608
|
-
.text-footer-container .max-characters.no-width {
|
|
609
|
-
width: 0; }
|
|
610
|
-
.text-footer-container .text-footer-actions {
|
|
611
|
-
display: flex; }
|
|
612
|
-
.text-footer-container .text-footer-actions.outside-buttons {
|
|
613
|
-
display: flex;
|
|
614
|
-
align-items: center;
|
|
615
|
-
justify-content: flex-end;
|
|
616
|
-
position: absolute;
|
|
617
|
-
top: -30px;
|
|
618
|
-
right: 35px;
|
|
619
|
-
background-color: #FAFAFA;
|
|
620
|
-
}
|
|
621
|
-
.text-footer-container .text-footer-actions .text-footer-actions--btn {
|
|
622
|
-
display: flex;
|
|
623
|
-
justify-content: center;
|
|
624
|
-
align-items: center;
|
|
625
|
-
color: #777;
|
|
626
|
-
border-radius: 50%;
|
|
627
|
-
transition: background 300ms;
|
|
628
|
-
padding: 10px;
|
|
629
|
-
font-size: 1rem;
|
|
630
|
-
width: 36px;
|
|
631
|
-
height: 36px;
|
|
632
|
-
cursor: pointer;
|
|
633
|
-
margin-right: 2.5px; }
|
|
634
|
-
.text-footer-container .text-footer-actions .text-footer-actions--btn:last-child {
|
|
635
|
-
margin-right: unset; }
|
|
636
|
-
.text-footer-container .text-footer-actions .text-footer-actions--btn:hover {
|
|
637
|
-
background-color: rgba(0, 0, 0, 0.1); }
|
|
638
|
-
.text-footer-container .text-footer-actions .text-footer-actions--btn.files-activated {
|
|
639
|
-
background-color: rgba(0, 0, 0, 0.1); }
|
|
640
|
-
.text-footer-container .text-footer-actions .text-footer-actions--btn.audio-activated {
|
|
641
|
-
background-color: rgba(208, 0, 0, 0.7);
|
|
642
|
-
color: #fff; }
|
|
643
|
-
.text-footer-container .text-footer-actions .text-footer-actions--btn.left-button {
|
|
644
|
-
position: absolute;
|
|
645
|
-
left: 0; }
|
|
646
|
-
.text-footer-container .text-footer-hsm-container {
|
|
647
|
-
margin: 12px 0 7px 0; }
|
|
648
|
-
.text-footer-container .text-footer-hsm-container.full {
|
|
649
|
-
width: 100%; }
|
|
650
|
-
.text-footer-container .text-footer-hsm-container.almostFull {
|
|
651
|
-
width: 95%; }
|
|
652
|
-
.text-footer-container .text-footer-hsm-container.medium {
|
|
653
|
-
width: 75%; }
|
|
654
|
-
.text-footer-container .text-footer-hsm-container .text-footer-v-select {
|
|
655
|
-
border-radius: 5px;
|
|
656
|
-
margin-bottom: 5px; }
|
|
657
|
-
.text-footer-container .text-footer-hsm-container .text-footer-select-03 {
|
|
658
|
-
display: flex;
|
|
659
|
-
align-items: center;
|
|
660
|
-
flex: 1;
|
|
661
|
-
width: 100%; }
|
|
662
|
-
.text-footer-container .text-footer-hsm-container .text-footer-select-03 .text-footer-v-select {
|
|
663
|
-
flex: 1; }
|
|
664
|
-
.text-footer-container .text-footer-hsm-container .text-footer-select-03 .text-footer--btn-select-03 {
|
|
665
|
-
transition-duration: 300ms;
|
|
666
|
-
user-select: none;
|
|
667
|
-
cursor: pointer;
|
|
668
|
-
box-shadow: inset 0 -3px rgba(0, 0, 0, 0.2);
|
|
669
|
-
opacity: 0.9;
|
|
670
|
-
border-radius: 2.5px;
|
|
671
|
-
display: flex;
|
|
672
|
-
justify-content: center;
|
|
673
|
-
align-items: center;
|
|
674
|
-
margin-left: 5px;
|
|
675
|
-
margin-bottom: 5px;
|
|
676
|
-
background-color: #F7FE72;
|
|
677
|
-
width: 32px;
|
|
678
|
-
height: 32px; }
|
|
679
|
-
.text-footer-container .text-footer-hsm-container .text-footer-select-03 .text-footer--btn-select-03:hover {
|
|
680
|
-
opacity: 1; }
|
|
681
|
-
.text-footer-container .text-footer-hsm-container .text-footer-select-03 .text-footer--btn-select-03:active {
|
|
682
|
-
opacity: 1;
|
|
683
|
-
box-shadow: inset 0 -1px rgba(0, 0, 0, 0.2);
|
|
684
|
-
-webkit-transform: translateY(1px);
|
|
685
|
-
-moz-transform: translateY(1px);
|
|
686
|
-
-o-transform: translateY(1px);
|
|
687
|
-
-ms-transform: translateY(1px);
|
|
688
|
-
transform: translateY(1px); }
|
|
689
|
-
.text-footer-container .text-footer-hsm-container .text-footer-select-03 .text-footer--btn-select-03 svg {
|
|
690
|
-
font-size: 1rem; }
|
|
691
|
-
.text-footer-container .text-footer-files-container {
|
|
692
|
-
position: absolute;
|
|
693
|
-
right: 0;
|
|
694
|
-
top: -55px;
|
|
695
|
-
padding: 5px;
|
|
696
|
-
background-color: rgba(0, 0, 0, 0.4);
|
|
697
|
-
border-radius: 5px;
|
|
698
|
-
display: flex;
|
|
699
|
-
align-items: center;
|
|
700
|
-
justify-content: space-between;
|
|
701
|
-
z-index: 1; }
|
|
702
|
-
.text-footer-container .text-footer-files-container.horizontal {
|
|
703
|
-
right: -55px;
|
|
704
|
-
flex-direction: column; }
|
|
705
|
-
.text-footer-container .text-footer-files-container .files-btn {
|
|
706
|
-
transition-duration: 300ms;
|
|
707
|
-
transition-property: opacity;
|
|
708
|
-
opacity: .8;
|
|
709
|
-
cursor: pointer;
|
|
710
|
-
display: flex;
|
|
711
|
-
justify-content: center;
|
|
712
|
-
align-items: center;
|
|
713
|
-
border-radius: 10px;
|
|
714
|
-
padding: 3px;
|
|
715
|
-
width: 40px;
|
|
716
|
-
height: 40px;
|
|
717
|
-
font-size: 1rem;
|
|
718
|
-
color: #FFF; }
|
|
719
|
-
.text-footer-container .text-footer-files-container .files-btn:hover {
|
|
720
|
-
opacity: 1; }
|
|
721
|
-
.text-footer-container .text-footer-files-container .files-btn svg {
|
|
722
|
-
color: #FFF; }
|
|
723
|
-
.text-footer-container .text-footer-files-container .files-btn.images {
|
|
724
|
-
background-color: #9575cd;
|
|
725
|
-
margin-right: 5px; }
|
|
726
|
-
.text-footer-container .text-footer-files-container .files-btn.images.margin-bottom {
|
|
727
|
-
margin-right: unset;
|
|
728
|
-
margin-bottom: 5px; }
|
|
729
|
-
.text-footer-container .text-footer-files-container .files-btn.docs {
|
|
730
|
-
background-color: #7986cb; }
|
|
731
|
-
.text-footer-container .text-footer-files-container .files-btn.system {
|
|
732
|
-
background-color: #49a349;
|
|
733
|
-
margin-left: 5px }
|
|
734
|
-
.text-footer-container .text-footer-files-container .files-btn.both {
|
|
735
|
-
font-size: .95rem;
|
|
736
|
-
background-color: rgb(85, 85, 236);
|
|
737
|
-
flex-direction: column;
|
|
738
|
-
}
|
|
739
|
-
.text-footer-container .text-footer-files-container .files-btn.both svg:nth-child(1) {
|
|
740
|
-
transform: translateX(5px)
|
|
741
|
-
}
|
|
742
|
-
.text-footer-container .text-footer-files-container .files-btn.both svg:nth-child(2) {
|
|
743
|
-
transform: translateX(-5px)
|
|
744
|
-
}
|
|
745
|
-
|
|
746
|
-
.text-footer-container .text-footer-preview-container {
|
|
747
|
-
width: 100%;
|
|
748
|
-
cursor: default;
|
|
749
|
-
position: absolute;
|
|
750
|
-
left: 0;
|
|
751
|
-
background-color: #F1f1f1;
|
|
752
|
-
border: 2px solid #CCC;
|
|
753
|
-
border-bottom: unset;
|
|
754
|
-
border-top-left-radius: 2.5px;
|
|
755
|
-
border-top-right-radius: 2.5px; }
|
|
756
|
-
.text-footer-container .text-footer-preview-container.isDoc {
|
|
757
|
-
top: -50px;
|
|
758
|
-
width: 100%;
|
|
759
|
-
height: 45px; }
|
|
760
|
-
.text-footer-container .text-footer-preview-container.isImg, .text-footer-container .text-footer-preview-container.isMultiple {
|
|
761
|
-
top: -205px;
|
|
762
|
-
width: 100%;
|
|
763
|
-
height: 200px; }
|
|
764
|
-
.text-footer-container .text-footer-preview-container.isImg .text-footer-image-preview {
|
|
765
|
-
height: 170px; }
|
|
766
|
-
.text-footer-container .text-footer-preview-container.isError {
|
|
767
|
-
top: -80px;
|
|
768
|
-
width: 100%;
|
|
769
|
-
height: 75px; }
|
|
770
|
-
|
|
771
|
-
.text-footer-container .text-footer-alt {
|
|
772
|
-
margin-top: -12px;
|
|
773
|
-
width: 100%;
|
|
774
|
-
padding: 0 10px; }
|
|
775
|
-
.text-footer-container .text-footer-alt .text-footer-out-session {
|
|
776
|
-
margin-top: 12px; }
|
|
777
|
-
.text-footer-container .text-footer-alt .text-footer-sem-24h {
|
|
778
|
-
font-size: .8rem;
|
|
779
|
-
text-align: right;
|
|
780
|
-
font-weight: 600;
|
|
781
|
-
letter-spacing: -0.5px;
|
|
782
|
-
color: #dd7f0c;
|
|
783
|
-
margin-top: 5px;
|
|
784
|
-
position: absolute;
|
|
785
|
-
right: 0; }
|
|
786
|
-
.text-footer-container .text-footer-alt .sem-templates {
|
|
787
|
-
margin-top: 10px;
|
|
788
|
-
font-size: .8rem;
|
|
789
|
-
text-align: right;
|
|
790
|
-
font-weight: 600;
|
|
791
|
-
letter-spacing: -0.5px;
|
|
792
|
-
color: #921e12; }
|
|
793
|
-
.text-footer-container .text-footer-alt .text-footer-templates {
|
|
794
|
-
position: relative;
|
|
795
|
-
width: 100%; }
|
|
796
|
-
.text-footer-container .text-footer-alt .text-footer-templates .text-footer-group-selection {
|
|
797
|
-
width: 100%;
|
|
798
|
-
display: flex;
|
|
799
|
-
align-items: center; }
|
|
800
|
-
.text-footer-container .text-footer-alt .text-footer-templates .text-footer-group-selection h4 {
|
|
801
|
-
margin-right: 5px; }
|
|
802
|
-
.text-footer-container .text-footer-alt .text-footer-templates .text-footer-group-selection .sm__select {
|
|
803
|
-
flex: 1; }
|
|
804
|
-
|
|
805
|
-
.vs__dropdown-menu {
|
|
806
|
-
font-size: 0.85rem !important; }
|
|
807
|
-
|
|
808
|
-
.emoji-mart-anchor, .emoji-mart-emoji span {
|
|
809
|
-
cursor: pointer !important; }
|
|
810
|
-
|
|
811
|
-
.emoji-mart {
|
|
812
|
-
z-index: 2 !important; }
|
|
813
|
-
|
|
814
|
-
.emoji-mart-scroll {
|
|
815
|
-
overflow-x: hidden; }
|
|
816
|
-
|
|
817
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="text-footer-container" :class="{'bigger' : cssStyle.height}" v-on-clickaway="away" v-if="textId" @drop.stop="dropFile" @dragenter.prevent @dragover.prevent>
|
|
3
|
+
<div class="text-footer" :class="cssStyle.width ? cssStyle.width: ''" :style="`background-color: ${cssStyle.backgroundColor}`">
|
|
4
|
+
<BtnEmojis
|
|
5
|
+
v-show="buttons.hasEmojis && !audioFile"
|
|
6
|
+
:ref="`${this.textId}`"
|
|
7
|
+
:emojiId="`${this.textId}`"
|
|
8
|
+
:down="emojiSettings.openEmojisFrom == 'top' ? false : true"
|
|
9
|
+
:small="emojiSettings.smallEmojis"
|
|
10
|
+
:biggerTextarea="cssStyle.height ? true : false"
|
|
11
|
+
@insert-emoji="insertEmoji"
|
|
12
|
+
/>
|
|
13
|
+
<transition name="fade">
|
|
14
|
+
<Loader v-if="isSending" />
|
|
15
|
+
</transition>
|
|
16
|
+
<textarea
|
|
17
|
+
class="js-autoresize"
|
|
18
|
+
v-if="!audioFile"
|
|
19
|
+
v-model="message"
|
|
20
|
+
:id="`text-footer-${this.textId}`"
|
|
21
|
+
:disabled="textareaSettings.disabled"
|
|
22
|
+
:placeholder="textareaSettings.placeholderMessage"
|
|
23
|
+
@input="sendFinalMessage"
|
|
24
|
+
@keydown.up="toggleStandardMessages"
|
|
25
|
+
@keydown.down="toggleStandardMessages"
|
|
26
|
+
@keydown.esc="closeEmojis"
|
|
27
|
+
@keydown.enter="sendMessageHandler"
|
|
28
|
+
@paste="pasteImage"
|
|
29
|
+
></textarea>
|
|
30
|
+
<div class="text-footer-audio" v-else>
|
|
31
|
+
<audio :src="audioSource" controls="controls"></audio>
|
|
32
|
+
<span class="delete-audio" title="Cancelar" @click="deleteAudio">
|
|
33
|
+
<fa-icon :icon="['fas', 'times']" />
|
|
34
|
+
</span>
|
|
35
|
+
</div>
|
|
36
|
+
<RemainingCharacters
|
|
37
|
+
:class="{'d-none' : audioFile}"
|
|
38
|
+
:message="message"
|
|
39
|
+
:maxCharacters="textareaSettings.maxCharacters"
|
|
40
|
+
/>
|
|
41
|
+
<div v-if="buttons.hasFiles || buttons.hasAudio || buttons.hasExpand || formattedMessageSettings.hasStandardMessages || buttons.hasScreenShare || buttons.hasDownloadAll" class="text-footer-actions" :class="{'outside-buttons' : cssStyle.outsideButtons && !audioFile}">
|
|
42
|
+
<BtnDownloadAllFiles
|
|
43
|
+
v-show="buttons.hasDownloadAll && !audioFile"
|
|
44
|
+
@click-trigger="$emit('handle-download-files')"
|
|
45
|
+
:dictionary="dictionary"
|
|
46
|
+
:ref="`${textId}-download-files`"
|
|
47
|
+
/>
|
|
48
|
+
<BtnScreenShare
|
|
49
|
+
v-show="buttons.hasScreenShare && !audioFile"
|
|
50
|
+
@handle-screen-share="handleScreenShare"
|
|
51
|
+
:dictionary="dictionary"
|
|
52
|
+
:ref="`${textId}-screen-share`"
|
|
53
|
+
/>
|
|
54
|
+
<BtnMic
|
|
55
|
+
v-show="buttons.hasAudio && !audioFile"
|
|
56
|
+
:dictionary="dictionary"
|
|
57
|
+
@set-audio="setAudio"
|
|
58
|
+
:ref="`${textId}-mic`"
|
|
59
|
+
/>
|
|
60
|
+
<BtnStandardMessages
|
|
61
|
+
v-show="formattedMessageSettings.hasStandardMessages && !audioFile"
|
|
62
|
+
:dictionary="dictionary"
|
|
63
|
+
:ref="`${textId}-standard-messages`"
|
|
64
|
+
@toggle-standard-messages="toggleStandardMessages"
|
|
65
|
+
/>
|
|
66
|
+
<BtnFiles
|
|
67
|
+
v-show="buttons.hasFiles && !audioFile"
|
|
68
|
+
:textId="textId"
|
|
69
|
+
:dictionary="dictionary"
|
|
70
|
+
:fileSettings="fileSettings"
|
|
71
|
+
:cssStyle="cssStyle"
|
|
72
|
+
:ref="`${textId}-file`"
|
|
73
|
+
:hasButtonFiles="hasButtonFiles"
|
|
74
|
+
:externalFiles="externalFiles"
|
|
75
|
+
@set-file-vars="setFileVars"
|
|
76
|
+
@open-image="openImage"
|
|
77
|
+
@open-file-system="openFileSystem"
|
|
78
|
+
@reset-file-system="resetFileSystem"
|
|
79
|
+
@handle-file-preview="$emit('handle-file-preview')"
|
|
80
|
+
@handle-file-click="$emit('handle-file-click')"
|
|
81
|
+
/>
|
|
82
|
+
<BtnExpand
|
|
83
|
+
v-show="buttons.hasExpand && !audioFile"
|
|
84
|
+
:ref="`${textId}-expand`"
|
|
85
|
+
@expand-textarea="$emit('expand-textarea')"
|
|
86
|
+
:dictionary="dictionary"
|
|
87
|
+
/>
|
|
88
|
+
</div>
|
|
89
|
+
<div class="text-footer-actions" v-if="buttons.hasSendButton">
|
|
90
|
+
<span class="text-footer-actions--btn" :title="dictionary.title_enviar_msg" @click="sendMessageHandler">
|
|
91
|
+
<fa-icon :icon="['fas', 'paper-plane']" />
|
|
92
|
+
</span>
|
|
93
|
+
</div>
|
|
94
|
+
</div>
|
|
95
|
+
<transition name="fade">
|
|
96
|
+
<StandardMessages
|
|
97
|
+
v-if="showStandardMessages"
|
|
98
|
+
:class="cssStyle.width ? cssStyle.width: ''"
|
|
99
|
+
:dictionary="dictionary"
|
|
100
|
+
:backgroundColor="cssStyle.backgroundColor"
|
|
101
|
+
:token_cliente="formattedMessageSettings.token_cliente ? formattedMessageSettings.token_cliente : ''"
|
|
102
|
+
:message="message"
|
|
103
|
+
:messageType="messageType"
|
|
104
|
+
:hasStandardMessages="formattedMessageSettings.hasStandardMessages && showStandardMessages"
|
|
105
|
+
|
|
106
|
+
@close-standard-messages="closeStandardMessages"
|
|
107
|
+
@open-blocker-standard-message="openBlockerStandardMessage"
|
|
108
|
+
@close-blocker-standard-message="closeBlockerStandardMessage"
|
|
109
|
+
@set-message-type="setMessageType"
|
|
110
|
+
@set-standard-infos="setStandardInfos"
|
|
111
|
+
@add-standard-message="addStandardMessage"
|
|
112
|
+
@error-standard-message="$emit('error-standard-message')"
|
|
113
|
+
/>
|
|
114
|
+
</transition>
|
|
115
|
+
</div>
|
|
116
|
+
</template>
|
|
117
|
+
|
|
118
|
+
<script>
|
|
119
|
+
import { setResizeListeners, resetTargets } from "../../services/autoResize"
|
|
120
|
+
import { mixin as clickaway } from "vue-clickaway"
|
|
121
|
+
import { returnMessageWithHexa } from "../../services/textFormatting"
|
|
122
|
+
|
|
123
|
+
import BtnEmojis from "./BtnEmojis"
|
|
124
|
+
import Loader from "../Loader/Loader"
|
|
125
|
+
import RemainingCharacters from "./RemainingCharacters"
|
|
126
|
+
import BtnMic from "./BtnMic"
|
|
127
|
+
import BtnFiles from "./BtnFiles"
|
|
128
|
+
import BtnExpand from "./BtnExpand"
|
|
129
|
+
import BtnStandardMessages from "./BtnStandardMessages"
|
|
130
|
+
import StandardMessages from "./StandardMessages"
|
|
131
|
+
import BtnScreenShare from "./BtnScreenShare"
|
|
132
|
+
import BtnDownloadAllFiles from './BtnDownloadAllFiles'
|
|
133
|
+
|
|
134
|
+
export default {
|
|
135
|
+
components: { BtnEmojis, Loader, BtnMic, BtnFiles, BtnExpand, RemainingCharacters, BtnStandardMessages, StandardMessages, BtnScreenShare, BtnDownloadAllFiles },
|
|
136
|
+
mixins: [ clickaway ],
|
|
137
|
+
props: {
|
|
138
|
+
buttons: {
|
|
139
|
+
type: Object,
|
|
140
|
+
default: () => { return { hasEmojis: false, hasSendButton: false, hasFiles: false, hasAudio: false, hasExpand: false, hasScreenShare: false } },
|
|
141
|
+
required: false
|
|
142
|
+
},
|
|
143
|
+
cssStyle: {
|
|
144
|
+
type: Object,
|
|
145
|
+
default: () => { return { height: false, width: "full", backgroundColor: "#FFF", outsideButtons: false } },
|
|
146
|
+
required: false
|
|
147
|
+
},
|
|
148
|
+
textareaSettings: {
|
|
149
|
+
type: Object,
|
|
150
|
+
default: () => { return { placeholderMessage: "", maxCharacters: 0, sendOnEnter: false, disabled: false } },
|
|
151
|
+
required: false
|
|
152
|
+
},
|
|
153
|
+
emojiSettings: {
|
|
154
|
+
type: Object,
|
|
155
|
+
default: () => { return { openEmojisFrom: "top", smallEmojis: false } },
|
|
156
|
+
required: false
|
|
157
|
+
},
|
|
158
|
+
formattedMessageSettings: {
|
|
159
|
+
type: Object,
|
|
160
|
+
default: () => { return { hasStandardMessages: false, msgType: 0, token_cliente: "" } },
|
|
161
|
+
required: false
|
|
162
|
+
},
|
|
163
|
+
fileSettings: {
|
|
164
|
+
type: Object,
|
|
165
|
+
default: () => { return { docsExtensions: "", imagesExtensions: "", multiple: false, systemButton: false, max: 3, handleFilePreview: false, filePreviewStyle: 1, stackFiles: false, handleFileClick: false } },
|
|
166
|
+
required: false
|
|
167
|
+
},
|
|
168
|
+
textId: {
|
|
169
|
+
type: String,
|
|
170
|
+
required: true
|
|
171
|
+
},
|
|
172
|
+
isMainChat: {
|
|
173
|
+
type: Boolean,
|
|
174
|
+
default: false,
|
|
175
|
+
required: false
|
|
176
|
+
},
|
|
177
|
+
isSending: {
|
|
178
|
+
type: Boolean,
|
|
179
|
+
default: false,
|
|
180
|
+
required: false
|
|
181
|
+
},
|
|
182
|
+
dictionary: {
|
|
183
|
+
type: Object,
|
|
184
|
+
required: true
|
|
185
|
+
},
|
|
186
|
+
hasButtonFiles: {
|
|
187
|
+
type: Boolean,
|
|
188
|
+
required: false
|
|
189
|
+
},
|
|
190
|
+
externalFiles: {
|
|
191
|
+
type: Array,
|
|
192
|
+
required: false
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
data() {
|
|
196
|
+
return {
|
|
197
|
+
message: "",
|
|
198
|
+
openFiles: false,
|
|
199
|
+
file: [],
|
|
200
|
+
hasAnyFile: false,
|
|
201
|
+
imagePreview: "",
|
|
202
|
+
isDoc: false,
|
|
203
|
+
fileFormatError: false,
|
|
204
|
+
audioFile: "",
|
|
205
|
+
audioSource: "",
|
|
206
|
+
showStandardMessages: false,
|
|
207
|
+
messageType: 1
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
created() {
|
|
211
|
+
this.$root.$refs[`tf-${this.textId}`] = this
|
|
212
|
+
},
|
|
213
|
+
mounted() {
|
|
214
|
+
setResizeListeners(this.$el, ".js-autoresize", ".js-parentresize")
|
|
215
|
+
window.addEventListener("message", this.listenerPostMessage, false)
|
|
216
|
+
|
|
217
|
+
// this.$root.$on("drop-file", (file, type) => { if(this.buttons.hasFiles) this.fileUpload(file, type, true) })
|
|
218
|
+
// this.$root.$on("toggle-msg-formatada", () => { this.toggleStandardMessages() })
|
|
219
|
+
// this.$root.$on("textarea-focus", () => { this.focusTextarea() })
|
|
220
|
+
// this.$root.$on("resize-footer-template", () => { this.adjustChatHeight() })
|
|
221
|
+
// this.$root.$on("clear-footer-message", () => { this.message = "" })
|
|
222
|
+
// if(this.cssStyle.outsideButtons) if(this.$root.$refs.chatCorpo) this.$root.$refs.chatCorpo.setOutsideButtons(this.cssStyle.outsideButtons)
|
|
223
|
+
},
|
|
224
|
+
methods: {
|
|
225
|
+
listenerPostMessage(event){
|
|
226
|
+
const baseURL = window.location.hostname == 'localhost' ? `https://linux07` : `https://${window.location.hostname}`
|
|
227
|
+
if(!this.formattedMessageSettings.hasStandardMessages) return
|
|
228
|
+
if(event.data.gerenciador || event.data.abrirFishing || event.data.multiplos_contatos || event.data.inserir_cliente_omni || event.data.multiple_contatos) return
|
|
229
|
+
if(event.origin == baseURL) {
|
|
230
|
+
if(event.data == '' && this.showStandardMessages){
|
|
231
|
+
this.closeBlockerStandardMessage()
|
|
232
|
+
this.toggleStandardMessages()
|
|
233
|
+
this.$toasted.global.defaultInfo({msg: this.dictionary.msg_erro_sem_msg_formatada})
|
|
234
|
+
}else if(typeof event.data === "string" && this.showStandardMessages){
|
|
235
|
+
this.message = event.data
|
|
236
|
+
this.focusTextarea()
|
|
237
|
+
this.closeBlockerStandardMessage()
|
|
238
|
+
this.toggleStandardMessages()
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
closeEmojis() {
|
|
243
|
+
try {
|
|
244
|
+
this.$root.$refs[`etf-${this.textId}`].showEmojis ? this.$root.$refs[`etf-${this.textId}`].away() : ''
|
|
245
|
+
}catch(e) {
|
|
246
|
+
console.error("Nao foi possivel fechar os emojis")
|
|
247
|
+
console.error(e)
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
away() {
|
|
251
|
+
if(this.$refs[`${this.textId}-file`]) this.$refs[`${this.textId}-file`].openFiles = false
|
|
252
|
+
},
|
|
253
|
+
setDefaultMessage(msg) {
|
|
254
|
+
this.message = msg
|
|
255
|
+
this.sendFinalMessage()
|
|
256
|
+
},
|
|
257
|
+
insertEmoji(emoji) {
|
|
258
|
+
try {
|
|
259
|
+
if(!emoji) return
|
|
260
|
+
const textarea = document.querySelector(`#text-footer-${this.textId}`)
|
|
261
|
+
if (document.activeElement === textarea) {
|
|
262
|
+
const cursorStart = textarea.selectionStart
|
|
263
|
+
const cursorEnd = textarea.selectionEnd
|
|
264
|
+
if (cursorEnd == textarea.value.length) {
|
|
265
|
+
this.message += emoji.finalEmoji
|
|
266
|
+
textarea.setSelectionRange(textarea.value.length, textarea.value.length);
|
|
267
|
+
} else {
|
|
268
|
+
const initValue = textarea.value.slice(0, cursorStart) + emoji.finalEmoji;
|
|
269
|
+
const endValue = textarea.value.slice(cursorEnd)
|
|
270
|
+
this.message = initValue + endValue
|
|
271
|
+
textarea.setSelectionRange(initValue.length, initValue.length);
|
|
272
|
+
}
|
|
273
|
+
} else {
|
|
274
|
+
this.message += emoji.finalEmoji
|
|
275
|
+
}
|
|
276
|
+
this.sendFinalMessage()
|
|
277
|
+
}catch(e) {
|
|
278
|
+
console.error("Erro ao inserir emoji")
|
|
279
|
+
console.error(e)
|
|
280
|
+
}
|
|
281
|
+
},
|
|
282
|
+
verifyMessage() {
|
|
283
|
+
if(this.textareaSettings.maxCharacters && this.message) {
|
|
284
|
+
if(this.message.length > this.textareaSettings.maxCharacters) {
|
|
285
|
+
if (!document.querySelector(".toasted.toasted-primary.error")) this.$toasted.global.limiteCaracter()
|
|
286
|
+
return false
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
if((!this.message || !this.message.trim()) && !this.hasAnyFile && !this.audioFile) return false
|
|
291
|
+
|
|
292
|
+
if(this.textareaSettings.disabled) return false
|
|
293
|
+
|
|
294
|
+
if(this.fileFormatError && this.hasAnyFile) {
|
|
295
|
+
if (!document.querySelector(".toasted.toasted-primary.error")) this.$toasted.global.defaultError({ msg: this.dictionary.msg_formato_invalido })
|
|
296
|
+
const str = {
|
|
297
|
+
img: this.fileSettings.imagesExtensions.split("|").join(", "),
|
|
298
|
+
doc: this.fileSettings.docsExtensions.split("|").join(", ")
|
|
299
|
+
}
|
|
300
|
+
if (!document.querySelector(".toasted.toasted-primary.info")) this.$toasted.global.showValidFormats({ msg: `Imagens: ${str.img} - Documentos: ${str.doc} ${this.dictionary.msg_extensoes_aceitas}` })
|
|
301
|
+
return false
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
return true
|
|
305
|
+
},
|
|
306
|
+
removeHTMLElementsFromMessage(message) {
|
|
307
|
+
const regexTags = /<\/?[\d\w\s=\-:./'";]+>/gi
|
|
308
|
+
if(message.match(regexTags)) message = message.replace(regexTags, ' ')
|
|
309
|
+
return message
|
|
310
|
+
},
|
|
311
|
+
formatMessage(message) {
|
|
312
|
+
if(!message) return ""
|
|
313
|
+
message = message.trim()
|
|
314
|
+
message = message.replace(/\n$/, "", message)
|
|
315
|
+
message = returnMessageWithHexa(message)
|
|
316
|
+
message = this.removeHTMLElementsFromMessage(message)
|
|
317
|
+
return message
|
|
318
|
+
},
|
|
319
|
+
sendFinalMessage() {
|
|
320
|
+
const messageAux = this.formatMessage(this.message)
|
|
321
|
+
this.$emit("final-message", messageAux)
|
|
322
|
+
},
|
|
323
|
+
sendMessageHandler(event) {
|
|
324
|
+
this.sendMessage(event)
|
|
325
|
+
},
|
|
326
|
+
sendMessage(event) {
|
|
327
|
+
if(this.isSending) return
|
|
328
|
+
|
|
329
|
+
if(this.isMainChat && event){
|
|
330
|
+
if(this.textareaSettings.sendOnEnter){
|
|
331
|
+
if(event.keyCode == 13 && !event.shiftKey) event.preventDefault()
|
|
332
|
+
if(event.shiftKey) return
|
|
333
|
+
}else{
|
|
334
|
+
if(event.keyCode == 13) {
|
|
335
|
+
if(!event.shiftKey) return
|
|
336
|
+
event.preventDefault()
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
if(!this.buttons.hasSendButton) return
|
|
342
|
+
|
|
343
|
+
const messageAux = this.formatMessage(this.message)
|
|
344
|
+
if(this.verifyMessage()){
|
|
345
|
+
if(messageAux || this.hasAnyFile || this.audioFile) {
|
|
346
|
+
this.$emit("send-message", messageAux)
|
|
347
|
+
const objMessage = this.returnObjectMessage(messageAux)
|
|
348
|
+
this.$emit("obj-message", objMessage)
|
|
349
|
+
|
|
350
|
+
if(this.$refs[`emoji-text-${this.textId}`] && this.$refs[`emoji-text-${this.textId}`].showEmojis) this.$refs[`emoji-text-${this.textId}`].toggleEmojiSelection()
|
|
351
|
+
|
|
352
|
+
this.resetFooterData()
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
},
|
|
356
|
+
focusTextarea() {
|
|
357
|
+
const textarea = document.querySelector(`#text-footer-${this.textId}`)
|
|
358
|
+
if(textarea) textarea.focus()
|
|
359
|
+
},
|
|
360
|
+
resetFooterData() {
|
|
361
|
+
if(this.audioFile) this.deleteAudio()
|
|
362
|
+
if(this.hasAnyFile) this.$refs[`${this.textId}-file`].deleteFile()
|
|
363
|
+
this.message = ""
|
|
364
|
+
this.sendFinalMessage()
|
|
365
|
+
resetTargets(this.$el, ".js-autoresize", ".js-parentresize", "38px")
|
|
366
|
+
this.focusTextarea()
|
|
367
|
+
},
|
|
368
|
+
returnObjectMessage(message) {
|
|
369
|
+
return {
|
|
370
|
+
message,
|
|
371
|
+
attachment: this.hasAnyFile ? this.file : false,
|
|
372
|
+
isDoc: this.isDoc,
|
|
373
|
+
imagePreview: this.imagePreview,
|
|
374
|
+
isAudio: this.audioFile ? true : false,
|
|
375
|
+
audioAttachment: this.audioSource
|
|
376
|
+
}
|
|
377
|
+
},
|
|
378
|
+
setFileVars(fileObj) {
|
|
379
|
+
const { file, imagePreview, isDoc, fileFormatError, hasAnyFile } = fileObj;
|
|
380
|
+
|
|
381
|
+
this.file = file
|
|
382
|
+
this.imagePreview = imagePreview ? imagePreview : ""
|
|
383
|
+
this.isDoc = isDoc
|
|
384
|
+
this.fileFormatError = fileFormatError
|
|
385
|
+
this.hasAnyFile = hasAnyFile
|
|
386
|
+
|
|
387
|
+
this.$emit("set-file-vars", fileObj)
|
|
388
|
+
},
|
|
389
|
+
openImage(imagePreview) {
|
|
390
|
+
this.$emit("open-image", imagePreview)
|
|
391
|
+
},
|
|
392
|
+
openFileSystem() {
|
|
393
|
+
this.$emit("open-file-system")
|
|
394
|
+
},
|
|
395
|
+
resetFileSystem() {
|
|
396
|
+
this.$emit("reset-file-system")
|
|
397
|
+
},
|
|
398
|
+
setAudio(audioObj) {
|
|
399
|
+
const { audioFile, audioSource } = audioObj
|
|
400
|
+
this.audioFile = audioFile
|
|
401
|
+
this.audioSource = audioSource
|
|
402
|
+
},
|
|
403
|
+
deleteAudio() {
|
|
404
|
+
this.$refs[`${this.textId}-mic`].deleteMediaRecorder()
|
|
405
|
+
this.audioFile = ""
|
|
406
|
+
this.audioSource = ""
|
|
407
|
+
},
|
|
408
|
+
returnFileType(file, stopAlert) {
|
|
409
|
+
if(!this.fileSettings.imagesExtensions && !this.fileSettings.docsExtensions) return false
|
|
410
|
+
const imgRegex = new RegExp("\.("+this.fileSettings.imagesExtensions+")", "i")
|
|
411
|
+
if(imgRegex.test(file.name)) return "img"
|
|
412
|
+
|
|
413
|
+
const docRegex = new RegExp("\.("+this.fileSettings.docsExtensions+")", "i")
|
|
414
|
+
if(docRegex.test(file.name)) return "doc"
|
|
415
|
+
|
|
416
|
+
if(!stopAlert) return false
|
|
417
|
+
if (!document.querySelector(".toasted.toasted-primary.error")) this.$toasted.global.defaultError({ msg: this.dictionary.msg_formato_invalido })
|
|
418
|
+
const str = {
|
|
419
|
+
img: this.fileSettings.imagesExtensions.split("|").join(", "),
|
|
420
|
+
doc: this.fileSettings.docsExtensions.split("|").join(", ")
|
|
421
|
+
}
|
|
422
|
+
if (!document.querySelector(".toasted.toasted-primary.info")) this.$toasted.global.showValidFormats({ msg: `Imagens: ${str.img} - Documentos: ${str.doc} ${this.dictionary.msg_extensoes_aceitas}` })
|
|
423
|
+
return false
|
|
424
|
+
},
|
|
425
|
+
filesHandler(files) {
|
|
426
|
+
if(!Array.isArray(files)) files = Array.from(files)
|
|
427
|
+
const fileType = this.returnFileType(files[0], true)
|
|
428
|
+
let invalidFile = false
|
|
429
|
+
try {
|
|
430
|
+
files.forEach(file => {
|
|
431
|
+
const singleFileType = this.returnFileType(file, true)
|
|
432
|
+
if(!singleFileType) {
|
|
433
|
+
invalidFile = true
|
|
434
|
+
file.invalid = true
|
|
435
|
+
}
|
|
436
|
+
file.imgOrDoc = singleFileType ? singleFileType : ""
|
|
437
|
+
})
|
|
438
|
+
}catch(e) {
|
|
439
|
+
console.error("Erro ao tentar percorrer os arquivos")
|
|
440
|
+
console.error(e)
|
|
441
|
+
invalidFile = true
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
if(!invalidFile) {
|
|
445
|
+
this.$refs[`${this.textId}-file`].fileUpload(files, fileType, true)
|
|
446
|
+
}else {
|
|
447
|
+
if (!document.querySelector(".toasted.toasted-primary.error")) this.$toasted.global.defaultError({ msg: this.dictionary.msg_formato_invalido })
|
|
448
|
+
const str = {
|
|
449
|
+
img: this.fileSettings.imagesExtensions.split("|").join(", "),
|
|
450
|
+
doc: this.fileSettings.docsExtensions.split("|").join(", ")
|
|
451
|
+
}
|
|
452
|
+
if (!document.querySelector(".toasted.toasted-primary.info")) this.$toasted.global.showValidFormats({ msg: `Imagens: ${str.img} - Documentos: ${str.doc} ${this.dictionary.msg_extensoes_aceitas}` })
|
|
453
|
+
}
|
|
454
|
+
},
|
|
455
|
+
dropFile(e) {
|
|
456
|
+
try {
|
|
457
|
+
e.stopPropagation()
|
|
458
|
+
e.preventDefault()
|
|
459
|
+
if(!this.buttons.hasFiles || this.fileSettings.handleFileClick) return false
|
|
460
|
+
const files = e.dataTransfer.files.length ? e.dataTransfer.files : ""
|
|
461
|
+
this.filesHandler(files)
|
|
462
|
+
}catch(e) {
|
|
463
|
+
console.error("Erro drop file")
|
|
464
|
+
console.error(e)
|
|
465
|
+
}
|
|
466
|
+
},
|
|
467
|
+
pasteImage(e) {
|
|
468
|
+
try {
|
|
469
|
+
if(e.clipboardData.files.length && !this.buttons.hasFiles) {
|
|
470
|
+
e.preventDefault()
|
|
471
|
+
return
|
|
472
|
+
}else if(e.clipboardData.files.length && this.buttons.hasFiles) {
|
|
473
|
+
const files = e.clipboardData.files
|
|
474
|
+
this.filesHandler(files)
|
|
475
|
+
}
|
|
476
|
+
}catch(e) {
|
|
477
|
+
console.error("Nao foi possivel colar a/o imagem/documento")
|
|
478
|
+
console.error(e)
|
|
479
|
+
}
|
|
480
|
+
},
|
|
481
|
+
handleScreenShare() {
|
|
482
|
+
this.$emit("handle-screen-share")
|
|
483
|
+
},
|
|
484
|
+
toggleStandardMessages() {
|
|
485
|
+
this.showStandardMessages = !this.showStandardMessages
|
|
486
|
+
},
|
|
487
|
+
openBlockerStandardMessage() {
|
|
488
|
+
this.$emit("open-blocker-standard-message")
|
|
489
|
+
},
|
|
490
|
+
closeBlockerStandardMessage() {
|
|
491
|
+
this.$emit("close-blocker-standard-message")
|
|
492
|
+
},
|
|
493
|
+
setMessageType(type) {
|
|
494
|
+
this.messageType = type
|
|
495
|
+
},
|
|
496
|
+
setStandardInfos(infos) {
|
|
497
|
+
this.$emit("set-standard-infos", infos)
|
|
498
|
+
},
|
|
499
|
+
addStandardMessage(message) {
|
|
500
|
+
this.message = message
|
|
501
|
+
this.sendFinalMessage()
|
|
502
|
+
},
|
|
503
|
+
closeStandardMessages() {
|
|
504
|
+
this.showStandardMessages = false
|
|
505
|
+
}
|
|
506
|
+
},
|
|
507
|
+
destroyed() {
|
|
508
|
+
// this.$root.$off("drop-file")
|
|
509
|
+
// this.$root.$off("toggle-msg-formatada")
|
|
510
|
+
// this.$root.$off("textarea-focus")
|
|
511
|
+
// this.$root.$off("clear-footer-message")
|
|
512
|
+
// this.$root.$off("resize-footer-template")
|
|
513
|
+
|
|
514
|
+
window.removeEventListener("message", this.listenerPostMessage)
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
</script>
|
|
518
|
+
|
|
519
|
+
<style>
|
|
520
|
+
.toasted svg {
|
|
521
|
+
margin-right: 10px; }
|
|
522
|
+
|
|
523
|
+
.d-none {
|
|
524
|
+
display: none; }
|
|
525
|
+
|
|
526
|
+
ul {
|
|
527
|
+
list-style-type: none; }
|
|
528
|
+
|
|
529
|
+
.text-footer-container {
|
|
530
|
+
display: flex;
|
|
531
|
+
justify-content: center;
|
|
532
|
+
align-items: center;
|
|
533
|
+
flex-direction: column;
|
|
534
|
+
width: 100%;
|
|
535
|
+
position: relative; }
|
|
536
|
+
.text-footer-container .text-footer {
|
|
537
|
+
min-height: 48px;
|
|
538
|
+
box-shadow: 0px 3px 7px -2px rgba(0, 0, 0, 0.45);
|
|
539
|
+
position: relative;
|
|
540
|
+
display: flex;
|
|
541
|
+
justify-content: center;
|
|
542
|
+
align-items: center;
|
|
543
|
+
border: 1px solid #ccc;
|
|
544
|
+
padding: 5px 2px 5px 5px;
|
|
545
|
+
border-radius: 5px; }
|
|
546
|
+
.text-footer-container .text-footer.full {
|
|
547
|
+
width: 100%; }
|
|
548
|
+
.text-footer-container .text-footer.almostFull {
|
|
549
|
+
width: 95%; }
|
|
550
|
+
.text-footer-container .text-footer.medium {
|
|
551
|
+
width: 75%; }
|
|
552
|
+
.text-footer-container.bigger .text-footer {
|
|
553
|
+
height: 80px;
|
|
554
|
+
}
|
|
555
|
+
.text-footer-container.bigger .text-footer > textarea {
|
|
556
|
+
font-size: .875rem;
|
|
557
|
+
height: 75px;
|
|
558
|
+
max-height: 75px;
|
|
559
|
+
min-height: 75px;
|
|
560
|
+
}
|
|
561
|
+
.text-footer-container textarea {
|
|
562
|
+
margin: 0 5px;
|
|
563
|
+
border: unset;
|
|
564
|
+
flex: 1;
|
|
565
|
+
resize: none;
|
|
566
|
+
min-height: 30px;
|
|
567
|
+
max-height: 60px;
|
|
568
|
+
font-size: .875rem;
|
|
569
|
+
font-family: inherit;
|
|
570
|
+
background: inherit; }
|
|
571
|
+
.text-footer-container textarea:focus {
|
|
572
|
+
outline: unset; }
|
|
573
|
+
.text-footer-container textarea::placeholder {
|
|
574
|
+
font-size: .75rem;
|
|
575
|
+
}
|
|
576
|
+
.text-footer-container .text-footer-audio {
|
|
577
|
+
flex: 1;
|
|
578
|
+
display: flex;
|
|
579
|
+
justify-content: center;
|
|
580
|
+
align-items: center; }
|
|
581
|
+
.text-footer-container audio {
|
|
582
|
+
flex: 1;
|
|
583
|
+
outline: unset;
|
|
584
|
+
width: auto;
|
|
585
|
+
height: 38px; }
|
|
586
|
+
.text-footer-container .delete-audio {
|
|
587
|
+
display: flex;
|
|
588
|
+
justify-content: center;
|
|
589
|
+
align-items: center;
|
|
590
|
+
color: #E74C3C;
|
|
591
|
+
transition: background 300ms;
|
|
592
|
+
border-radius: 50%;
|
|
593
|
+
font-size: 1rem;
|
|
594
|
+
padding: 10px;
|
|
595
|
+
cursor: pointer;
|
|
596
|
+
margin: 0 5px;
|
|
597
|
+
width: 31px;
|
|
598
|
+
height: 31px; }
|
|
599
|
+
.text-footer-container .delete-audio:hover {
|
|
600
|
+
background-color: rgba(208, 0, 0, 0.2); }
|
|
601
|
+
.text-footer-container .max-characters {
|
|
602
|
+
font-size: .575rem;
|
|
603
|
+
z-index: 1;
|
|
604
|
+
color: #444;
|
|
605
|
+
position: relative;
|
|
606
|
+
top: 30px;
|
|
607
|
+
left: -30px; }
|
|
608
|
+
.text-footer-container .max-characters.no-width {
|
|
609
|
+
width: 0; }
|
|
610
|
+
.text-footer-container .text-footer-actions {
|
|
611
|
+
display: flex; }
|
|
612
|
+
.text-footer-container .text-footer-actions.outside-buttons {
|
|
613
|
+
display: flex;
|
|
614
|
+
align-items: center;
|
|
615
|
+
justify-content: flex-end;
|
|
616
|
+
position: absolute;
|
|
617
|
+
top: -30px;
|
|
618
|
+
right: 35px;
|
|
619
|
+
background-color: #FAFAFA;
|
|
620
|
+
}
|
|
621
|
+
.text-footer-container .text-footer-actions .text-footer-actions--btn {
|
|
622
|
+
display: flex;
|
|
623
|
+
justify-content: center;
|
|
624
|
+
align-items: center;
|
|
625
|
+
color: #777;
|
|
626
|
+
border-radius: 50%;
|
|
627
|
+
transition: background 300ms;
|
|
628
|
+
padding: 10px;
|
|
629
|
+
font-size: 1rem;
|
|
630
|
+
width: 36px;
|
|
631
|
+
height: 36px;
|
|
632
|
+
cursor: pointer;
|
|
633
|
+
margin-right: 2.5px; }
|
|
634
|
+
.text-footer-container .text-footer-actions .text-footer-actions--btn:last-child {
|
|
635
|
+
margin-right: unset; }
|
|
636
|
+
.text-footer-container .text-footer-actions .text-footer-actions--btn:hover {
|
|
637
|
+
background-color: rgba(0, 0, 0, 0.1); }
|
|
638
|
+
.text-footer-container .text-footer-actions .text-footer-actions--btn.files-activated {
|
|
639
|
+
background-color: rgba(0, 0, 0, 0.1); }
|
|
640
|
+
.text-footer-container .text-footer-actions .text-footer-actions--btn.audio-activated {
|
|
641
|
+
background-color: rgba(208, 0, 0, 0.7);
|
|
642
|
+
color: #fff; }
|
|
643
|
+
.text-footer-container .text-footer-actions .text-footer-actions--btn.left-button {
|
|
644
|
+
position: absolute;
|
|
645
|
+
left: 0; }
|
|
646
|
+
.text-footer-container .text-footer-hsm-container {
|
|
647
|
+
margin: 12px 0 7px 0; }
|
|
648
|
+
.text-footer-container .text-footer-hsm-container.full {
|
|
649
|
+
width: 100%; }
|
|
650
|
+
.text-footer-container .text-footer-hsm-container.almostFull {
|
|
651
|
+
width: 95%; }
|
|
652
|
+
.text-footer-container .text-footer-hsm-container.medium {
|
|
653
|
+
width: 75%; }
|
|
654
|
+
.text-footer-container .text-footer-hsm-container .text-footer-v-select {
|
|
655
|
+
border-radius: 5px;
|
|
656
|
+
margin-bottom: 5px; }
|
|
657
|
+
.text-footer-container .text-footer-hsm-container .text-footer-select-03 {
|
|
658
|
+
display: flex;
|
|
659
|
+
align-items: center;
|
|
660
|
+
flex: 1;
|
|
661
|
+
width: 100%; }
|
|
662
|
+
.text-footer-container .text-footer-hsm-container .text-footer-select-03 .text-footer-v-select {
|
|
663
|
+
flex: 1; }
|
|
664
|
+
.text-footer-container .text-footer-hsm-container .text-footer-select-03 .text-footer--btn-select-03 {
|
|
665
|
+
transition-duration: 300ms;
|
|
666
|
+
user-select: none;
|
|
667
|
+
cursor: pointer;
|
|
668
|
+
box-shadow: inset 0 -3px rgba(0, 0, 0, 0.2);
|
|
669
|
+
opacity: 0.9;
|
|
670
|
+
border-radius: 2.5px;
|
|
671
|
+
display: flex;
|
|
672
|
+
justify-content: center;
|
|
673
|
+
align-items: center;
|
|
674
|
+
margin-left: 5px;
|
|
675
|
+
margin-bottom: 5px;
|
|
676
|
+
background-color: #F7FE72;
|
|
677
|
+
width: 32px;
|
|
678
|
+
height: 32px; }
|
|
679
|
+
.text-footer-container .text-footer-hsm-container .text-footer-select-03 .text-footer--btn-select-03:hover {
|
|
680
|
+
opacity: 1; }
|
|
681
|
+
.text-footer-container .text-footer-hsm-container .text-footer-select-03 .text-footer--btn-select-03:active {
|
|
682
|
+
opacity: 1;
|
|
683
|
+
box-shadow: inset 0 -1px rgba(0, 0, 0, 0.2);
|
|
684
|
+
-webkit-transform: translateY(1px);
|
|
685
|
+
-moz-transform: translateY(1px);
|
|
686
|
+
-o-transform: translateY(1px);
|
|
687
|
+
-ms-transform: translateY(1px);
|
|
688
|
+
transform: translateY(1px); }
|
|
689
|
+
.text-footer-container .text-footer-hsm-container .text-footer-select-03 .text-footer--btn-select-03 svg {
|
|
690
|
+
font-size: 1rem; }
|
|
691
|
+
.text-footer-container .text-footer-files-container {
|
|
692
|
+
position: absolute;
|
|
693
|
+
right: 0;
|
|
694
|
+
top: -55px;
|
|
695
|
+
padding: 5px;
|
|
696
|
+
background-color: rgba(0, 0, 0, 0.4);
|
|
697
|
+
border-radius: 5px;
|
|
698
|
+
display: flex;
|
|
699
|
+
align-items: center;
|
|
700
|
+
justify-content: space-between;
|
|
701
|
+
z-index: 1; }
|
|
702
|
+
.text-footer-container .text-footer-files-container.horizontal {
|
|
703
|
+
right: -55px;
|
|
704
|
+
flex-direction: column; }
|
|
705
|
+
.text-footer-container .text-footer-files-container .files-btn {
|
|
706
|
+
transition-duration: 300ms;
|
|
707
|
+
transition-property: opacity;
|
|
708
|
+
opacity: .8;
|
|
709
|
+
cursor: pointer;
|
|
710
|
+
display: flex;
|
|
711
|
+
justify-content: center;
|
|
712
|
+
align-items: center;
|
|
713
|
+
border-radius: 10px;
|
|
714
|
+
padding: 3px;
|
|
715
|
+
width: 40px;
|
|
716
|
+
height: 40px;
|
|
717
|
+
font-size: 1rem;
|
|
718
|
+
color: #FFF; }
|
|
719
|
+
.text-footer-container .text-footer-files-container .files-btn:hover {
|
|
720
|
+
opacity: 1; }
|
|
721
|
+
.text-footer-container .text-footer-files-container .files-btn svg {
|
|
722
|
+
color: #FFF; }
|
|
723
|
+
.text-footer-container .text-footer-files-container .files-btn.images {
|
|
724
|
+
background-color: #9575cd;
|
|
725
|
+
margin-right: 5px; }
|
|
726
|
+
.text-footer-container .text-footer-files-container .files-btn.images.margin-bottom {
|
|
727
|
+
margin-right: unset;
|
|
728
|
+
margin-bottom: 5px; }
|
|
729
|
+
.text-footer-container .text-footer-files-container .files-btn.docs {
|
|
730
|
+
background-color: #7986cb; }
|
|
731
|
+
.text-footer-container .text-footer-files-container .files-btn.system {
|
|
732
|
+
background-color: #49a349;
|
|
733
|
+
margin-left: 5px }
|
|
734
|
+
.text-footer-container .text-footer-files-container .files-btn.both {
|
|
735
|
+
font-size: .95rem;
|
|
736
|
+
background-color: rgb(85, 85, 236);
|
|
737
|
+
flex-direction: column;
|
|
738
|
+
}
|
|
739
|
+
.text-footer-container .text-footer-files-container .files-btn.both svg:nth-child(1) {
|
|
740
|
+
transform: translateX(5px)
|
|
741
|
+
}
|
|
742
|
+
.text-footer-container .text-footer-files-container .files-btn.both svg:nth-child(2) {
|
|
743
|
+
transform: translateX(-5px)
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
.text-footer-container .text-footer-preview-container {
|
|
747
|
+
width: 100%;
|
|
748
|
+
cursor: default;
|
|
749
|
+
position: absolute;
|
|
750
|
+
left: 0;
|
|
751
|
+
background-color: #F1f1f1;
|
|
752
|
+
border: 2px solid #CCC;
|
|
753
|
+
border-bottom: unset;
|
|
754
|
+
border-top-left-radius: 2.5px;
|
|
755
|
+
border-top-right-radius: 2.5px; }
|
|
756
|
+
.text-footer-container .text-footer-preview-container.isDoc {
|
|
757
|
+
top: -50px;
|
|
758
|
+
width: 100%;
|
|
759
|
+
height: 45px; }
|
|
760
|
+
.text-footer-container .text-footer-preview-container.isImg, .text-footer-container .text-footer-preview-container.isMultiple {
|
|
761
|
+
top: -205px;
|
|
762
|
+
width: 100%;
|
|
763
|
+
height: 200px; }
|
|
764
|
+
.text-footer-container .text-footer-preview-container.isImg .text-footer-image-preview {
|
|
765
|
+
height: 170px; }
|
|
766
|
+
.text-footer-container .text-footer-preview-container.isError {
|
|
767
|
+
top: -80px;
|
|
768
|
+
width: 100%;
|
|
769
|
+
height: 75px; }
|
|
770
|
+
|
|
771
|
+
.text-footer-container .text-footer-alt {
|
|
772
|
+
margin-top: -12px;
|
|
773
|
+
width: 100%;
|
|
774
|
+
padding: 0 10px; }
|
|
775
|
+
.text-footer-container .text-footer-alt .text-footer-out-session {
|
|
776
|
+
margin-top: 12px; }
|
|
777
|
+
.text-footer-container .text-footer-alt .text-footer-sem-24h {
|
|
778
|
+
font-size: .8rem;
|
|
779
|
+
text-align: right;
|
|
780
|
+
font-weight: 600;
|
|
781
|
+
letter-spacing: -0.5px;
|
|
782
|
+
color: #dd7f0c;
|
|
783
|
+
margin-top: 5px;
|
|
784
|
+
position: absolute;
|
|
785
|
+
right: 0; }
|
|
786
|
+
.text-footer-container .text-footer-alt .sem-templates {
|
|
787
|
+
margin-top: 10px;
|
|
788
|
+
font-size: .8rem;
|
|
789
|
+
text-align: right;
|
|
790
|
+
font-weight: 600;
|
|
791
|
+
letter-spacing: -0.5px;
|
|
792
|
+
color: #921e12; }
|
|
793
|
+
.text-footer-container .text-footer-alt .text-footer-templates {
|
|
794
|
+
position: relative;
|
|
795
|
+
width: 100%; }
|
|
796
|
+
.text-footer-container .text-footer-alt .text-footer-templates .text-footer-group-selection {
|
|
797
|
+
width: 100%;
|
|
798
|
+
display: flex;
|
|
799
|
+
align-items: center; }
|
|
800
|
+
.text-footer-container .text-footer-alt .text-footer-templates .text-footer-group-selection h4 {
|
|
801
|
+
margin-right: 5px; }
|
|
802
|
+
.text-footer-container .text-footer-alt .text-footer-templates .text-footer-group-selection .sm__select {
|
|
803
|
+
flex: 1; }
|
|
804
|
+
|
|
805
|
+
.vs__dropdown-menu {
|
|
806
|
+
font-size: 0.85rem !important; }
|
|
807
|
+
|
|
808
|
+
.emoji-mart-anchor, .emoji-mart-emoji span {
|
|
809
|
+
cursor: pointer !important; }
|
|
810
|
+
|
|
811
|
+
.emoji-mart {
|
|
812
|
+
z-index: 2 !important; }
|
|
813
|
+
|
|
814
|
+
.emoji-mart-scroll {
|
|
815
|
+
overflow-x: hidden; }
|
|
816
|
+
|
|
817
|
+
</style>
|