Big emojis in chats, too
This commit is contained in:
10
app/soapbox/utils/rich_content.js
Normal file
10
app/soapbox/utils/rich_content.js
Normal file
@@ -0,0 +1,10 @@
|
||||
// Returns `true` if the node contains only emojis, up to a limit
|
||||
export const justEmojis = (node, limit = 1) => {
|
||||
if (!node) return false;
|
||||
if (node.textContent.replaceAll(' ', '') !== '') return false;
|
||||
const emojis = [...node.querySelectorAll('img.emojione')];
|
||||
if (emojis.length > limit) return false;
|
||||
const images = [...node.querySelectorAll('img')];
|
||||
if (images.length > emojis.length) return false;
|
||||
return true;
|
||||
};
|
||||
Reference in New Issue
Block a user