markdown + reactons + emoji picker (needs bug fixes everywhere)

This commit is contained in:
Zoe
2023-01-18 00:37:47 -06:00
parent 1cba5ea335
commit 3cdf7758eb
13 changed files with 460 additions and 177 deletions

View File

@@ -1,5 +1,5 @@
<template>
<MessagePane :server="server" />
<MessagePane />
</template>
<script lang="ts">
@@ -22,23 +22,8 @@ export default {
if (typeof route.params.id !== 'string') throw new Error('route.params.id must be a string, but got an array presumably?')
useGlobalStore().setActiveServer('dms', route.params.id);
function parseBody(body: string) {
const mentions = body.match(/<@([a-z]|[0-9]){25}>/g);
if (mentions) {
mentions.forEach((e: string) => {
if (!e) return
const id = e.split('<@')[1]?.split('>')[0];
if (!id) return;
const user = server.dmParticipants?.find((e) => e.id === id)
if (!user) return;
body = body.split(e).join(`@${user.username}`)
});
}
return body
}
server.messages?.forEach((e) => {
e.body = parseBody(e.body)
e.body = parseMessageBody(e.body, useGlobalStore().activeChannel)
})
useGlobalStore().setActiveChannel(server)

View File

@@ -1,5 +1,5 @@
<template>
<MessagePane :server="server" />
<MessagePane />
</template>
<script lang="ts">
@@ -49,23 +49,8 @@ export default {
if (typeof route.params.id !== 'string') throw new Error('route.params.id must be a string, but got an array presumiably?')
useGlobalStore().setActiveServer('servers', route.params.id)
function parseBody(body: string) {
const mentions = body.match(/<@([a-z]|[0-9]){25}>/g);
if (mentions) {
mentions.forEach((e: string) => {
if (!e) return
const id = e.split('<@')[1]?.split('>')[0];
if (!id) return;
const user = realServer?.participants.find((e) => e.id === id)
if (!user) return;
body = body.split(e).join(`@${user.username}`)
});
}
return body
}
server.messages?.forEach((e) => {
e.body = parseBody(e.body)
e.body = parseMessageBody(e.body, useGlobalStore().activeChannel)
})
useGlobalStore().setActiveChannel(server)

View File

@@ -1,21 +1,14 @@
<script setup lang="ts">
import { io } from 'socket.io-client'
const connected = ref(false)
onMounted(() => {
const socket = io();
socket.on('connect', () => {
connected.value = socket.connected
});
socket.on('disconnect', () => {
connected.value = socket.connected
});
})
</script>
<template>
<div>Connected: {{ connected }}</div>
</template>
<span class="test"></span>
</template>
<style>
.test {
background: url(/32.png);
width: 16px;
height: 16px;
display: inline-block;
background-position: -544px -510px;
background-size: 6480% 6480%;
}
</style>