Add scroll to bottom on chat
Some checks failed
Deploy with Docker Compose / deploy (push) Has been cancelled
Some checks failed
Deploy with Docker Compose / deploy (push) Has been cancelled
This commit is contained in:
@@ -67,22 +67,46 @@ onUnmounted(() => {
|
|||||||
<p v-for="message in messages" :key="message.id">
|
<p v-for="message in messages" :key="message.id">
|
||||||
<span class="text-tertiary">{{ message.authorId }}:</span>
|
<span class="text-tertiary">{{ message.authorId }}:</span>
|
||||||
{{ message.text }}
|
{{ message.text }}
|
||||||
<template v-if="message.fileUrl && isSafeFileUrl(message.fileUrl)">
|
<template
|
||||||
<img v-if="isImageUrl(message.fileUrl)" :src="message.fileUrl"
|
v-if="message.fileUrl && isSafeFileUrl(message.fileUrl)"
|
||||||
class="max-w-xs max-h-48 rounded" />
|
>
|
||||||
<video v-else-if="isVideoUrl(message.fileUrl)" :src="message.fileUrl"
|
<img
|
||||||
controls class="max-w-xs max-h-48 rounded" />
|
v-if="isImageUrl(message.fileUrl)"
|
||||||
<a v-else :href="message.fileUrl" target="_blank"
|
:src="message.fileUrl"
|
||||||
class="underline">{{ message.fileUrl.split('/').pop() }}</a>
|
class="max-w-xs max-h-48 rounded"
|
||||||
|
/>
|
||||||
|
<video
|
||||||
|
v-else-if="isVideoUrl(message.fileUrl)"
|
||||||
|
:src="message.fileUrl"
|
||||||
|
controls
|
||||||
|
class="max-w-xs max-h-48 rounded"
|
||||||
|
/>
|
||||||
|
<a
|
||||||
|
v-else
|
||||||
|
:href="message.fileUrl"
|
||||||
|
target="_blank"
|
||||||
|
class="underline"
|
||||||
|
>{{ message.fileUrl.split("/").pop() }}</a
|
||||||
|
>
|
||||||
</template>
|
</template>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<input v-model="messageInput" @keyup.enter="sendMessage" />
|
<input v-model="messageInput" @keyup.enter="sendMessage" />
|
||||||
<input ref="fileInput" type="file" class="hidden"
|
<input
|
||||||
@change="onFileSelected" />
|
ref="fileInput"
|
||||||
<div class="flex gap-2">
|
type="file"
|
||||||
|
class="hidden"
|
||||||
|
@change="onFileSelected"
|
||||||
|
/>
|
||||||
|
<div class="flex justify-between">
|
||||||
<Button @click="sendMessage">Send</Button>
|
<Button @click="sendMessage">Send</Button>
|
||||||
<Button v-if="authStore.user.admin" @click="fileInput.click()">Attach</Button>
|
<Button v-if="authStore.user.admin" @click="fileInput.click()"
|
||||||
|
>Attach</Button
|
||||||
|
>
|
||||||
|
<div class="flex gap-2">
|
||||||
|
<Button @click="fileInput.click()">Attach</Button>
|
||||||
|
<Button @click="scrollToBottom">To Bottom</Button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Reference in New Issue
Block a user