Authored by lea guo

emoji过滤

/* eslint-disable indent */
import { get, first } from 'lodash';
import emojiRegex from 'emoji-regex';
function _version2num(version) {
if (!version) {
... ... @@ -40,13 +41,9 @@ function handleProtocol(url) {
}
const filterEmoji = (text) => {
const ranges = [
'\ud83c[\udf00-\udfff]',
'\ud83d[\udc00-\ude4f]',
'\ud83d[\ude80-\udeff]'
];
const regexp = emojiRegex();
return text.replace(new RegExp(ranges.join('|'), 'g'), '');
return text.replace(regexp, '');
};
// eslint-disable-next-line no-unused-vars
... ... @@ -91,7 +88,6 @@ const getDetailShareData = (article, app_version = '6.9.11') => {
}
// desc = filterEmoji(desc);
desc = filterEmoji(desc);
const authorName = filterEmoji(article.authorName || '');
... ...
{
"name": "yoho-community-web",
"version": "6.9.14-RELEASE",
"version": "6.9.14-beta-1",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ... @@ -45,6 +45,7 @@
"cors": "^2.8.5",
"cube-ui": "^1.12.6",
"dayjs": "^1.8.5",
"emoji-regex": "^8.0.0",
"express": "^4.16.4",
"express-session": "^1.15.6",
"fastclick": "^1.0.6",
... ...
... ... @@ -2835,6 +2835,7 @@ emoji-regex@^7.0.1:
emoji-regex@^8.0.0:
version "8.0.0"
resolved "http://npm.yohops.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37"
integrity sha1-6Bj9ac5cz8tARZT4QpY79TFkzDc=
emojis-list@^2.0.0:
version "2.1.0"
... ...