Skip to content

Commit

Permalink
fix: Remove Twemoji parser
Browse files Browse the repository at this point in the history
Unmaintained since Twitter -> X situation :(
Missing new additions, not worth using anymore.
  • Loading branch information
kiosion committed Apr 5, 2024
1 parent 0bdd7f3 commit c9873b1
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 70 deletions.
1 change: 0 additions & 1 deletion svelte-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
"svelte-eslint-parser": "0.33.1",
"svelte-highlight": "7.6.0",
"tailwindcss": "3.4.1",
"twemoji": "14.0.2",
"typescript": "5.3.3",
"vite": "5.2.6",
"vite-plugin-inspect": "0.8.3",
Expand Down
44 changes: 0 additions & 44 deletions svelte-app/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 0 additions & 7 deletions svelte-app/src/components/portable-text/portable-text.svelte
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
<script lang="ts">
import { onMount } from 'svelte';
import { t } from '$lib/i18n';
import Logger from '$lib/logger';
import { parseEmoji } from '$lib/utils';
import Icon from '$components/icon.svelte';
import Footnote from '$components/portable-text/footnote.svelte';
Expand Down Expand Up @@ -42,10 +39,6 @@
let ptContainer: HTMLElement;
onMount(() => {
parseEmoji(ptContainer);
});
const customScrollTo = (event: Event, id: string) => {
event.preventDefault();
const element = document.querySelector(`#${id}`);
Expand Down
18 changes: 0 additions & 18 deletions svelte-app/src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,6 @@ import { derived } from 'svelte/store';

import { currentLang } from '$lib/i18n';

import twemoji from 'twemoji';

export const parseEmoji = (element: HTMLElement) => {
element && twemoji.parse(element),
element?.querySelectorAll('img.emoji')?.forEach((emoji: Element) => {
if (!(emoji as HTMLElement)?.style) {
return;
}
(emoji as HTMLElement).setAttribute(
'style',
'display: inline-block;width: 1.1em;height: 1.1em;margin-right: 0.05em;vertical-align: -0.1em;'.replace(
/\s+/g,
' '
)
);
});
};

const _parseViews = (views: number | undefined, lang: string) => {
if (!views || views < 1) {
return 0;
Expand Down

0 comments on commit c9873b1

Please sign in to comment.