mirror of
https://github.com/versia-pub/frontend.git
synced 2025-12-06 16:38:20 +01:00
fix: 🐛 Correctly render emojis in profile fields
This commit is contained in:
parent
0f22f94355
commit
5ddf275f3d
|
|
@ -85,7 +85,7 @@
|
|||
</div>
|
||||
|
||||
<div v-if="!skeleton && fields && fields.length > 0" class="mt-4 px-4 flex-col flex space-y-3">
|
||||
<div v-for="field of fields" :key="field.name" class="flex flex-col gap-1">
|
||||
<div v-for="field of fields" :key="field.name ?? ''" class="flex flex-col gap-1">
|
||||
<span class="text-primary-500 font-semibold" v-html="field.name"></span>
|
||||
<span class="text-gray-200 prose prose-invert break-all" v-html="field.value"></span>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@
|
|||
</div>
|
||||
|
||||
<div v-if="fields && fields.length > 0" class="mt-4 px-4 flex-col flex space-y-3">
|
||||
<div v-for="field of fields" :key="field.name" class="flex flex-col gap-1">
|
||||
<div v-for="field of fields" :key="field.name ?? ''" class="flex flex-col gap-1">
|
||||
<span class="text-primary-500 font-semibold" v-html="field.name"></span>
|
||||
<span class="text-gray-200 prose prose-invert prose-sm break-all"
|
||||
v-html="field.value"></span>
|
||||
|
|
|
|||
|
|
@ -32,10 +32,7 @@ export const useParsedContent = (
|
|||
|
||||
// Replace emoji shortcodes with images
|
||||
if (shouldRenderEmoji) {
|
||||
const paragraphs = contentHtml.querySelectorAll("p");
|
||||
|
||||
for (const paragraph of paragraphs) {
|
||||
paragraph.innerHTML = paragraph.innerHTML.replace(
|
||||
contentHtml.innerHTML = contentHtml.innerHTML.replace(
|
||||
/:([a-zA-Z0-9_-]+):/g,
|
||||
(match, emoji) => {
|
||||
const emojiData = toValue(emojis).find(
|
||||
|
|
@ -49,12 +46,11 @@ export const useParsedContent = (
|
|||
image.alt = `:${emoji}:`;
|
||||
image.title = emojiData.shortcode;
|
||||
image.className =
|
||||
"h-6 align-text-bottom inline not-prose hover:scale-110 transition-transform duration-75 ease-in-out";
|
||||
"h-[1.6em] mt-[-0.2ex] mx-1 mb-[0.2ex] align-middle inline not-prose hover:scale-110 transition-transform duration-75 ease-in-out";
|
||||
return image.outerHTML;
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Replace links containing mentions with interactive mentions
|
||||
const links = contentHtml.querySelectorAll("a");
|
||||
|
|
@ -104,6 +100,8 @@ export const useParsedAccount = (
|
|||
const parsedFields = computed(() =>
|
||||
fields.value.map((field) => ({
|
||||
...field,
|
||||
name: useParsedContent(field.name, emojis, undefined, settings)
|
||||
.value,
|
||||
value: useParsedContent(field.value, emojis, undefined, settings)
|
||||
.value,
|
||||
})),
|
||||
|
|
|
|||
Loading…
Reference in a new issue