add fileInput, refactor eventContent
parent
fb707fcde3
commit
cce7af2178
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#FFFFFF"><path d="M0 0h24v24H0z" fill="none"/><path d="M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5c0-1.38 1.12-2.5 2.5-2.5s2.5 1.12 2.5 2.5v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5c0 1.38 1.12 2.5 2.5 2.5s2.5-1.12 2.5-2.5V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6h-1.5z"/></svg>
|
After Width: | Height: | Size: 409 B |
@ -0,0 +1,91 @@
|
||||
<template>
|
||||
<div v-if="content.msgtype==='m.text'" v-html="parseMessage(content.body)"/>
|
||||
<div v-else-if="content.msgtype==='m.notice'" class="notice" v-html="parseMessage(content.body)"/>
|
||||
<div v-else-if="content.msgtype==='m.image'" class="image">
|
||||
<img :src="getSource(content.url)" :alt="content.body"/><br>
|
||||
{{content.body}}
|
||||
</div>
|
||||
<div v-else-if="content.msgtype==='m.file'" class="file">
|
||||
<icon
|
||||
title="file"
|
||||
ic="./sym/ic_attach_file_white.svg"
|
||||
/>
|
||||
<div class="text">
|
||||
<a :href="getSource(content.url)">
|
||||
{{content.filename || getSource(content.url)}}
|
||||
</a><br>{{content.body}}
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="content.msgtype==='m.audio'" class="audio">
|
||||
<audio controls>
|
||||
<source :src="getSource(content.url)" :type="content.mimetype">
|
||||
your browser doesn't support audio
|
||||
</audio><br>
|
||||
{{content.body}}
|
||||
</div>
|
||||
<div v-else-if="content.msgtype==='m.video'" class="video">
|
||||
<video controls>
|
||||
<source :src="getSource(content.url)" :type="content.mimetype">
|
||||
your browser doesn't support video
|
||||
</video><br>
|
||||
{{content.body}}
|
||||
</div>
|
||||
<div v-else class="italic">unsupported message type {{content.msgtype}}</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getMediaUrl} from '@/lib/getMxc';
|
||||
import {parseMessage} from '@/lib/eventUtils';
|
||||
import Icon from '@/components/icon';
|
||||
|
||||
export default {
|
||||
name: 'eventContent',
|
||||
components: {Icon},
|
||||
props: {
|
||||
content: Object
|
||||
},
|
||||
methods: {
|
||||
getSource(url){
|
||||
return url.includes('mxc')?getMediaUrl(url):url;
|
||||
},
|
||||
parseMessage
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.file{
|
||||
.text{
|
||||
position: relative;
|
||||
left: 4rem;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
.image{
|
||||
width: 100%;
|
||||
img{
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
max-height: 35rem;
|
||||
border-radius: 0.5rem;
|
||||
}
|
||||
}
|
||||
.video{
|
||||
width: 100%;
|
||||
video{
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
max-height: 35rem;
|
||||
border-radius: 0.5rem;
|
||||
}
|
||||
}
|
||||
.audio{
|
||||
audio{
|
||||
max-width: 100%;
|
||||
}
|
||||
}
|
||||
.italic{
|
||||
font-style: italic;
|
||||
}
|
||||
</style>
|
Loading…
Reference in New Issue