mirror of
https://github.com/MathMan05/Fermi.git
synced 2026-09-01 22:29:07 +00:00
Add comments for emoji wrapping
This commit is contained in:
@@ -630,7 +630,7 @@ class MarkDown {
|
||||
mention.classList.add("mentionMD");
|
||||
mention.contentEditable = "false";
|
||||
mention.textContent = everyone ? "@everyone" : "@here";
|
||||
setTextWithWrappedEmoji(mention, mention.textContent || "");
|
||||
|
||||
appendcurrent();
|
||||
span.appendChild(mention);
|
||||
mention.setAttribute("real", everyone ? `@everyone` : "@here");
|
||||
|
||||
@@ -31,16 +31,17 @@ let instances:
|
||||
}[]
|
||||
| null = null;
|
||||
await setTheme();
|
||||
// Matches keycaps, flags, standard, skin-toned, and ZWJ emoji sequences.
|
||||
const emojiGraphemeRegex = /^(?:[0-9#*]\uFE0F?\u20E3|\p{Regional_Indicator}{2}|\p{Extended_Pictographic}(?:\uFE0F|\uFE0E)?[\u{1F3FB}-\u{1F3FF}]?(?:\u200D\p{Extended_Pictographic}(?:\uFE0F|\uFE0E)?[\u{1F3FB}-\u{1F3FF}]?)*?)$/u;
|
||||
export function setTextWithWrappedEmoji(target: HTMLElement, name: string) {
|
||||
target.textContent = "";
|
||||
|
||||
// Fallback for browsers without grapheme segmentation support.
|
||||
if (!("Segmenter" in Intl)) {
|
||||
target.textContent = name;
|
||||
return;
|
||||
}
|
||||
|
||||
const segmenter = new Intl.Segmenter("und", {granularity: "grapheme"});
|
||||
// Buffer plain text between emoji to keep fewer DOM nodes.
|
||||
let textBuffer = "";
|
||||
const flushTextBuffer = () => {
|
||||
if (!textBuffer) return;
|
||||
|
||||
Reference in New Issue
Block a user