i think i finally fixed the state management awfulness
This commit is contained in:
parent
6953b49563
commit
40be540527
18 changed files with 402 additions and 417 deletions
|
@ -1,4 +1,4 @@
|
|||
import { Client } from './client/client.js';
|
||||
import { client } from './client/client.js';
|
||||
import { get } from 'svelte/store';
|
||||
|
||||
export const EMOJI_REGEX = /:[\w\-.]{0,32}@[\w\-.]{0,32}:/g;
|
||||
|
@ -33,7 +33,7 @@ export function parseText(text, host) {
|
|||
let length = text.substring(index + 1).search(':');
|
||||
if (length <= 0) return text;
|
||||
let emoji_name = text.substring(index + 1, index + length + 1);
|
||||
let emoji = get(Client.get()).getEmoji(emoji_name + '@' + host);
|
||||
let emoji = get(client).getEmoji(emoji_name + '@' + host);
|
||||
|
||||
if (emoji) {
|
||||
return text.substring(0, index) + emoji.html +
|
||||
|
@ -46,7 +46,7 @@ export function parseText(text, host) {
|
|||
export function parseOne(emoji_id) {
|
||||
if (emoji_id == '❤') return '❤️'; // stupid heart unicode
|
||||
if (EMOJI_REGEX.exec(':' + emoji_id + ':')) return emoji_id;
|
||||
let cached_emoji = get(Client.get()).getEmoji(emoji_id);
|
||||
let cached_emoji = get(client).getEmoji(emoji_id);
|
||||
if (!cached_emoji) return emoji_id;
|
||||
return cached_emoji.html;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue