diff --git a/apps/client/src/lib/components/ChatArea.svelte b/apps/client/src/lib/components/ChatArea.svelte index 99f3164..d21f285 100644 --- a/apps/client/src/lib/components/ChatArea.svelte +++ b/apps/client/src/lib/components/ChatArea.svelte @@ -27,9 +27,9 @@ }); function handleKeydown(event: KeyboardEvent) { - if (event.key === Key.Space) { - messageInputEl.focus(); - } + // if (event.key === Key.Space) { + // messageInputEl.focus(); + // } } async function handleMessageSend(event: CustomEvent) { diff --git a/apps/client/src/lib/components/TipTap.svelte b/apps/client/src/lib/components/TipTap.svelte index 8bd542f..1871d2d 100644 --- a/apps/client/src/lib/components/TipTap.svelte +++ b/apps/client/src/lib/components/TipTap.svelte @@ -1,7 +1,7 @@ - + {#if !node.attrs.src} +

{node.attrs.tag}

+ {:else} + {node.attrs.alt} + {/if}
\ No newline at end of file diff --git a/apps/client/src/lib/emote-parser.ts b/apps/client/src/lib/emote-parser.ts index 2b80061..a917e99 100644 --- a/apps/client/src/lib/emote-parser.ts +++ b/apps/client/src/lib/emote-parser.ts @@ -25,6 +25,8 @@ const sizes = { export function getEmoteUrl(emotes: EmoteSet, size: Sizes, emoteString: string) { const emote = emoteString.split(':')[1] ? emoteString.split(':')[1] : emoteString; + if (!emotes[emote]) return null; + return emotes[emote].files[size].url; } @@ -38,6 +40,7 @@ export function parseMessage(emotes: EmoteSet, message: string) { if (emotes[emote]) { const url = getEmoteUrl(emotes, 'medium', emote); + if (!url) continue; parsedMessage = parsedMessage.replace(match[0], ``); } } diff --git a/apps/client/src/lib/seven-tv-adapter.ts b/apps/client/src/lib/seven-tv-adapter.ts index 2acb5e7..44095f8 100644 --- a/apps/client/src/lib/seven-tv-adapter.ts +++ b/apps/client/src/lib/seven-tv-adapter.ts @@ -35,6 +35,11 @@ export async function fetchSevenTVEmotes() { return [] as SevenTvEmoteSet[]; }); + if (!emoteSetResponse.length) { + console.error('Failed to fetch 7TV emotes'); + return {}; + } + return emoteSetResponse.reduce((acc: EmoteSet, emote: SevenTvEmoteSet) => { const files = emote.data.host.files.reduce((acc: Record, file: SevenTvEmoteSetFile) => { const size = file.name.split('.')[0];