mirror of
https://github.com/binwiederhier/ntfy.git
synced 2025-06-14 08:33:20 +02:00
Filter emojis that don't render in Chrome on Desktop
This commit is contained in:
parent
4eba641ec3
commit
328aca48ab
3 changed files with 14 additions and 3 deletions
web/src
File diff suppressed because one or more lines are too long
|
@ -9,12 +9,23 @@ import {InputAdornment} from "@mui/material";
|
|||
import IconButton from "@mui/material/IconButton";
|
||||
import {Close} from "@mui/icons-material";
|
||||
|
||||
// Create emoji list by category; filter emojis that are not supported by Desktop Chrome
|
||||
const emojisByCategory = {};
|
||||
const isDesktopChrome = /Chrome/.test(navigator.userAgent) && !/Mobile/.test(navigator.userAgent);
|
||||
const maxSupportedVersionForDesktopChrome = 11;
|
||||
rawEmojis.forEach(emoji => {
|
||||
if (!emojisByCategory[emoji.category]) {
|
||||
emojisByCategory[emoji.category] = [];
|
||||
}
|
||||
emojisByCategory[emoji.category].push(emoji);
|
||||
try {
|
||||
const unicodeVersion = parseFloat(emoji.unicode_version);
|
||||
const supportedEmoji = unicodeVersion <= maxSupportedVersionForDesktopChrome || !isDesktopChrome;
|
||||
if (supportedEmoji) {
|
||||
emojisByCategory[emoji.category].push(emoji);
|
||||
}
|
||||
} catch (e) {
|
||||
// Nothing. Ignore.
|
||||
}
|
||||
});
|
||||
|
||||
const EmojiPicker = (props) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue