Skip to content

Commit c0a21de

Browse files
authored
Refactor emoji.js to use Set for ignored icons
1 parent 2929fe2 commit c0a21de

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/js/_enqueues/wp/emoji.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -215,22 +215,19 @@
215215

216216
// Compose the params for the twitter emoji library.
217217
args = args || {};
218+
const ignored = new Set([
219+
'a9', 'ae', '2122',
220+
'2194', '2195', '2196', '2197', '2198', '2199', '21a9', '21aa',
221+
'2660', '2663', '2665', '2666',
222+
]);
218223
params = {
219224
base: browserSupportsSvgAsImage() ? settings.svgUrl : settings.baseUrl,
220225
ext: browserSupportsSvgAsImage() ? settings.svgExt : settings.ext,
221226
className: args.className || 'emoji',
222227
callback: function( icon, options ) {
223228
// Ignore some standard characters that TinyMCE recommends in its character map.
224-
switch ( icon ) {
225-
case 'a9':
226-
case 'ae':
227-
case '2122':
228-
case '2194':
229-
case '2660':
230-
case '2663':
231-
case '2665':
232-
case '2666':
233-
return false;
229+
if ( ignored.has( icon ) ) {
230+
return false;
234231
}
235232

236233
if ( settings.supports.everythingExceptFlag &&

0 commit comments

Comments
 (0)