blob: 9376cbec422ccf35a6a701ccd87240be2c768242 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
<script>
import { marked } from 'marked';
import DOMPurify from 'dompurify';
export let at;
export let body;
$: renderedBody = DOMPurify.sanitize(marked.parse(body));
let scroll = (message) => {
message.scrollIntoView();
};
</script>
<div class="message relative">
<span class="timestamp chip variant-soft absolute top-0 right-0">{at}</span>
<section use:scroll class="py-1 message-body">
{@html renderedBody}
</section>
</div>
<style>
.message .timestamp {
display: none;
}
.message:hover .timestamp {
display: flex;
}
.message-body:empty:after {
content: '.';
visibility: hidden;
}
</style>
|