narro 6 年之前
父節點
當前提交
9966628c8e
共有 12 個檔案被更改,包括 1319 行新增292 行删除
  1. 3
    0
      CHANGELOG.md
  2. 1
    1
      README.md
  3. 32
    66
      lib/components/Editor/Emoji.js
  4. 1
    1
      lib/components/Editor/Emoji.js.map
  5. 563
    77
      lib/emoji.js
  6. 1
    1
      lib/emoji.js.map
  7. 3
    3
      lib/helper.js
  8. 1
    1
      lib/helper.js.map
  9. 1
    1
      package.json
  10. 27
    49
      src/components/Editor/Emoji.js
  11. 680
    88
      src/emoji.js
  12. 6
    4
      src/helper.js

+ 3
- 0
CHANGELOG.md 查看文件

@@ -1,5 +1,8 @@
1 1
 # CHANGELOG
2 2
 
3
+## 0.5.10
4
+- [x] 扩展表情包
5
+
3 6
 ## 0.5.9
4 7
 - [x] fix: 优化表情、图片解析,无法解析的内容返回原文
5 8
 

+ 1
- 1
README.md 查看文件

@@ -2,7 +2,7 @@
2 2
 
3 3
 通用评论系统及编辑器
4 4
 
5
-**`version 0.5.7`**
5
+**`version 0.5.10`**
6 6
 
7 7
 ```js
8 8
 import Comment, { Editor, RenderText } from 'comment';

+ 32
- 66
lib/components/Editor/Emoji.js 查看文件

@@ -30,77 +30,43 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
30 30
 var Emoji = function Emoji(_ref) {
31 31
   var _onClick = _ref.onClick;
32 32
 
33
-  var content = [[], [], []];
34
-
35
-  for (var i = 0; i < _emoji2.default.length; i++) {
36
-    if (i < 20) {
37
-      content[0].push(_emoji2.default[i]);
38
-    } else if (i < 40) {
39
-      content[1].push(_emoji2.default[i]);
40
-    } else if (i < _emoji2.default.length) {
41
-      content[2].push(_emoji2.default[i]);
33
+  var content = [];
34
+  var curPage = [];
35
+  for (var i = 0; i < 115; i++) {
36
+    if (curPage.length < 20) {
37
+      curPage.push(_emoji2.default[i]);
38
+    } else {
39
+      content.push(curPage);
40
+      curPage = [];
42 41
     }
43 42
   }
43
+  if (curPage.length > 0) {
44
+    content.push(curPage);
45
+  }
44 46
   return _react2.default.createElement(
45 47
     _carousel2.default,
46 48
     null,
47
-    _react2.default.createElement(
48
-      "div",
49
-      null,
50
-      content[0].map(function (item, index) {
51
-        return _react2.default.createElement(
52
-          "div",
53
-          { className: "item", key: item.value },
54
-          _react2.default.createElement("span", { className: "helper" }),
55
-          _react2.default.createElement("img", {
56
-            src: "" + _emoji.prefixUrl + item.value + "." + _emoji.ext,
57
-            alt: item.title,
58
-            style: { display: "inline-block" },
59
-            onClick: function onClick() {
60
-              return _onClick(item.title);
61
-            }
62
-          })
63
-        );
64
-      })
65
-    ),
66
-    _react2.default.createElement(
67
-      "div",
68
-      null,
69
-      content[1].map(function (item, index) {
70
-        return _react2.default.createElement(
71
-          "div",
72
-          { className: "item", key: item.value },
73
-          _react2.default.createElement("span", { className: "helper" }),
74
-          _react2.default.createElement("img", {
75
-            src: "" + _emoji.prefixUrl + item.value + "." + _emoji.ext,
76
-            alt: item.title,
77
-            style: { display: "inline-block" },
78
-            onClick: function onClick() {
79
-              return _onClick(item.title);
80
-            }
81
-          })
82
-        );
83
-      })
84
-    ),
85
-    _react2.default.createElement(
86
-      "div",
87
-      null,
88
-      content[2].map(function (item) {
89
-        return _react2.default.createElement(
90
-          "div",
91
-          { className: "item", key: item.value },
92
-          _react2.default.createElement("span", { className: "helper" }),
93
-          _react2.default.createElement("img", {
94
-            src: "" + _emoji.prefixUrl + item.value + "." + _emoji.ext,
95
-            alt: item.title,
96
-            style: { display: "inline-block" },
97
-            onClick: function onClick() {
98
-              return _onClick(item.title);
99
-            }
100
-          })
101
-        );
102
-      })
103
-    )
49
+    content.map(function (page, index) {
50
+      return _react2.default.createElement(
51
+        "div",
52
+        { key: index },
53
+        page.map(function (item, index) {
54
+          return _react2.default.createElement(
55
+            "div",
56
+            { className: "item", key: item.value },
57
+            _react2.default.createElement("span", { className: "helper" }),
58
+            _react2.default.createElement("img", {
59
+              src: "" + _emoji.prefixUrl + item.value + "." + item.ext,
60
+              alt: item.title,
61
+              style: { display: "inline-block" },
62
+              onClick: function onClick() {
63
+                return _onClick(item.title);
64
+              }
65
+            })
66
+          );
67
+        })
68
+      );
69
+    })
104 70
   );
105 71
 };
106 72
 

+ 1
- 1
lib/components/Editor/Emoji.js.map 查看文件

@@ -1 +1 @@
1
-{"version":3,"sources":["../../../src/components/Editor/Emoji.js"],"names":["Emoji","onClick","content","i","emoji","length","push","map","item","index","value","prefixUrl","ext","title","display"],"mappings":";;;;;;;;;;;;AAAA;;;;AAEA;;;;AACA;;;;AACA;AACA;;AAEA;;AAEA,IAAMA,QAAQ,SAARA,KAAQ,OAAiB;AAAA,MAAdC,QAAc,QAAdA,OAAc;;AAC7B,MAAMC,UAAU,CAAC,EAAD,EAAK,EAAL,EAAS,EAAT,CAAhB;;AAEA,OAAK,IAAIC,IAAI,CAAb,EAAgBA,IAAIC,gBAAMC,MAA1B,EAAkCF,GAAlC,EAAuC;AACrC,QAAIA,IAAI,EAAR,EAAY;AACVD,cAAQ,CAAR,EAAWI,IAAX,CAAgBF,gBAAMD,CAAN,CAAhB;AACD,KAFD,MAEO,IAAIA,IAAI,EAAR,EAAY;AACjBD,cAAQ,CAAR,EAAWI,IAAX,CAAgBF,gBAAMD,CAAN,CAAhB;AACD,KAFM,MAEA,IAAIA,IAAIC,gBAAMC,MAAd,EAAsB;AAC3BH,cAAQ,CAAR,EAAWI,IAAX,CAAgBF,gBAAMD,CAAN,CAAhB;AACD;AACF;AACD,SACE;AAAA;AAAA;AACE;AAAA;AAAA;AACGD,cAAQ,CAAR,EAAWK,GAAX,CAAe,UAACC,IAAD,EAAOC,KAAP;AAAA,eACd;AAAA;AAAA,YAAK,WAAU,MAAf,EAAsB,KAAKD,KAAKE,KAAhC;AACE,kDAAM,WAAU,QAAhB,GADF;AAEE;AACE,sBAAQC,gBAAR,GAAoBH,KAAKE,KAAzB,SAAkCE,UADpC;AAEE,iBAAKJ,KAAKK,KAFZ;AAGE,mBAAO,EAAEC,SAAS,cAAX,EAHT;AAIE,qBAAS;AAAA,qBAAMb,SAAQO,KAAKK,KAAb,CAAN;AAAA;AAJX;AAFF,SADc;AAAA,OAAf;AADH,KADF;AAcE;AAAA;AAAA;AACGX,cAAQ,CAAR,EAAWK,GAAX,CAAe,UAACC,IAAD,EAAOC,KAAP;AAAA,eACd;AAAA;AAAA,YAAK,WAAU,MAAf,EAAsB,KAAKD,KAAKE,KAAhC;AACE,kDAAM,WAAU,QAAhB,GADF;AAEE;AACE,sBAAQC,gBAAR,GAAoBH,KAAKE,KAAzB,SAAkCE,UADpC;AAEE,iBAAKJ,KAAKK,KAFZ;AAGE,mBAAO,EAAEC,SAAS,cAAX,EAHT;AAIE,qBAAS;AAAA,qBAAMb,SAAQO,KAAKK,KAAb,CAAN;AAAA;AAJX;AAFF,SADc;AAAA,OAAf;AADH,KAdF;AA2BE;AAAA;AAAA;AACGX,cAAQ,CAAR,EAAWK,GAAX,CAAe;AAAA,eACd;AAAA;AAAA,YAAK,WAAU,MAAf,EAAsB,KAAKC,KAAKE,KAAhC;AACE,kDAAM,WAAU,QAAhB,GADF;AAEE;AACE,sBAAQC,gBAAR,GAAoBH,KAAKE,KAAzB,SAAkCE,UADpC;AAEE,iBAAKJ,KAAKK,KAFZ;AAGE,mBAAO,EAAEC,SAAS,cAAX,EAHT;AAIE,qBAAS;AAAA,qBAAMb,SAAQO,KAAKK,KAAb,CAAN;AAAA;AAJX;AAFF,SADc;AAAA,OAAf;AADH;AA3BF,GADF;AA2CD,CAvDD;;kBAyDeb,K","file":"Emoji.js","sourcesContent":["import React from \"react\";\r\nimport { Carousel } from \"antd\";\r\nimport emoji, { prefixUrl, ext } from \"../../emoji\";\r\nimport \"./Emoji.css\";\r\n// 每页 20  5*4\r\n// 共 20 * 3 = 60 (实际是 54)\r\n\r\n// class Emoji\r\n\r\nconst Emoji = ({ onClick }) => {\r\n  const content = [[], [], []];\r\n\r\n  for (let i = 0; i < emoji.length; i++) {\r\n    if (i < 20) {\r\n      content[0].push(emoji[i]);\r\n    } else if (i < 40) {\r\n      content[1].push(emoji[i]);\r\n    } else if (i < emoji.length) {\r\n      content[2].push(emoji[i]);\r\n    }\r\n  }\r\n  return (\r\n    <Carousel>\r\n      <div>\r\n        {content[0].map((item, index) => (\r\n          <div className=\"item\" key={item.value}>\r\n            <span className=\"helper\" />\r\n            <img\r\n              src={`${prefixUrl}${item.value}.${ext}`}\r\n              alt={item.title}\r\n              style={{ display: \"inline-block\" }}\r\n              onClick={() => onClick(item.title)}\r\n            />\r\n          </div>\r\n        ))}\r\n      </div>\r\n      <div>\r\n        {content[1].map((item, index) => (\r\n          <div className=\"item\" key={item.value}>\r\n            <span className=\"helper\" />\r\n            <img\r\n              src={`${prefixUrl}${item.value}.${ext}`}\r\n              alt={item.title}\r\n              style={{ display: \"inline-block\" }}\r\n              onClick={() => onClick(item.title)}\r\n            />\r\n          </div>\r\n        ))}\r\n      </div>\r\n      <div>\r\n        {content[2].map(item => (\r\n          <div className=\"item\" key={item.value}>\r\n            <span className=\"helper\" />\r\n            <img\r\n              src={`${prefixUrl}${item.value}.${ext}`}\r\n              alt={item.title}\r\n              style={{ display: \"inline-block\" }}\r\n              onClick={() => onClick(item.title)}\r\n            />\r\n          </div>\r\n        ))}\r\n      </div>\r\n    </Carousel>\r\n  );\r\n};\r\n\r\nexport default Emoji;\r\n"]}
1
+{"version":3,"sources":["../../../src/components/Editor/Emoji.js"],"names":["Emoji","onClick","content","curPage","i","length","push","emoji","map","page","index","item","value","prefixUrl","ext","title","display"],"mappings":";;;;;;;;;;;;AAAA;;;;AAEA;;;;AACA;;;;AACA;AACA;;AAEA;;AAEA,IAAMA,QAAQ,SAARA,KAAQ,OAAiB;AAAA,MAAdC,QAAc,QAAdA,OAAc;;AAC7B,MAAMC,UAAU,EAAhB;AACA,MAAIC,UAAU,EAAd;AACA,OAAK,IAAIC,IAAI,CAAb,EAAgBA,IAAI,GAApB,EAAyBA,GAAzB,EAA8B;AAC5B,QAAID,QAAQE,MAAR,GAAiB,EAArB,EAAyB;AACvBF,cAAQG,IAAR,CAAaC,gBAAMH,CAAN,CAAb;AACD,KAFD,MAEO;AACLF,cAAQI,IAAR,CAAaH,OAAb;AACAA,gBAAU,EAAV;AACD;AACF;AACD,MAAIA,QAAQE,MAAR,GAAiB,CAArB,EAAwB;AACtBH,YAAQI,IAAR,CAAaH,OAAb;AACD;AACD,SACE;AAAA;AAAA;AACGD,YAAQM,GAAR,CAAY,UAACC,IAAD,EAAOC,KAAP;AAAA,aACX;AAAA;AAAA,UAAK,KAAKA,KAAV;AACGD,aAAKD,GAAL,CAAS,UAACG,IAAD,EAAOD,KAAP;AAAA,iBACR;AAAA;AAAA,cAAK,WAAU,MAAf,EAAsB,KAAKC,KAAKC,KAAhC;AACE,oDAAM,WAAU,QAAhB,GADF;AAEE;AACE,wBAAQC,gBAAR,GAAoBF,KAAKC,KAAzB,SAAkCD,KAAKG,GADzC;AAEE,mBAAKH,KAAKI,KAFZ;AAGE,qBAAO,EAAEC,SAAS,cAAX,EAHT;AAIE,uBAAS;AAAA,uBAAMf,SAAQU,KAAKI,KAAb,CAAN;AAAA;AAJX;AAFF,WADQ;AAAA,SAAT;AADH,OADW;AAAA,KAAZ;AADH,GADF;AAmBD,CAjCD;;kBAmCef,K","file":"Emoji.js","sourcesContent":["import React from \"react\";\r\nimport { Carousel } from \"antd\";\r\nimport emoji, { prefixUrl } from \"../../emoji\";\r\nimport \"./Emoji.css\";\r\n// 每页 20  5*4\r\n// 共 20 * 3 = 60 (实际是 54)\r\n\r\n// class Emoji\r\n\r\nconst Emoji = ({ onClick }) => {\r\n  const content = [];\r\n  let curPage = [];\r\n  for (let i = 0; i < 115; i++) {\r\n    if (curPage.length < 20) {\r\n      curPage.push(emoji[i]);\r\n    } else {\r\n      content.push(curPage);\r\n      curPage = [];\r\n    }\r\n  }\r\n  if (curPage.length > 0) {\r\n    content.push(curPage);\r\n  }\r\n  return (\r\n    <Carousel>\r\n      {content.map((page, index) => (\r\n        <div key={index}>\r\n          {page.map((item, index) => (\r\n            <div className=\"item\" key={item.value}>\r\n              <span className=\"helper\" />\r\n              <img\r\n                src={`${prefixUrl}${item.value}.${item.ext}`}\r\n                alt={item.title}\r\n                style={{ display: \"inline-block\" }}\r\n                onClick={() => onClick(item.title)}\r\n              />\r\n            </div>\r\n          ))}\r\n        </div>\r\n      ))}\r\n    </Carousel>\r\n  );\r\n};\r\n\r\nexport default Emoji;\r\n"]}

+ 563
- 77
lib/emoji.js 查看文件

@@ -4,170 +4,656 @@ Object.defineProperty(exports, "__esModule", {
4 4
   value: true
5 5
 });
6 6
 var emoji = [{
7
+  value: "14",
8
+  title: "\u5FAE\u7B11",
9
+  ext: "gif"
10
+}, {
11
+  value: "101",
12
+  title: "撇嘴",
13
+  ext: "gif"
14
+}, {
15
+  value: "102",
16
+  title: "色",
17
+  ext: "gif"
18
+}, {
19
+  value: "4",
20
+  title: "\u53D1\u5446",
21
+  ext: "gif"
22
+}, {
23
+  value: "104",
24
+  title: "\u58A8\u955C",
25
+  ext: "gif"
26
+}, {
27
+  value: "105",
28
+  title: "\u54ED",
29
+  ext: "gif"
30
+}, {
31
+  value: "106",
32
+  title: "害羞",
33
+  ext: "gif"
34
+}, {
35
+  value: "107",
36
+  title: "闭嘴",
37
+  ext: "gif"
38
+}, {
39
+  value: "108",
40
+  title: "睡觉",
41
+  ext: "gif"
42
+}, {
43
+  value: "109",
44
+  title: "\u54ED2",
45
+  ext: "gif"
46
+}, {
47
+  value: "110",
48
+  title: "尴尬",
49
+  ext: "gif"
50
+}, {
51
+  value: "111",
52
+  title: "发怒",
53
+  ext: "gif"
54
+}, {
55
+  value: "12",
56
+  title: "\u8C03\u76AE",
57
+  ext: "gif"
58
+}, {
59
+  value: "113",
60
+  title: "呲牙",
61
+  ext: "gif"
62
+}, {
63
+  value: "114",
64
+  title: "怀疑",
65
+  ext: "gif"
66
+}, {
67
+  value: "15",
68
+  title: "\u96BE\u8FC7",
69
+  ext: "gif"
70
+}, {
71
+  value: "5",
72
+  title: "\u9177",
73
+  ext: "gif"
74
+}, {
75
+  value: "117",
76
+  title: "\u6C57",
77
+  ext: "gif"
78
+}, {
79
+  value: "118",
80
+  title: "\u6293\u72C2",
81
+  ext: "gif"
82
+}, {
83
+  value: "18",
84
+  title: "\u5410",
85
+  ext: "gif"
86
+}, {
87
+  value: "120",
88
+  title: "\u7B112",
89
+  ext: "gif"
90
+}, {
91
+  value: "121",
92
+  title: "\u5FEB\u4E50",
93
+  ext: "gif"
94
+}, {
95
+  value: "122",
96
+  title: "\u5947",
97
+  ext: "gif"
98
+}, {
99
+  value: "123",
100
+  title: "\u50B2",
101
+  ext: "gif"
102
+}, {
103
+  value: "124",
104
+  title: "\u997F",
105
+  ext: "gif"
106
+}, {
107
+  value: "125",
108
+  title: "\u7D2F",
109
+  ext: "gif"
110
+}, {
111
+  value: "126",
112
+  title: "\u5413",
113
+  ext: "gif"
114
+}, {
115
+  value: "127",
116
+  title: "\u6C572",
117
+  ext: "gif"
118
+}, {
119
+  value: "128",
120
+  title: "\u9AD8\u5174",
121
+  ext: "gif"
122
+}, {
123
+  value: "129",
124
+  title: "\u95F2",
125
+  ext: "gif"
126
+}, {
127
+  value: "130",
128
+  title: "\u52AA\u529B",
129
+  ext: "gif"
130
+}, {
131
+  value: "131",
132
+  title: "\u9A82",
133
+  ext: "gif"
134
+}, {
135
+  value: "30",
136
+  title: "\u7591\u95EE",
137
+  ext: "gif"
138
+}, {
139
+  value: "133",
140
+  title: "\u79D8\u5BC6",
141
+  ext: "gif"
142
+}, {
143
+  value: "134",
144
+  title: "\u4E71",
145
+  ext: "gif"
146
+}, {
147
+  value: "135",
148
+  title: "\u75AF",
149
+  ext: "gif"
150
+}, {
151
+  value: "136",
152
+  title: "\u54C0",
153
+  ext: "gif"
154
+}, {
155
+  value: "137",
156
+  title: "\u9B3C",
157
+  ext: "gif"
158
+}, {
159
+  value: "138",
160
+  title: "\u6253\u51FB",
161
+  ext: "gif"
162
+}, {
163
+  value: "139",
164
+  title: "bye",
165
+  ext: "gif"
166
+}, {
167
+  value: "140",
168
+  title: "\u6C573",
169
+  ext: "gif"
170
+}, {
171
+  value: "141",
172
+  title: "\u62A0",
173
+  ext: "gif"
174
+}, {
175
+  value: "142",
176
+  title: "\u9F13\u638C",
177
+  ext: "gif"
178
+}, {
179
+  value: "143",
180
+  title: "\u7CDF\u7CD5",
181
+  ext: "gif"
182
+}, {
183
+  value: "144",
184
+  title: "\u6076\u641E",
185
+  ext: "gif"
186
+}, {
187
+  value: "145",
188
+  title: "\u4EC0\u4E48",
189
+  ext: "gif"
190
+}, {
191
+  value: "146",
192
+  title: "\u4EC0\u4E482",
193
+  ext: "gif"
194
+}, {
195
+  value: "147",
196
+  title: "\u7D2F2",
197
+  ext: "gif"
198
+}, {
199
+  value: "148",
200
+  title: "\u770B",
201
+  ext: "gif"
202
+}, {
203
+  value: "149",
204
+  title: "\u96BE\u8FC72",
205
+  ext: "gif"
206
+}, {
207
+  value: "150",
208
+  title: "\u96BE\u8FC73",
209
+  ext: "gif"
210
+}, {
211
+  value: "151",
212
+  title: "\u574F",
213
+  ext: "gif"
214
+}, {
215
+  value: "152",
216
+  title: "\u4EB2",
217
+  ext: "gif"
218
+}, {
219
+  value: "153",
220
+  title: "\u54132",
221
+  ext: "gif"
222
+}, {
223
+  value: "154",
224
+  title: "\u53EF\u601C",
225
+  ext: "gif"
226
+}, {
227
+  value: "45",
228
+  title: "\u5200",
229
+  ext: "gif"
230
+}, {
231
+  value: "156",
232
+  title: "\u6C34\u679C",
233
+  ext: "gif"
234
+}, {
235
+  value: "157",
236
+  title: "\u9152",
237
+  ext: "gif"
238
+}, {
239
+  value: "158",
240
+  title: "\u7BEE\u7403",
241
+  ext: "gif"
242
+}, {
243
+  value: "159",
244
+  title: "\u4E52\u4E53",
245
+  ext: "gif"
246
+}, {
247
+  value: "48",
248
+  title: "\u5496\u5561",
249
+  ext: "gif"
250
+}, {
251
+  value: "161",
252
+  title: "\u7F8E\u98DF",
253
+  ext: "gif"
254
+}, {
255
+  value: "162",
256
+  title: "\u52A8\u7269",
257
+  ext: "gif"
258
+}, {
259
+  value: "163",
260
+  title: "\u9C9C\u82B1",
261
+  ext: "gif"
262
+}, {
263
+  value: "164",
264
+  title: "\u67AF",
265
+  ext: "gif"
266
+}, {
267
+  value: "165",
268
+  title: "\u5507",
269
+  ext: "gif"
270
+}, {
271
+  value: "166",
272
+  title: "\u7231",
273
+  ext: "gif"
274
+}, {
275
+  value: "167",
276
+  title: "\u5206\u624B",
277
+  ext: "gif"
278
+}, {
279
+  value: "168",
280
+  title: "\u751F\u65E5",
281
+  ext: "gif"
282
+}, {
283
+  value: "169",
284
+  title: "\u7535",
285
+  ext: "gif"
286
+}, {
287
+  value: "170",
288
+  title: "\u70B8\u5F39",
289
+  ext: "gif"
290
+}, {
291
+  value: "171",
292
+  title: "\u5200\u5B50",
293
+  ext: "gif"
294
+}, {
295
+  value: "46",
296
+  title: "\u8DB3\u7403",
297
+  ext: "gif"
298
+}, {
299
+  value: "173",
300
+  title: "\u74E2\u866B",
301
+  ext: "gif"
302
+}, {
303
+  value: "174",
304
+  title: "\u7FD4",
305
+  ext: "gif"
306
+}, {
307
+  value: "175",
308
+  title: "\u6708\u4EAE",
309
+  ext: "gif"
310
+}, {
311
+  value: "176",
312
+  title: "\u592A\u9633",
313
+  ext: "gif"
314
+}, {
315
+  value: "177",
316
+  title: "\u793C\u7269",
317
+  ext: "gif"
318
+}, {
319
+  value: "178",
320
+  title: "\u62B1\u62B1",
321
+  ext: "gif"
322
+}, {
323
+  value: "179",
324
+  title: "\u62C7\u6307",
325
+  ext: "gif"
326
+}, {
327
+  value: "180",
328
+  title: "\u8D2C\u4F4E",
329
+  ext: "gif"
330
+}, {
331
+  value: "181",
332
+  title: "\u63E1\u624B",
333
+  ext: "gif"
334
+}, {
335
+  value: "182",
336
+  title: "\u526A\u5200\u624B",
337
+  ext: "gif"
338
+}, {
339
+  value: "183",
340
+  title: "\u62B1\u62F3",
341
+  ext: "gif"
342
+}, {
343
+  value: "184",
344
+  title: "\u52FE\u5F15",
345
+  ext: "gif"
346
+}, {
347
+  value: "185",
348
+  title: "\u62F3\u5934",
349
+  ext: "gif"
350
+}, {
351
+  value: "186",
352
+  title: "\u5C0F\u62C7\u6307",
353
+  ext: "gif"
354
+}, {
355
+  value: "187",
356
+  title: "\u62C7\u6307\u516B",
357
+  ext: "gif"
358
+}, {
359
+  value: "188",
360
+  title: "\u98DF\u6307",
361
+  ext: "gif"
362
+}, {
363
+  value: "189",
364
+  title: "ok",
365
+  ext: "gif"
366
+}, {
367
+  value: "190",
368
+  title: "\u60C5\u4FA3",
369
+  ext: "gif"
370
+}, {
371
+  value: "52",
372
+  title: "\u7231\u5FC3",
373
+  ext: "gif"
374
+}, {
375
+  value: "192",
376
+  title: "\u8E66\u54D2",
377
+  ext: "gif"
378
+}, {
379
+  value: "193",
380
+  title: "\u98A4\u6296",
381
+  ext: "gif"
382
+}, {
383
+  value: "194",
384
+  title: "\u6004\u6C14",
385
+  ext: "gif"
386
+}, {
387
+  value: "195",
388
+  title: "\u8DF3\u821E",
389
+  ext: "gif"
390
+}, {
391
+  value: "196",
392
+  title: "\u53D1\u54462",
393
+  ext: "gif"
394
+}, {
395
+  value: "197",
396
+  title: "\u80CC\u7740",
397
+  ext: "gif"
398
+}, {
399
+  value: "198",
400
+  title: "\u4F38\u624B",
401
+  ext: "gif"
402
+}, {
403
+  value: "199",
404
+  title: "\u800D\u5E05",
405
+  ext: "gif"
406
+}, {
407
+  value: "201",
408
+  title: "\u751F\u75C5",
409
+  ext: "png"
410
+}, {
411
+  value: "202",
412
+  title: "\u54ED\u6CE3",
413
+  ext: "png"
414
+}, {
415
+  value: "203",
416
+  title: "\u5410\u820C",
417
+  ext: "png"
418
+}, {
419
+  value: "204",
420
+  title: "\u8FF7\u7CCA",
421
+  ext: "png"
422
+}, {
423
+  value: "205",
424
+  title: "\u77AA\u773C",
425
+  ext: "png"
426
+}, {
427
+  value: "206",
428
+  title: "\u6050\u6016",
429
+  ext: "png"
430
+}, {
431
+  value: "207",
432
+  title: "\u5FE7\u6101",
433
+  ext: "png"
434
+}, {
435
+  value: "208",
436
+  title: "\u7728\u7709",
437
+  ext: "png"
438
+}, {
439
+  value: "209",
440
+  title: "\u95ED\u773C",
441
+  ext: "png"
442
+}, {
443
+  value: "210",
444
+  title: "\u9119\u89C6",
445
+  ext: "png"
446
+}, {
447
+  value: "211",
448
+  title: "\u9634\u6697",
449
+  ext: "png"
450
+}, {
451
+  value: "212",
452
+  title: "\u5C0F\u9B3C",
453
+  ext: "png"
454
+}, {
455
+  value: "213",
456
+  title: "\u793C\u72692",
457
+  ext: "png"
458
+}, {
459
+  value: "214",
460
+  title: "\u62DC\u4F5B",
461
+  ext: "png"
462
+}, {
463
+  value: "215",
464
+  title: "\u529B\u91CF",
465
+  ext: "png"
466
+}, {
467
+  value: "216",
468
+  title: "\u91D1\u94B1",
469
+  ext: "png"
470
+}, {
471
+  value: "217",
472
+  title: "\u86CB\u7CD5",
473
+  ext: "png"
474
+}, {
475
+  value: "218",
476
+  title: "\u5F69\u5E26",
477
+  ext: "png"
478
+}, {
479
+  value: "219",
480
+  title: "\u793C\u72693",
481
+  ext: "png"
482
+}, {
7 483
   value: "0",
8
-  title: "捶地"
484
+  title: "\u6376\u5730",
485
+  ext: "gif"
9 486
 }, {
10 487
   value: "1",
11
-  title: "怀疑"
488
+  title: "\u6000\u7591",
489
+  ext: "gif"
12 490
 }, {
13 491
   value: "2",
14
-  title: "撇嘴"
492
+  title: "\u6487\u5634",
493
+  ext: "gif"
15 494
 }, {
16 495
   value: "3",
17
-  title: "色"
18
-}, {
19
-  value: "4",
20
-  title: "发呆"
21
-}, {
22
-  value: "5",
23
-  title: "酷"
496
+  title: "\u8272",
497
+  ext: "gif"
24 498
 }, {
25 499
   value: "6",
26
-  title: "害羞"
500
+  title: "\u5BB3\u7F9E",
501
+  ext: "gif"
27 502
 }, {
28 503
   value: "7",
29
-  title: "闭嘴"
504
+  title: "\u95ED\u5634",
505
+  ext: "gif"
30 506
 }, {
31 507
   value: "8",
32
-  title: "睡觉"
508
+  title: "\u7761\u89C9",
509
+  ext: "gif"
33 510
 }, {
34 511
   value: "9",
35
-  title: "大哭"
512
+  title: "\u5927\u54ED",
513
+  ext: "gif"
36 514
 }, {
37 515
   value: "10",
38
-  title: "尴尬"
516
+  title: "\u5C34\u5C2C",
517
+  ext: "gif"
39 518
 }, {
40 519
   value: "11",
41
-  title: "发怒"
42
-}, {
43
-  value: "12",
44
-  title: "调皮"
520
+  title: "\u53D1\u6012",
521
+  ext: "gif"
45 522
 }, {
46 523
   value: "13",
47
-  title: "呲牙"
48
-}, {
49
-  value: "14",
50
-  title: "微笑"
51
-}, {
52
-  value: "15",
53
-  title: "难过"
524
+  title: "\u5472\u7259",
525
+  ext: "gif"
54 526
 }, {
55 527
   value: "16",
56
-  title: "帅呆"
528
+  title: "\u5E05\u5446",
529
+  ext: "gif"
57 530
 }, {
58 531
   value: "17",
59
-  title: "折磨"
60
-}, {
61
-  value: "18",
62
-  title: "吐"
532
+  title: "\u6298\u78E8",
533
+  ext: "gif"
63 534
 }, {
64 535
   value: "19",
65
-  title: "偷笑"
536
+  title: "\u5077\u7B11",
537
+  ext: "gif"
66 538
 }, {
67 539
   value: "20",
68
-  title: "可爱"
540
+  title: "\u53EF\u7231",
541
+  ext: "gif"
69 542
 }, {
70 543
   value: "21",
71
-  title: "白眼"
544
+  title: "\u767D\u773C",
545
+  ext: "gif"
72 546
 }, {
73 547
   value: "22",
74
-  title: "傲慢"
548
+  title: "\u50B2\u6162",
549
+  ext: "gif"
75 550
 }, {
76 551
   value: "23",
77
-  title: "嘴馋"
552
+  title: "\u5634\u998B",
553
+  ext: "gif"
78 554
 }, {
79 555
   value: "24",
80
-  title: "困"
556
+  title: "\u56F0",
557
+  ext: "gif"
81 558
 }, {
82 559
   value: "25",
83
-  title: "恐慌"
560
+  title: "\u6050\u614C",
561
+  ext: "gif"
84 562
 }, {
85 563
   value: "26",
86
-  title: "流汗"
564
+  title: "\u6D41\u6C57",
565
+  ext: "gif"
87 566
 }, {
88 567
   value: "27",
89
-  title: "憨笑"
568
+  title: "\u61A8\u7B11",
569
+  ext: "gif"
90 570
 }, {
91 571
   value: "28",
92
-  title: "大兵"
572
+  title: "\u5927\u5175",
573
+  ext: "gif"
93 574
 }, {
94 575
   value: "29",
95
-  title: "奋斗"
96
-}, {
97
-  value: "30",
98
-  title: "疑问"
576
+  title: "\u594B\u6597",
577
+  ext: "gif"
99 578
 }, {
100 579
   value: "31",
101
-  title: "嘘"
580
+  title: "\u5618",
581
+  ext: "gif"
102 582
 }, {
103 583
   value: "32",
104
-  title: "晕"
584
+  title: "\u6655",
585
+  ext: "gif"
105 586
 }, {
106 587
   value: "33",
107
-  title: "被炸了"
588
+  title: "\u88AB\u70B8\u4E86",
589
+  ext: "gif"
108 590
 }, {
109 591
   value: "34",
110
-  title: "骷髅"
592
+  title: "\u9AB7\u9AC5",
593
+  ext: "gif"
111 594
 }, {
112 595
   value: "35",
113
-  title: "敲打"
596
+  title: "\u6572\u6253",
597
+  ext: "gif"
114 598
 }, {
115 599
   value: "36",
116
-  title: "拜拜"
600
+  title: "\u62DC\u62DC",
601
+  ext: "gif"
117 602
 }, {
118 603
   value: "37",
119
-  title: "发抖"
604
+  title: "\u53D1\u6296",
605
+  ext: "gif"
120 606
 }, {
121 607
   value: "38",
122
-  title: "亲密"
608
+  title: "\u4EB2\u5BC6",
609
+  ext: "gif"
123 610
 }, {
124 611
   value: "39",
125
-  title: "跳"
612
+  title: "\u8DF3",
613
+  ext: "gif"
126 614
 }, {
127 615
   value: "40",
128
-  title: "猪头"
616
+  title: "\u732A\u5934",
617
+  ext: "gif"
129 618
 }, {
130 619
   value: "41",
131
-  title: "拥抱"
620
+  title: "\u62E5\u62B1",
621
+  ext: "gif"
132 622
 }, {
133 623
   value: "42",
134
-  title: "生日蛋糕"
624
+  title: "\u751F\u65E5\u86CB\u7CD5",
625
+  ext: "gif"
135 626
 }, {
136 627
   value: "43",
137
-  title: "闪电"
628
+  title: "\u95EA\u7535",
629
+  ext: "gif"
138 630
 }, {
139 631
   value: "44",
140
-  title: "地雷"
141
-}, {
142
-  value: "45",
143
-  title: "刀"
144
-}, {
145
-  value: "46",
146
-  title: "足球"
632
+  title: "\u5730\u96F7",
633
+  ext: "gif"
147 634
 }, {
148 635
   value: "47",
149
-  title: "便便"
150
-}, {
151
-  value: "48",
152
-  title: "咖啡"
636
+  title: "\u4FBF\u4FBF",
637
+  ext: "gif"
153 638
 }, {
154 639
   value: "49",
155
-  title: "米饭"
640
+  title: "\u7C73\u996D",
641
+  ext: "gif"
156 642
 }, {
157 643
   value: "50",
158
-  title: "玫瑰"
644
+  title: "\u73AB\u7470",
645
+  ext: "gif"
159 646
 }, {
160 647
   value: "51",
161
-  title: "枯萎玫瑰"
162
-}, {
163
-  value: "52",
164
-  title: "爱心"
648
+  title: "\u67AF\u840E\u73AB\u7470",
649
+  ext: "gif"
165 650
 }, {
166 651
   value: "53",
167
-  title: "心碎"
652
+  title: "\u5FC3\u788E",
653
+  ext: "gif"
168 654
 }];
169 655
 
170
-var prefixUrl = exports.prefixUrl = "https://a.links123.cn/site/src/feed/imgs/qq/";
656
+var prefixUrl = exports.prefixUrl = "https://a.links123.cn/site/src/feed/imgs/comment/";
171 657
 
172 658
 var ext = exports.ext = "gif";
173 659
 

+ 1
- 1
lib/emoji.js.map
文件差異過大導致無法顯示
查看文件


+ 3
- 3
lib/helper.js 查看文件

@@ -75,9 +75,9 @@ function renderContent(content, onClick) {
75 75
       return "<br/><img src=\"" + src + "\" alt=\"" + src + "\" style=\"max-width: 100%\" />";
76 76
     }
77 77
     // 如果不存在对应的表情, 则返回原文
78
-    if (emojiObejct[src]) {
79
-      var value = emojiObejct[src].value;
80
-      return "<img src=\"" + _emoji.prefixUrl + value + "." + _emoji.ext + "\" alt=\"" + value + "\" />";
78
+    var emoji = emojiObejct[src];
79
+    if (emoji) {
80
+      return "<img src=\"" + _emoji.prefixUrl + emoji.value + "." + emoji.ext + "\" alt=\"" + emoji.title + "\" />";
81 81
     }
82 82
     return "[" + src + "]";
83 83
   }).replace(/\n/g, "<br />");

+ 1
- 1
lib/helper.js.map 查看文件

@@ -1 +1 @@
1
-{"version":3,"sources":["../src/helper.js"],"names":["isFunction","isUrl","arrayToObject","htmlEncode","renderContent","emojiObejct","emoji","functionToCheck","toString","call","userInput","regexp","res","match","array","keyField","reduce","obj","item","str","replace","i","charCodeAt","content","onClick","newContent","indexOf","IMAGE_SPLIT","split","pop","join","REGEXP","a","b","src","slice","value","prefixUrl","ext"],"mappings":";;;;;QAKgBA,U,GAAAA,U;QAMAC,K,GAAAA,K;QAYAC,a,GAAAA,a;QAYAC,U,GAAAA,U;QAYAC,a,GAAAA,a;;AA/ChB;;AACA;;;;;;AAEA,IAAMC,cAAcH,cAAcI,eAAd,EAAqB,OAArB,CAApB;;AAEO,SAASN,UAAT,CAAoBO,eAApB,EAAqC;AAC1C,SACEA,mBAAmB,GAAGC,QAAH,CAAYC,IAAZ,CAAiBF,eAAjB,MAAsC,mBAD3D;AAGD;;AAEM,SAASN,KAAT,CAAeS,SAAf,EAA0B;AAC/B,MAAMC,SAAS,kGAAf;AACA,MAAIC,MAAMF,UAAUG,KAAV,CAAgBF,MAAhB,CAAV;AACA,MAAIC,QAAQ,IAAZ,EAAkB,OAAO,KAAP,CAAlB,KACK,OAAO,IAAP;AACN;;AAED;;;;;AAKO,SAASV,aAAT,CAAuBY,KAAvB,EAA8BC,QAA9B,EAAwC;AAC7C,SAAOD,MAAME,MAAN,CAAa,UAACC,GAAD,EAAMC,IAAN,EAAe;AACjCD,QAAIC,KAAKH,QAAL,CAAJ,IAAsBG,IAAtB;AACA,WAAOD,GAAP;AACD,GAHM,EAGJ,EAHI,CAAP;AAID;;AAED;;;;;AAKO,SAASd,UAAT,CAAoBgB,GAApB,EAAyB;AAC9B,MAAI,CAACA,GAAL,EAAU,OAAO,EAAP;AACV,SAAOA,IAAIC,OAAJ,CAAY,SAAZ,EAAuB,UAAUC,CAAV,EAAa;AACzC,WAAO,OAAOA,EAAEC,UAAF,CAAa,CAAb,CAAP,GAAyB,GAAhC;AACD,GAFM,CAAP;AAGD;;AAED;;;;;AAKO,SAASlB,aAAT,CAAuBmB,OAAvB,EAAgCC,OAAhC,EAAyC;AAC9C,MAAIC,aAAaF,OAAjB;AACA,MAAIE,WAAWC,OAAX,CAAmBC,qBAAnB,MAAoC,CAAC,CAAzC,EAA4C;AAC1CF,iBAAaA,WAAWG,KAAX,CAAiBD,qBAAjB,CAAb;AACAF,eAAWI,GAAX;AACAJ,iBAAaA,WAAWK,IAAX,CAAgB,EAAhB,CAAb;AACD;;AAED,SAAO3B,WAAWsB,UAAX,EACJL,OADI,CACIW,gBADJ,EACY,UAAUC,CAAV,EAAaC,CAAb,EAAgB;AAC/B,QAAMC,MAAMF,EAAEG,KAAF,CAAQ,CAAR,EAAW,CAAC,CAAZ,CAAZ;;AAEA;AACA;AACA,QAAIlC,MAAMiC,GAAN,CAAJ,EAAgB;AACd,kCAAyBA,GAAzB,iBAAsCA,GAAtC;AACD;AACD;AACA,QAAI7B,YAAY6B,GAAZ,CAAJ,EAAsB;AACpB,UAAME,QAAQ/B,YAAY6B,GAAZ,EAAiBE,KAA/B;AACA,6BAAoBC,gBAApB,GAAgCD,KAAhC,SAAyCE,UAAzC,iBAAsDF,KAAtD;AACD;AACD,iBAAWF,GAAX;AACD,GAfI,EAgBJd,OAhBI,CAgBI,KAhBJ,EAgBW,QAhBX,CAAP;AAiBD","file":"helper.js","sourcesContent":["import { REGEXP, IMAGE_SPLIT } from \"./constant\";\r\nimport emoji, { prefixUrl, ext } from \"./emoji\";\r\n\r\nconst emojiObejct = arrayToObject(emoji, \"title\");\r\n\r\nexport function isFunction(functionToCheck) {\r\n  return (\r\n    functionToCheck && {}.toString.call(functionToCheck) === \"[object Function]\"\r\n  );\r\n}\r\n\r\nexport function isUrl(userInput) {\r\n  const regexp = /(http(s)?:\\/\\/.)?(www\\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\\.[a-z]{2,6}\\b([-a-zA-Z0-9@:%_+.~#?&//=]*)/g;\r\n  var res = userInput.match(regexp);\r\n  if (res === null) return false;\r\n  else return true;\r\n}\r\n\r\n/**\r\n * 将对象数组转换为对象\r\n * @param {array} array Array of Objects\r\n * @param {string} keyField string\r\n */\r\nexport function arrayToObject(array, keyField) {\r\n  return array.reduce((obj, item) => {\r\n    obj[item[keyField]] = item;\r\n    return obj;\r\n  }, {});\r\n}\r\n\r\n/**\r\n * HTML 编码\r\n * 将 < > 等字符串进行编码\r\n * @param {string} str 文本\r\n */\r\nexport function htmlEncode(str) {\r\n  if (!str) return \"\";\r\n  return str.replace(/[<>]/gim, function (i) {\r\n    return \"&#\" + i.charCodeAt(0) + \";\";\r\n  });\r\n}\r\n\r\n/**\r\n * 渲染编辑器\r\n * [x] => <img src=\"x\" />\r\n * @param {strig} content\r\n */\r\nexport function renderContent(content, onClick) {\r\n  let newContent = content;\r\n  if (newContent.indexOf(IMAGE_SPLIT) !== -1) {\r\n    newContent = newContent.split(IMAGE_SPLIT);\r\n    newContent.pop();\r\n    newContent = newContent.join(\"\");\r\n  }\r\n\r\n  return htmlEncode(newContent)\r\n    .replace(REGEXP, function (a, b) {\r\n      const src = a.slice(1, -1);\r\n\r\n      // 兼容旧的评\r\n      // 因为旧的评论用 [img url] 方式存储的\r\n      if (isUrl(src)) {\r\n        return `<br/><img src=\"${src}\" alt=\"${src}\" style=\"max-width: 100%\" />`;\r\n      }\r\n      // 如果不存在对应的表情, 则返回原文\r\n      if (emojiObejct[src]) {\r\n        const value = emojiObejct[src].value;\r\n        return `<img src=\"${prefixUrl}${value}.${ext}\" alt=\"${value}\" />`;\r\n      }\r\n      return `[${src}]`;\r\n    })\r\n    .replace(/\\n/g, \"<br />\");\r\n}\r\n"]}
1
+{"version":3,"sources":["../src/helper.js"],"names":["isFunction","isUrl","arrayToObject","htmlEncode","renderContent","emojiObejct","emoji","functionToCheck","toString","call","userInput","regexp","res","match","array","keyField","reduce","obj","item","str","replace","i","charCodeAt","content","onClick","newContent","indexOf","IMAGE_SPLIT","split","pop","join","REGEXP","a","b","src","slice","prefixUrl","value","ext","title"],"mappings":";;;;;QAKgBA,U,GAAAA,U;QAMAC,K,GAAAA,K;QAYAC,a,GAAAA,a;QAYAC,U,GAAAA,U;QAYAC,a,GAAAA,a;;AA/ChB;;AACA;;;;;;AAEA,IAAMC,cAAcH,cAAcI,eAAd,EAAqB,OAArB,CAApB;;AAEO,SAASN,UAAT,CAAoBO,eAApB,EAAqC;AAC1C,SACEA,mBAAmB,GAAGC,QAAH,CAAYC,IAAZ,CAAiBF,eAAjB,MAAsC,mBAD3D;AAGD;;AAEM,SAASN,KAAT,CAAeS,SAAf,EAA0B;AAC/B,MAAMC,SAAS,kGAAf;AACA,MAAIC,MAAMF,UAAUG,KAAV,CAAgBF,MAAhB,CAAV;AACA,MAAIC,QAAQ,IAAZ,EAAkB,OAAO,KAAP,CAAlB,KACK,OAAO,IAAP;AACN;;AAED;;;;;AAKO,SAASV,aAAT,CAAuBY,KAAvB,EAA8BC,QAA9B,EAAwC;AAC7C,SAAOD,MAAME,MAAN,CAAa,UAACC,GAAD,EAAMC,IAAN,EAAe;AACjCD,QAAIC,KAAKH,QAAL,CAAJ,IAAsBG,IAAtB;AACA,WAAOD,GAAP;AACD,GAHM,EAGJ,EAHI,CAAP;AAID;;AAED;;;;;AAKO,SAASd,UAAT,CAAoBgB,GAApB,EAAyB;AAC9B,MAAI,CAACA,GAAL,EAAU,OAAO,EAAP;AACV,SAAOA,IAAIC,OAAJ,CAAY,SAAZ,EAAuB,UAASC,CAAT,EAAY;AACxC,WAAO,OAAOA,EAAEC,UAAF,CAAa,CAAb,CAAP,GAAyB,GAAhC;AACD,GAFM,CAAP;AAGD;;AAED;;;;;AAKO,SAASlB,aAAT,CAAuBmB,OAAvB,EAAgCC,OAAhC,EAAyC;AAC9C,MAAIC,aAAaF,OAAjB;AACA,MAAIE,WAAWC,OAAX,CAAmBC,qBAAnB,MAAoC,CAAC,CAAzC,EAA4C;AAC1CF,iBAAaA,WAAWG,KAAX,CAAiBD,qBAAjB,CAAb;AACAF,eAAWI,GAAX;AACAJ,iBAAaA,WAAWK,IAAX,CAAgB,EAAhB,CAAb;AACD;;AAED,SAAO3B,WAAWsB,UAAX,EACJL,OADI,CACIW,gBADJ,EACY,UAASC,CAAT,EAAYC,CAAZ,EAAe;AAC9B,QAAMC,MAAMF,EAAEG,KAAF,CAAQ,CAAR,EAAW,CAAC,CAAZ,CAAZ;;AAEA;AACA;AACA,QAAIlC,MAAMiC,GAAN,CAAJ,EAAgB;AACd,kCAAyBA,GAAzB,iBAAsCA,GAAtC;AACD;AACD;AACA,QAAM5B,QAAQD,YAAY6B,GAAZ,CAAd;AACA,QAAI5B,KAAJ,EAAW;AACT,6BAAoB8B,gBAApB,GAAgC9B,MAAM+B,KAAtC,SAA+C/B,MAAMgC,GAArD,iBAAkEhC,MAAMiC,KAAxE;AACD;AACD,iBAAWL,GAAX;AACD,GAfI,EAgBJd,OAhBI,CAgBI,KAhBJ,EAgBW,QAhBX,CAAP;AAiBD","file":"helper.js","sourcesContent":["import { REGEXP, IMAGE_SPLIT } from \"./constant\";\r\nimport emoji, { prefixUrl } from \"./emoji\";\r\n\r\nconst emojiObejct = arrayToObject(emoji, \"title\");\r\n\r\nexport function isFunction(functionToCheck) {\r\n  return (\r\n    functionToCheck && {}.toString.call(functionToCheck) === \"[object Function]\"\r\n  );\r\n}\r\n\r\nexport function isUrl(userInput) {\r\n  const regexp = /(http(s)?:\\/\\/.)?(www\\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\\.[a-z]{2,6}\\b([-a-zA-Z0-9@:%_+.~#?&//=]*)/g;\r\n  var res = userInput.match(regexp);\r\n  if (res === null) return false;\r\n  else return true;\r\n}\r\n\r\n/**\r\n * 将对象数组转换为对象\r\n * @param {array} array Array of Objects\r\n * @param {string} keyField string\r\n */\r\nexport function arrayToObject(array, keyField) {\r\n  return array.reduce((obj, item) => {\r\n    obj[item[keyField]] = item;\r\n    return obj;\r\n  }, {});\r\n}\r\n\r\n/**\r\n * HTML 编码\r\n * 将 < > 等字符串进行编码\r\n * @param {string} str 文本\r\n */\r\nexport function htmlEncode(str) {\r\n  if (!str) return \"\";\r\n  return str.replace(/[<>]/gim, function(i) {\r\n    return \"&#\" + i.charCodeAt(0) + \";\";\r\n  });\r\n}\r\n\r\n/**\r\n * 渲染编辑器\r\n * [x] => <img src=\"x\" />\r\n * @param {strig} content\r\n */\r\nexport function renderContent(content, onClick) {\r\n  let newContent = content;\r\n  if (newContent.indexOf(IMAGE_SPLIT) !== -1) {\r\n    newContent = newContent.split(IMAGE_SPLIT);\r\n    newContent.pop();\r\n    newContent = newContent.join(\"\");\r\n  }\r\n\r\n  return htmlEncode(newContent)\r\n    .replace(REGEXP, function(a, b) {\r\n      const src = a.slice(1, -1);\r\n\r\n      // 兼容旧的评\r\n      // 因为旧的评论用 [img url] 方式存储的\r\n      if (isUrl(src)) {\r\n        return `<br/><img src=\"${src}\" alt=\"${src}\" style=\"max-width: 100%\" />`;\r\n      }\r\n      // 如果不存在对应的表情, 则返回原文\r\n      const emoji = emojiObejct[src];\r\n      if (emoji) {\r\n        return `<img src=\"${prefixUrl}${emoji.value}.${emoji.ext}\" alt=\"${emoji.title}\" />`;\r\n      }\r\n      return `[${src}]`;\r\n    })\r\n    .replace(/\\n/g, \"<br />\");\r\n}\r\n"]}

+ 1
- 1
package.json 查看文件

@@ -1,6 +1,6 @@
1 1
 {
2 2
   "name": "comment",
3
-  "version": "0.5.9",
3
+  "version": "0.5.10",
4 4
   "main": "lib/App.js",
5 5
   "description": "通用评论",
6 6
   "keywords": [

+ 27
- 49
src/components/Editor/Emoji.js 查看文件

@@ -1,6 +1,6 @@
1 1
 import React from "react";
2 2
 import { Carousel } from "antd";
3
-import emoji, { prefixUrl, ext } from "../../emoji";
3
+import emoji, { prefixUrl } from "../../emoji";
4 4
 import "./Emoji.css";
5 5
 // 每页 20  5*4
6 6
 // 共 20 * 3 = 60 (实际是 54)
@@ -8,58 +8,36 @@ import "./Emoji.css";
8 8
 // class Emoji
9 9
 
10 10
 const Emoji = ({ onClick }) => {
11
-  const content = [[], [], []];
12
-
13
-  for (let i = 0; i < emoji.length; i++) {
14
-    if (i < 20) {
15
-      content[0].push(emoji[i]);
16
-    } else if (i < 40) {
17
-      content[1].push(emoji[i]);
18
-    } else if (i < emoji.length) {
19
-      content[2].push(emoji[i]);
11
+  const content = [];
12
+  let curPage = [];
13
+  for (let i = 0; i < 115; i++) {
14
+    if (curPage.length < 20) {
15
+      curPage.push(emoji[i]);
16
+    } else {
17
+      content.push(curPage);
18
+      curPage = [];
20 19
     }
21 20
   }
21
+  if (curPage.length > 0) {
22
+    content.push(curPage);
23
+  }
22 24
   return (
23 25
     <Carousel>
24
-      <div>
25
-        {content[0].map((item, index) => (
26
-          <div className="item" key={item.value}>
27
-            <span className="helper" />
28
-            <img
29
-              src={`${prefixUrl}${item.value}.${ext}`}
30
-              alt={item.title}
31
-              style={{ display: "inline-block" }}
32
-              onClick={() => onClick(item.title)}
33
-            />
34
-          </div>
35
-        ))}
36
-      </div>
37
-      <div>
38
-        {content[1].map((item, index) => (
39
-          <div className="item" key={item.value}>
40
-            <span className="helper" />
41
-            <img
42
-              src={`${prefixUrl}${item.value}.${ext}`}
43
-              alt={item.title}
44
-              style={{ display: "inline-block" }}
45
-              onClick={() => onClick(item.title)}
46
-            />
47
-          </div>
48
-        ))}
49
-      </div>
50
-      <div>
51
-        {content[2].map(item => (
52
-          <div className="item" key={item.value}>
53
-            <span className="helper" />
54
-            <img
55
-              src={`${prefixUrl}${item.value}.${ext}`}
56
-              alt={item.title}
57
-              style={{ display: "inline-block" }}
58
-              onClick={() => onClick(item.title)}
59
-            />
60
-          </div>
61
-        ))}
62
-      </div>
26
+      {content.map((page, index) => (
27
+        <div key={index}>
28
+          {page.map((item, index) => (
29
+            <div className="item" key={item.value}>
30
+              <span className="helper" />
31
+              <img
32
+                src={`${prefixUrl}${item.value}.${item.ext}`}
33
+                alt={item.title}
34
+                style={{ display: "inline-block" }}
35
+                onClick={() => onClick(item.title)}
36
+              />
37
+            </div>
38
+          ))}
39
+        </div>
40
+      ))}
63 41
     </Carousel>
64 42
   );
65 43
 };

+ 680
- 88
src/emoji.js 查看文件

@@ -1,225 +1,817 @@
1 1
 const emoji = [
2 2
   {
3
-    value: "0",
4
-    title: "捶地"
3
+    value: "14",
4
+    title: "\u5fae\u7b11",
5
+    ext: "gif"
5 6
   },
6 7
   {
7
-    value: "1",
8
-    title: "怀疑"
8
+    value: "101",
9
+    title: "撇嘴",
10
+    ext: "gif"
9 11
   },
10
-
11 12
   {
12
-    value: "2",
13
-    title: "撇嘴"
13
+    value: "102",
14
+    title: "色",
15
+    ext: "gif"
14 16
   },
15 17
   {
16
-    value: "3",
17
-    title: "色"
18
+    value: "4",
19
+    title: "\u53d1\u5446",
20
+    ext: "gif"
18 21
   },
19 22
   {
20
-    value: "4",
21
-    title: "发呆"
23
+    value: "104",
24
+    title: "\u58a8\u955c",
25
+    ext: "gif"
22 26
   },
23 27
   {
24
-    value: "5",
25
-    title: "酷"
28
+    value: "105",
29
+    title: "\u54ed",
30
+    ext: "gif"
26 31
   },
27 32
   {
28
-    value: "6",
29
-    title: "害羞"
33
+    value: "106",
34
+    title: "害羞",
35
+    ext: "gif"
30 36
   },
31
-
32 37
   {
33
-    value: "7",
34
-    title: "闭嘴"
38
+    value: "107",
39
+    title: "闭嘴",
40
+    ext: "gif"
35 41
   },
36 42
   {
37
-    value: "8",
38
-    title: "睡觉"
43
+    value: "108",
44
+    title: "睡觉",
45
+    ext: "gif"
39 46
   },
40 47
   {
41
-    value: "9",
42
-    title: "大哭"
48
+    value: "109",
49
+    title: "\u54ed2",
50
+    ext: "gif"
43 51
   },
44 52
   {
45
-    value: "10",
46
-    title: "尴尬"
53
+    value: "110",
54
+    title: "尴尬",
55
+    ext: "gif"
47 56
   },
48 57
   {
49
-    value: "11",
50
-    title: "发怒"
58
+    value: "111",
59
+    title: "发怒",
60
+    ext: "gif"
51 61
   },
52 62
   {
53 63
     value: "12",
54
-    title: "调皮"
64
+    title: "\u8c03\u76ae",
65
+    ext: "gif"
55 66
   },
56 67
   {
57
-    value: "13",
58
-    title: "呲牙"
68
+    value: "113",
69
+    title: "呲牙",
70
+    ext: "gif"
59 71
   },
60 72
   {
61
-    value: "14",
62
-    title: "微笑"
73
+    value: "114",
74
+    title: "怀疑",
75
+    ext: "gif"
63 76
   },
64 77
   {
65 78
     value: "15",
66
-    title: "难过"
79
+    title: "\u96be\u8fc7",
80
+    ext: "gif"
67 81
   },
68 82
   {
69
-    value: "16",
70
-    title: "帅呆"
83
+    value: "5",
84
+    title: "\u9177",
85
+    ext: "gif"
71 86
   },
72 87
   {
73
-    value: "17",
74
-    title: "折磨"
88
+    value: "117",
89
+    title: "\u6c57",
90
+    ext: "gif"
91
+  },
92
+  {
93
+    value: "118",
94
+    title: "\u6293\u72c2",
95
+    ext: "gif"
75 96
   },
76 97
   {
77 98
     value: "18",
78
-    title: "吐"
99
+    title: "\u5410",
100
+    ext: "gif"
101
+  },
102
+  {
103
+    value: "120",
104
+    title: "\u7b112",
105
+    ext: "gif"
106
+  },
107
+  {
108
+    value: "121",
109
+    title: "\u5feb\u4e50",
110
+    ext: "gif"
111
+  },
112
+  {
113
+    value: "122",
114
+    title: "\u5947",
115
+    ext: "gif"
116
+  },
117
+  {
118
+    value: "123",
119
+    title: "\u50b2",
120
+    ext: "gif"
121
+  },
122
+  {
123
+    value: "124",
124
+    title: "\u997f",
125
+    ext: "gif"
126
+  },
127
+  {
128
+    value: "125",
129
+    title: "\u7d2f",
130
+    ext: "gif"
131
+  },
132
+  {
133
+    value: "126",
134
+    title: "\u5413",
135
+    ext: "gif"
136
+  },
137
+  {
138
+    value: "127",
139
+    title: "\u6c572",
140
+    ext: "gif"
141
+  },
142
+  {
143
+    value: "128",
144
+    title: "\u9ad8\u5174",
145
+    ext: "gif"
146
+  },
147
+  {
148
+    value: "129",
149
+    title: "\u95f2",
150
+    ext: "gif"
151
+  },
152
+  {
153
+    value: "130",
154
+    title: "\u52aa\u529b",
155
+    ext: "gif"
156
+  },
157
+  {
158
+    value: "131",
159
+    title: "\u9a82",
160
+    ext: "gif"
161
+  },
162
+  {
163
+    value: "30",
164
+    title: "\u7591\u95ee",
165
+    ext: "gif"
166
+  },
167
+  {
168
+    value: "133",
169
+    title: "\u79d8\u5bc6",
170
+    ext: "gif"
171
+  },
172
+  {
173
+    value: "134",
174
+    title: "\u4e71",
175
+    ext: "gif"
176
+  },
177
+  {
178
+    value: "135",
179
+    title: "\u75af",
180
+    ext: "gif"
181
+  },
182
+  {
183
+    value: "136",
184
+    title: "\u54c0",
185
+    ext: "gif"
186
+  },
187
+  {
188
+    value: "137",
189
+    title: "\u9b3c",
190
+    ext: "gif"
191
+  },
192
+  {
193
+    value: "138",
194
+    title: "\u6253\u51fb",
195
+    ext: "gif"
196
+  },
197
+  {
198
+    value: "139",
199
+    title: "bye",
200
+    ext: "gif"
201
+  },
202
+  {
203
+    value: "140",
204
+    title: "\u6c573",
205
+    ext: "gif"
206
+  },
207
+  {
208
+    value: "141",
209
+    title: "\u62a0",
210
+    ext: "gif"
211
+  },
212
+  {
213
+    value: "142",
214
+    title: "\u9f13\u638c",
215
+    ext: "gif"
216
+  },
217
+  {
218
+    value: "143",
219
+    title: "\u7cdf\u7cd5",
220
+    ext: "gif"
221
+  },
222
+  {
223
+    value: "144",
224
+    title: "\u6076\u641e",
225
+    ext: "gif"
226
+  },
227
+  {
228
+    value: "145",
229
+    title: "\u4ec0\u4e48",
230
+    ext: "gif"
231
+  },
232
+  {
233
+    value: "146",
234
+    title: "\u4ec0\u4e482",
235
+    ext: "gif"
236
+  },
237
+  {
238
+    value: "147",
239
+    title: "\u7d2f2",
240
+    ext: "gif"
241
+  },
242
+  {
243
+    value: "148",
244
+    title: "\u770b",
245
+    ext: "gif"
246
+  },
247
+  {
248
+    value: "149",
249
+    title: "\u96be\u8fc72",
250
+    ext: "gif"
251
+  },
252
+  {
253
+    value: "150",
254
+    title: "\u96be\u8fc73",
255
+    ext: "gif"
256
+  },
257
+  {
258
+    value: "151",
259
+    title: "\u574f",
260
+    ext: "gif"
261
+  },
262
+  {
263
+    value: "152",
264
+    title: "\u4eb2",
265
+    ext: "gif"
266
+  },
267
+  {
268
+    value: "153",
269
+    title: "\u54132",
270
+    ext: "gif"
271
+  },
272
+  {
273
+    value: "154",
274
+    title: "\u53ef\u601c",
275
+    ext: "gif"
276
+  },
277
+  {
278
+    value: "45",
279
+    title: "\u5200",
280
+    ext: "gif"
281
+  },
282
+  {
283
+    value: "156",
284
+    title: "\u6c34\u679c",
285
+    ext: "gif"
286
+  },
287
+  {
288
+    value: "157",
289
+    title: "\u9152",
290
+    ext: "gif"
291
+  },
292
+  {
293
+    value: "158",
294
+    title: "\u7bee\u7403",
295
+    ext: "gif"
296
+  },
297
+  {
298
+    value: "159",
299
+    title: "\u4e52\u4e53",
300
+    ext: "gif"
301
+  },
302
+  {
303
+    value: "48",
304
+    title: "\u5496\u5561",
305
+    ext: "gif"
306
+  },
307
+  {
308
+    value: "161",
309
+    title: "\u7f8e\u98df",
310
+    ext: "gif"
311
+  },
312
+  {
313
+    value: "162",
314
+    title: "\u52a8\u7269",
315
+    ext: "gif"
316
+  },
317
+  {
318
+    value: "163",
319
+    title: "\u9c9c\u82b1",
320
+    ext: "gif"
321
+  },
322
+  {
323
+    value: "164",
324
+    title: "\u67af",
325
+    ext: "gif"
326
+  },
327
+  {
328
+    value: "165",
329
+    title: "\u5507",
330
+    ext: "gif"
331
+  },
332
+  {
333
+    value: "166",
334
+    title: "\u7231",
335
+    ext: "gif"
336
+  },
337
+  {
338
+    value: "167",
339
+    title: "\u5206\u624b",
340
+    ext: "gif"
341
+  },
342
+  {
343
+    value: "168",
344
+    title: "\u751f\u65e5",
345
+    ext: "gif"
346
+  },
347
+  {
348
+    value: "169",
349
+    title: "\u7535",
350
+    ext: "gif"
351
+  },
352
+  {
353
+    value: "170",
354
+    title: "\u70b8\u5f39",
355
+    ext: "gif"
356
+  },
357
+  {
358
+    value: "171",
359
+    title: "\u5200\u5b50",
360
+    ext: "gif"
361
+  },
362
+  {
363
+    value: "46",
364
+    title: "\u8db3\u7403",
365
+    ext: "gif"
366
+  },
367
+  {
368
+    value: "173",
369
+    title: "\u74e2\u866b",
370
+    ext: "gif"
371
+  },
372
+  {
373
+    value: "174",
374
+    title: "\u7fd4",
375
+    ext: "gif"
376
+  },
377
+  {
378
+    value: "175",
379
+    title: "\u6708\u4eae",
380
+    ext: "gif"
381
+  },
382
+  {
383
+    value: "176",
384
+    title: "\u592a\u9633",
385
+    ext: "gif"
386
+  },
387
+  {
388
+    value: "177",
389
+    title: "\u793c\u7269",
390
+    ext: "gif"
391
+  },
392
+  {
393
+    value: "178",
394
+    title: "\u62b1\u62b1",
395
+    ext: "gif"
396
+  },
397
+  {
398
+    value: "179",
399
+    title: "\u62c7\u6307",
400
+    ext: "gif"
401
+  },
402
+  {
403
+    value: "180",
404
+    title: "\u8d2c\u4f4e",
405
+    ext: "gif"
406
+  },
407
+  {
408
+    value: "181",
409
+    title: "\u63e1\u624b",
410
+    ext: "gif"
411
+  },
412
+  {
413
+    value: "182",
414
+    title: "\u526a\u5200\u624b",
415
+    ext: "gif"
416
+  },
417
+  {
418
+    value: "183",
419
+    title: "\u62b1\u62f3",
420
+    ext: "gif"
421
+  },
422
+  {
423
+    value: "184",
424
+    title: "\u52fe\u5f15",
425
+    ext: "gif"
426
+  },
427
+  {
428
+    value: "185",
429
+    title: "\u62f3\u5934",
430
+    ext: "gif"
431
+  },
432
+  {
433
+    value: "186",
434
+    title: "\u5c0f\u62c7\u6307",
435
+    ext: "gif"
436
+  },
437
+  {
438
+    value: "187",
439
+    title: "\u62c7\u6307\u516b",
440
+    ext: "gif"
441
+  },
442
+  {
443
+    value: "188",
444
+    title: "\u98df\u6307",
445
+    ext: "gif"
446
+  },
447
+  {
448
+    value: "189",
449
+    title: "ok",
450
+    ext: "gif"
451
+  },
452
+  {
453
+    value: "190",
454
+    title: "\u60c5\u4fa3",
455
+    ext: "gif"
456
+  },
457
+  {
458
+    value: "52",
459
+    title: "\u7231\u5fc3",
460
+    ext: "gif"
461
+  },
462
+  {
463
+    value: "192",
464
+    title: "\u8e66\u54d2",
465
+    ext: "gif"
466
+  },
467
+  {
468
+    value: "193",
469
+    title: "\u98a4\u6296",
470
+    ext: "gif"
471
+  },
472
+  {
473
+    value: "194",
474
+    title: "\u6004\u6c14",
475
+    ext: "gif"
476
+  },
477
+  {
478
+    value: "195",
479
+    title: "\u8df3\u821e",
480
+    ext: "gif"
481
+  },
482
+  {
483
+    value: "196",
484
+    title: "\u53d1\u54462",
485
+    ext: "gif"
486
+  },
487
+  {
488
+    value: "197",
489
+    title: "\u80cc\u7740",
490
+    ext: "gif"
491
+  },
492
+  {
493
+    value: "198",
494
+    title: "\u4f38\u624b",
495
+    ext: "gif"
496
+  },
497
+  {
498
+    value: "199",
499
+    title: "\u800d\u5e05",
500
+    ext: "gif"
501
+  },
502
+  {
503
+    value: "201",
504
+    title: "\u751f\u75c5",
505
+    ext: "png"
506
+  },
507
+  {
508
+    value: "202",
509
+    title: "\u54ed\u6ce3",
510
+    ext: "png"
511
+  },
512
+  {
513
+    value: "203",
514
+    title: "\u5410\u820c",
515
+    ext: "png"
516
+  },
517
+  {
518
+    value: "204",
519
+    title: "\u8ff7\u7cca",
520
+    ext: "png"
521
+  },
522
+  {
523
+    value: "205",
524
+    title: "\u77aa\u773c",
525
+    ext: "png"
526
+  },
527
+  {
528
+    value: "206",
529
+    title: "\u6050\u6016",
530
+    ext: "png"
531
+  },
532
+  {
533
+    value: "207",
534
+    title: "\u5fe7\u6101",
535
+    ext: "png"
536
+  },
537
+  {
538
+    value: "208",
539
+    title: "\u7728\u7709",
540
+    ext: "png"
541
+  },
542
+  {
543
+    value: "209",
544
+    title: "\u95ed\u773c",
545
+    ext: "png"
546
+  },
547
+  {
548
+    value: "210",
549
+    title: "\u9119\u89c6",
550
+    ext: "png"
551
+  },
552
+  {
553
+    value: "211",
554
+    title: "\u9634\u6697",
555
+    ext: "png"
556
+  },
557
+  {
558
+    value: "212",
559
+    title: "\u5c0f\u9b3c",
560
+    ext: "png"
561
+  },
562
+  {
563
+    value: "213",
564
+    title: "\u793c\u72692",
565
+    ext: "png"
566
+  },
567
+  {
568
+    value: "214",
569
+    title: "\u62dc\u4f5b",
570
+    ext: "png"
571
+  },
572
+  {
573
+    value: "215",
574
+    title: "\u529b\u91cf",
575
+    ext: "png"
576
+  },
577
+  {
578
+    value: "216",
579
+    title: "\u91d1\u94b1",
580
+    ext: "png"
581
+  },
582
+  {
583
+    value: "217",
584
+    title: "\u86cb\u7cd5",
585
+    ext: "png"
586
+  },
587
+  {
588
+    value: "218",
589
+    title: "\u5f69\u5e26",
590
+    ext: "png"
591
+  },
592
+  {
593
+    value: "219",
594
+    title: "\u793c\u72693",
595
+    ext: "png"
596
+  },
597
+  {
598
+    value: "0",
599
+    title: "\u6376\u5730",
600
+    ext: "gif"
601
+  },
602
+  {
603
+    value: "1",
604
+    title: "\u6000\u7591",
605
+    ext: "gif"
606
+  },
607
+  {
608
+    value: "2",
609
+    title: "\u6487\u5634",
610
+    ext: "gif"
611
+  },
612
+  {
613
+    value: "3",
614
+    title: "\u8272",
615
+    ext: "gif"
616
+  },
617
+  {
618
+    value: "6",
619
+    title: "\u5bb3\u7f9e",
620
+    ext: "gif"
621
+  },
622
+  {
623
+    value: "7",
624
+    title: "\u95ed\u5634",
625
+    ext: "gif"
626
+  },
627
+  {
628
+    value: "8",
629
+    title: "\u7761\u89c9",
630
+    ext: "gif"
631
+  },
632
+  {
633
+    value: "9",
634
+    title: "\u5927\u54ed",
635
+    ext: "gif"
636
+  },
637
+  {
638
+    value: "10",
639
+    title: "\u5c34\u5c2c",
640
+    ext: "gif"
641
+  },
642
+  {
643
+    value: "11",
644
+    title: "\u53d1\u6012",
645
+    ext: "gif"
646
+  },
647
+  {
648
+    value: "13",
649
+    title: "\u5472\u7259",
650
+    ext: "gif"
651
+  },
652
+  {
653
+    value: "16",
654
+    title: "\u5e05\u5446",
655
+    ext: "gif"
656
+  },
657
+  {
658
+    value: "17",
659
+    title: "\u6298\u78e8",
660
+    ext: "gif"
79 661
   },
80 662
   {
81 663
     value: "19",
82
-    title: "偷笑"
664
+    title: "\u5077\u7b11",
665
+    ext: "gif"
83 666
   },
84 667
   {
85 668
     value: "20",
86
-    title: "可爱"
669
+    title: "\u53ef\u7231",
670
+    ext: "gif"
87 671
   },
88 672
   {
89 673
     value: "21",
90
-    title: "白眼"
674
+    title: "\u767d\u773c",
675
+    ext: "gif"
91 676
   },
92 677
   {
93 678
     value: "22",
94
-    title: "傲慢"
679
+    title: "\u50b2\u6162",
680
+    ext: "gif"
95 681
   },
96 682
   {
97 683
     value: "23",
98
-    title: "嘴馋"
684
+    title: "\u5634\u998b",
685
+    ext: "gif"
99 686
   },
100 687
   {
101 688
     value: "24",
102
-    title: "困"
689
+    title: "\u56f0",
690
+    ext: "gif"
103 691
   },
104 692
   {
105 693
     value: "25",
106
-    title: "恐慌"
694
+    title: "\u6050\u614c",
695
+    ext: "gif"
107 696
   },
108 697
   {
109 698
     value: "26",
110
-    title: "流汗"
699
+    title: "\u6d41\u6c57",
700
+    ext: "gif"
111 701
   },
112 702
   {
113 703
     value: "27",
114
-    title: "憨笑"
704
+    title: "\u61a8\u7b11",
705
+    ext: "gif"
115 706
   },
116 707
   {
117 708
     value: "28",
118
-    title: "大兵"
709
+    title: "\u5927\u5175",
710
+    ext: "gif"
119 711
   },
120 712
   {
121 713
     value: "29",
122
-    title: "奋斗"
123
-  },
124
-  {
125
-    value: "30",
126
-    title: "疑问"
714
+    title: "\u594b\u6597",
715
+    ext: "gif"
127 716
   },
128 717
   {
129 718
     value: "31",
130
-    title: "嘘"
719
+    title: "\u5618",
720
+    ext: "gif"
131 721
   },
132 722
   {
133 723
     value: "32",
134
-    title: "晕"
724
+    title: "\u6655",
725
+    ext: "gif"
135 726
   },
136 727
   {
137 728
     value: "33",
138
-    title: "被炸了"
729
+    title: "\u88ab\u70b8\u4e86",
730
+    ext: "gif"
139 731
   },
140 732
   {
141 733
     value: "34",
142
-    title: "骷髅"
734
+    title: "\u9ab7\u9ac5",
735
+    ext: "gif"
143 736
   },
144 737
   {
145 738
     value: "35",
146
-    title: "敲打"
739
+    title: "\u6572\u6253",
740
+    ext: "gif"
147 741
   },
148 742
   {
149 743
     value: "36",
150
-    title: "拜拜"
744
+    title: "\u62dc\u62dc",
745
+    ext: "gif"
151 746
   },
152 747
   {
153 748
     value: "37",
154
-    title: "发抖"
749
+    title: "\u53d1\u6296",
750
+    ext: "gif"
155 751
   },
156 752
   {
157 753
     value: "38",
158
-    title: "亲密"
754
+    title: "\u4eb2\u5bc6",
755
+    ext: "gif"
159 756
   },
160 757
   {
161 758
     value: "39",
162
-    title: "跳"
759
+    title: "\u8df3",
760
+    ext: "gif"
163 761
   },
164 762
   {
165 763
     value: "40",
166
-    title: "猪头"
764
+    title: "\u732a\u5934",
765
+    ext: "gif"
167 766
   },
168 767
   {
169 768
     value: "41",
170
-    title: "拥抱"
769
+    title: "\u62e5\u62b1",
770
+    ext: "gif"
171 771
   },
172 772
   {
173 773
     value: "42",
174
-    title: "生日蛋糕"
774
+    title: "\u751f\u65e5\u86cb\u7cd5",
775
+    ext: "gif"
175 776
   },
176 777
   {
177 778
     value: "43",
178
-    title: "闪电"
779
+    title: "\u95ea\u7535",
780
+    ext: "gif"
179 781
   },
180 782
   {
181 783
     value: "44",
182
-    title: "地雷"
183
-  },
184
-  {
185
-    value: "45",
186
-    title: "刀"
187
-  },
188
-  {
189
-    value: "46",
190
-    title: "足球"
784
+    title: "\u5730\u96f7",
785
+    ext: "gif"
191 786
   },
192 787
   {
193 788
     value: "47",
194
-    title: "便便"
195
-  },
196
-  {
197
-    value: "48",
198
-    title: "咖啡"
789
+    title: "\u4fbf\u4fbf",
790
+    ext: "gif"
199 791
   },
200 792
   {
201 793
     value: "49",
202
-    title: "米饭"
794
+    title: "\u7c73\u996d",
795
+    ext: "gif"
203 796
   },
204 797
   {
205 798
     value: "50",
206
-    title: "玫瑰"
799
+    title: "\u73ab\u7470",
800
+    ext: "gif"
207 801
   },
208 802
   {
209 803
     value: "51",
210
-    title: "枯萎玫瑰"
211
-  },
212
-  {
213
-    value: "52",
214
-    title: "爱心"
804
+    title: "\u67af\u840e\u73ab\u7470",
805
+    ext: "gif"
215 806
   },
216 807
   {
217 808
     value: "53",
218
-    title: "心碎"
809
+    title: "\u5fc3\u788e",
810
+    ext: "gif"
219 811
   }
220 812
 ];
221 813
 
222
-export const prefixUrl = "https://a.links123.cn/site/src/feed/imgs/qq/";
814
+export const prefixUrl = "https://a.links123.cn/site/src/feed/imgs/comment/";
223 815
 
224 816
 export const ext = "gif";
225 817
 

+ 6
- 4
src/helper.js 查看文件

@@ -1,5 +1,5 @@
1 1
 import { REGEXP, IMAGE_SPLIT } from "./constant";
2
-import emoji, { prefixUrl, ext } from "./emoji";
2
+import emoji, { prefixUrl } from "./emoji";
3 3
 
4 4
 const emojiObejct = arrayToObject(emoji, "title");
5 5
 
@@ -63,9 +63,11 @@ export function renderContent(content, onClick) {
63 63
         return `<br/><img src="${src}" alt="${src}" style="max-width: 100%" />`;
64 64
       }
65 65
       // 如果不存在对应的表情, 则返回原文
66
-      if (emojiObejct[src]) {
67
-        const value = emojiObejct[src].value;
68
-        return `<img src="${prefixUrl}${value}.${ext}" alt="${value}" />`;
66
+      const emoji = emojiObejct[src];
67
+      if (emoji) {
68
+        return `<img src="${prefixUrl}${emoji.value}.${emoji.ext}" alt="${
69
+          emoji.title
70
+        }" />`;
69 71
       }
70 72
       return `[${src}]`;
71 73
     })