mirror of
https://github.com/hzrd149/nostrudel.git
synced 2025-09-26 19:47:25 +02:00
Fix custom emoji reactions having multiple colons
This commit is contained in:
5
.changeset/large-items-knock.md
Normal file
5
.changeset/large-items-knock.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"nostrudel": patch
|
||||
---
|
||||
|
||||
Fix custom emoji reactions having multiple colons
|
@@ -46,7 +46,7 @@ export default function EmbeddedEmojiPack({ pack, ...props }: Omit<CardProps, "c
|
||||
{emojis.length > 0 && (
|
||||
<Flex mb="2" wrap="wrap" gap="2">
|
||||
{emojis.map(({ name, url }) => (
|
||||
<Image key={name + url} src={url} title={name} alt={`:${name}:`} w={8} h={8} />
|
||||
<Image key={name + url} src={url} title={name} alt={`:${name}:`} w={8} h={8} overflow="hidden" />
|
||||
))}
|
||||
</Flex>
|
||||
)}
|
||||
|
@@ -17,7 +17,8 @@ export function embedEmoji(content: EmbedableContent, note: NostrEvent | DraftNo
|
||||
display="inline-block"
|
||||
verticalAlign="middle"
|
||||
title={match[1]}
|
||||
alt={match[1]}
|
||||
alt={":" + match[1] + ":"}
|
||||
overflow="hidden"
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
@@ -4,6 +4,6 @@ import { DislikeIcon, LikeIcon } from "../icons";
|
||||
export default function ReactionIcon({ emoji, url }: { emoji: string; url?: string }) {
|
||||
if (emoji === "+") return <LikeIcon />;
|
||||
if (emoji === "-") return <DislikeIcon />;
|
||||
if (url) return <Image src={url} title={emoji} alt={emoji} w="1em" h="1em" display="inline" />;
|
||||
if (url) return <Image src={url} title={emoji} alt={emoji} w="1em" h="1em" display="inline" overflow="hidden" />;
|
||||
return <span>{emoji}</span>;
|
||||
}
|
||||
|
@@ -26,9 +26,13 @@ export function draftEventReaction(event: NostrEvent, emoji = "+", url?: string)
|
||||
["e", event.id],
|
||||
["p", event.pubkey],
|
||||
];
|
||||
|
||||
let content = emoji;
|
||||
if (url && !content.startsWith(":") && content.endsWith(":")) content = ":" + content + ":";
|
||||
|
||||
const draft: DraftNostrEvent = {
|
||||
kind: kinds.Reaction,
|
||||
content: url ? ":" + emoji + ":" : emoji,
|
||||
content,
|
||||
tags: isReplaceable(event.kind) ? [...tags, ["a", getEventCoordinate(event)]] : tags,
|
||||
created_at: dayjs().unix(),
|
||||
};
|
||||
|
Reference in New Issue
Block a user