Authored by shuaiguo

使用emoji-aware移除emoji

1 /* eslint-disable indent */ 1 /* eslint-disable indent */
2 import { get, first } from 'lodash'; 2 import { get, first } from 'lodash';
3 import emojiRegex from 'emoji-regex'; 3 import emojiRegex from 'emoji-regex';
  4 +import { withoutEmoji } from 'emoji-aware';
4 5
5 function _version2num(version) { 6 function _version2num(version) {
6 if (!version) { 7 if (!version) {
@@ -56,7 +57,6 @@ function ClearBr(key) { @@ -56,7 +57,6 @@ function ClearBr(key) {
56 // eslint-disable-next-line no-unused-vars 57 // eslint-disable-next-line no-unused-vars
57 const getDetailShareData = (article, app_version = '6.9.11') => { 58 const getDetailShareData = (article, app_version = '6.9.11') => {
58 let shareImage = ''; 59 let shareImage = '';
59 -  
60 let desc = ''; 60 let desc = '';
61 61
62 if (article.sort === 2) { 62 if (article.sort === 2) {
@@ -96,13 +96,13 @@ const getDetailShareData = (article, app_version = '6.9.11') => { @@ -96,13 +96,13 @@ const getDetailShareData = (article, app_version = '6.9.11') => {
96 96
97 let authorName = article.authorName || ''; 97 let authorName = article.authorName || '';
98 98
99 - // 过滤掉emoji表情  
100 - // desc = filterEmoji(desc);  
101 - // authorName = filterEmoji(article.authorName || '');  
102 -  
103 // 过滤掉换行 99 // 过滤掉换行
104 - desc = ClearBr(desc);  
105 - authorName = ClearBr(article.authorName || ''); 100 + // desc = ClearBr(desc);
  101 + // authorName = ClearBr(article.authorName || '');
  102 +
  103 + // 过滤掉emoji表情
  104 + desc = withoutEmoji(desc).join('');
  105 + authorName = withoutEmoji(article.authorName || '').join('');
106 106
107 return { 107 return {
108 title: `@${authorName} 在有货社区上发了一篇内容,快点开看看!`, 108 title: `@${authorName} 在有货社区上发了一篇内容,快点开看看!`,
1 { 1 {
2 "name": "yoho-community-web", 2 "name": "yoho-community-web",
3 - "version": "6.9.14-beta-4", 3 + "version": "6.9.14-beta-5",
4 "private": true, 4 "private": true,
5 "description": "A New Yohobuy Project With Express", 5 "description": "A New Yohobuy Project With Express",
6 "repository": { 6 "repository": {
@@ -45,6 +45,7 @@ @@ -45,6 +45,7 @@
45 "cors": "^2.8.5", 45 "cors": "^2.8.5",
46 "cube-ui": "^1.12.6", 46 "cube-ui": "^1.12.6",
47 "dayjs": "^1.8.5", 47 "dayjs": "^1.8.5",
  48 + "emoji-aware": "^3.0.5",
48 "emoji-regex": "^8.0.0", 49 "emoji-regex": "^8.0.0",
49 "express": "^4.16.4", 50 "express": "^4.16.4",
50 "express-session": "^1.15.6", 51 "express-session": "^1.15.6",
@@ -2828,6 +2828,14 @@ elliptic@^6.0.0: @@ -2828,6 +2828,14 @@ elliptic@^6.0.0:
2828 minimalistic-assert "^1.0.0" 2828 minimalistic-assert "^1.0.0"
2829 minimalistic-crypto-utils "^1.0.0" 2829 minimalistic-crypto-utils "^1.0.0"
2830 2830
  2831 +emoji-aware@^3.0.5:
  2832 + version "3.0.5"
  2833 + resolved "http://npm.yohops.com/emoji-aware/-/emoji-aware-3.0.5.tgz#69a1a9e49eec9bf85d601232c853cac3fea443eb"
  2834 + integrity sha1-aaGp5J7sm/hdYBIyyFPKw/6kQ+s=
  2835 + dependencies:
  2836 + lodash.flattendeep "^4.4.0"
  2837 + parsimmon "^1.13.0"
  2838 +
2831 emoji-regex@^7.0.1: 2839 emoji-regex@^7.0.1:
2832 version "7.0.3" 2840 version "7.0.3"
2833 resolved "http://npm.yohops.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156" 2841 resolved "http://npm.yohops.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156"
@@ -5036,6 +5044,11 @@ lodash.findkey@^4.6.0: @@ -5036,6 +5044,11 @@ lodash.findkey@^4.6.0:
5036 version "4.6.0" 5044 version "4.6.0"
5037 resolved "http://npm.yohops.com/lodash.findkey/-/lodash.findkey-4.6.0.tgz#83058e903b51cbb759d09ccf546dea3ea39c4718" 5045 resolved "http://npm.yohops.com/lodash.findkey/-/lodash.findkey-4.6.0.tgz#83058e903b51cbb759d09ccf546dea3ea39c4718"
5038 5046
  5047 +lodash.flattendeep@^4.4.0:
  5048 + version "4.4.0"
  5049 + resolved "http://npm.yohops.com/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz#fb030917f86a3134e5bc9bec0d69e0013ddfedb2"
  5050 + integrity sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI=
  5051 +
5039 lodash.kebabcase@^4.1.1: 5052 lodash.kebabcase@^4.1.1:
5040 version "4.1.1" 5053 version "4.1.1"
5041 resolved "http://npm.yohops.com/lodash.kebabcase/-/lodash.kebabcase-4.1.1.tgz#8489b1cb0d29ff88195cceca448ff6d6cc295c36" 5054 resolved "http://npm.yohops.com/lodash.kebabcase/-/lodash.kebabcase-4.1.1.tgz#8489b1cb0d29ff88195cceca448ff6d6cc295c36"
@@ -6172,6 +6185,11 @@ parseurl@~1.3.1, parseurl@~1.3.2: @@ -6172,6 +6185,11 @@ parseurl@~1.3.1, parseurl@~1.3.2:
6172 version "1.3.2" 6185 version "1.3.2"
6173 resolved "http://npm.yohops.com/parseurl/-/parseurl-1.3.2.tgz#fc289d4ed8993119460c156253262cdc8de65bf3" 6186 resolved "http://npm.yohops.com/parseurl/-/parseurl-1.3.2.tgz#fc289d4ed8993119460c156253262cdc8de65bf3"
6174 6187
  6188 +parsimmon@^1.13.0:
  6189 + version "1.13.0"
  6190 + resolved "http://npm.yohops.com/parsimmon/-/parsimmon-1.13.0.tgz#6e4ef3dbd45ed6ea6808be600ac4b9c8a44228cf"
  6191 + integrity sha1-bk7z29Re1upoCL5gCsS5yKRCKM8=
  6192 +
6175 pascalcase@^0.1.1: 6193 pascalcase@^0.1.1:
6176 version "0.1.1" 6194 version "0.1.1"
6177 resolved "http://npm.yohops.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14" 6195 resolved "http://npm.yohops.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14"