fedimbed.bluesky: emojis my behated

This commit is contained in:
Cynthia Foxwell 2024-11-11 10:45:47 -07:00
parent edc0bf902d
commit 7f72b85e2b

View file

@ -240,17 +240,18 @@ async function bluesky(msg, url, spoiler = false) {
if (post.record.facets?.length > 0) { if (post.record.facets?.length > 0) {
const splitString = []; const splitString = [];
const chars = [...mainEmbed.description]; // emojis...
let start = 0; let start = 0;
for (const facet of post.record.facets) { for (const facet of post.record.facets) {
splitString.push({text: mainEmbed.description.substring(start, facet.index.byteStart)}); splitString.push({text: chars.slice(start, facet.index.byteStart).join("")});
splitString.push({ splitString.push({
text: mainEmbed.description.substring(facet.index.byteStart, facet.index.byteEnd), text: chars.slice(facet.index.byteStart, facet.index.byteEnd).join(""),
features: facet.features, features: facet.features,
}); });
start = facet.index.byteEnd; start = facet.index.byteEnd;
} }
splitString.push({text: mainEmbed.description.substring(start)}); splitString.push({text: chars.slice(start).join("")});
for (const part of splitString) { for (const part of splitString) {
if (part.features) if (part.features)