diff --git a/src/masto/toot.ts b/src/masto/toot.ts index 2651577..f3ea94d 100644 --- a/src/masto/toot.ts +++ b/src/masto/toot.ts @@ -20,17 +20,6 @@ export function resolveCustomEmoji( }); } -export function appliedCustomEmoji( - target: { innerHTML: string }, - content: string, - emojis?: mastodon.v1.CustomEmoji[], -) { - createRenderEffect(() => { - const result = emojis ? resolveCustomEmoji(content, emojis) : content; - target.innerHTML = result; - }); -} - export function hasCustomEmoji(s: string) { return CUSTOM_EMOJI_REGEX.test(s); } diff --git a/src/profiles/Profile.tsx b/src/profiles/Profile.tsx index 56f6c8e..cc29999 100644 --- a/src/profiles/Profile.tsx +++ b/src/profiles/Profile.tsx @@ -171,10 +171,6 @@ const Profile: Component = () => { ), ); - const useSessionDisplayName = (e: HTMLElement) => { - createRenderEffect(() => (e.innerHTML = sessionDisplayName())); - }; - const toggleSubscribeHome = async (event: Event) => { const client = session().client; if (!session().account) return; @@ -218,9 +214,7 @@ const Profile: Component = () => { style={{ visibility: scrolledPastBanner() ? undefined : "hidden", }} - ref={(e: HTMLElement) => - createRenderEffect(() => (e.innerHTML = displayName())) - } + innerHTML={displayName()} > { - + {/* // for future */} @@ -384,7 +378,7 @@ const Profile: Component = () => { : undefined } > - + 's Home @@ -419,9 +413,7 @@ const Profile: Component = () => { - createRenderEffect(() => (e.innerHTML = displayName())) - } + innerHTML={displayName()} aria-label="Display name" > @@ -464,9 +456,7 @@ const Profile: Component = () => {
- createRenderEffect(() => (e.innerHTML = description() || "")) - } + innerHTML={description() || ""} >
{ - + ); }} diff --git a/src/timelines/RegularToot.tsx b/src/timelines/RegularToot.tsx index 76a0704..63ef7c1 100644 --- a/src/timelines/RegularToot.tsx +++ b/src/timelines/RegularToot.tsx @@ -66,9 +66,7 @@ export function findRootToot(element: HTMLElement) { current = current.parentElement; } if (!current) { - throw Error( - `the element must be placed under a element with .RegularToot`, - ); + throw Error(`the element must be placed under a element with .RegularToot`); } return current; } @@ -145,8 +143,8 @@ const RegularToot: Component = (oprops) => { <>
= (oprops) => {
{ - createRenderEffect(() => { - e.innerHTML = resolveCustomEmoji( - status().account.displayName, - toot().emojis, - ); - }); - }} + innerHTML={resolveCustomEmoji( + status().account.displayName, + toot().emojis, + )} > boosts
diff --git a/src/timelines/TootBottomSheet.tsx b/src/timelines/TootBottomSheet.tsx index 09465db..065a754 100644 --- a/src/timelines/TootBottomSheet.tsx +++ b/src/timelines/TootBottomSheet.tsx @@ -261,13 +261,7 @@ const TootBottomSheet: Component = (props) => { > - <span - ref={(e: HTMLElement) => - createRenderEffect( - () => (e.innerHTML = tootDisplayName() ?? "Someone"), - ) - } - ></span> + <span innerHTML={tootDisplayName() ?? "Someone"}></span> <span>'s toot</span> diff --git a/src/timelines/TootComposer.tsx b/src/timelines/TootComposer.tsx index 773d0b8..450f9ad 100644 --- a/src/timelines/TootComposer.tsx +++ b/src/timelines/TootComposer.tsx @@ -349,15 +349,10 @@ const TootComposer: Component<{ { - createRenderEffect(() => { - const inf = session()?.account.inf; - return (e.innerHTML = resolveCustomEmoji( - inf?.displayName || "", - inf?.emojis ?? [], - )); - }); - }} + innerHTML={resolveCustomEmoji( + session()?.account.inf?.displayName || "", + session()?.account.inf?.emojis ?? [], + )} > diff --git a/src/timelines/toots/TootAuthorGroup.tsx b/src/timelines/toots/TootAuthorGroup.tsx index 798c9b7..121b2c5 100644 --- a/src/timelines/toots/TootAuthorGroup.tsx +++ b/src/timelines/toots/TootAuthorGroup.tsx @@ -31,14 +31,10 @@ function TootAuthorGroup( { - createRenderEffect(() => { - e.innerHTML = resolveCustomEmoji( - toot().account.displayName, - toot().account.emojis, - ); - }); - }} + innerHTML={resolveCustomEmoji( + toot().account.displayName, + toot().account.emojis, + )} />
{ - createRenderEffect(() => (e.innerHTML = item.value)); - }} - >