Skip to content

Commit

Permalink
Emoji: Upgrade Twemoji to 12.1.2.
Browse files Browse the repository at this point in the history
This upgrade adds support for the transgender flag: 🏳️‍⚧️

There's some additional housekeeping in this commit:

- Twemoji recently rearranged their repository and package, so `Gruntfile.js` needed tweaking to allow for that.
- As only new files were added in this Twemoji release, the CDN version didn't need updating.

Fixes #47852.



git-svn-id: https://develop.svn.wordpress.org/trunk@45769 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
pento committed Aug 8, 2019
1 parent 0d9ec05 commit c645936
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 20 deletions.
6 changes: 3 additions & 3 deletions Gruntfile.js
Expand Up @@ -173,7 +173,7 @@ module.exports = function(grunt) {
[ WORKING_DIR + 'wp-includes/js/jquery/jquery-migrate.min.js' ]: [ './node_modules/jquery-migrate/dist/jquery-migrate.min.js' ],
[ WORKING_DIR + 'wp-includes/js/jquery/jquery.form.js' ]: [ './node_modules/jquery-form/src/jquery.form.js' ],
[ WORKING_DIR + 'wp-includes/js/masonry.min.js' ]: [ './node_modules/masonry-layout/dist/masonry.pkgd.min.js' ],
[ WORKING_DIR + 'wp-includes/js/twemoji.js' ]: [ './node_modules/twemoji/2/twemoji.js' ],
[ WORKING_DIR + 'wp-includes/js/twemoji.js' ]: [ './node_modules/twemoji/dist/twemoji.js' ],
[ WORKING_DIR + 'wp-includes/js/underscore.js' ]: [ './node_modules/underscore/underscore.js' ],
},
{
Expand Down Expand Up @@ -1021,15 +1021,15 @@ module.exports = function(grunt) {
grunt.log.writeln( 'Fetching list of Twemoji files...' );

// Fetch a list of the files that Twemoji supplies
files = spawn( 'svn', [ 'ls', 'https://github.com/twitter/twemoji.git/branches/gh-pages/2/assets' ] );
files = spawn( 'svn', [ 'ls', 'https://github.com/twitter/twemoji.git/trunk/assets/svg' ] );
if ( 0 !== files.status ) {
grunt.fatal( 'Unable to fetch Twemoji file list' );
}

entities = files.stdout.toString();

// Tidy up the file list
entities = entities.replace( /\.ai/g, '' );
entities = entities.replace( /\.svg/g, '' );
entities = entities.replace( /^$/g, '' );

// Convert the emoji entities to HTML entities
Expand Down
70 changes: 56 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -118,7 +118,7 @@
"polyfill-library": "3.27.4",
"react": "16.8.4",
"react-dom": "16.8.4",
"twemoji": "12.0.1",
"twemoji": "12.1.2",
"underscore": "1.8.3",
"whatwg-fetch": "3.0.0"
},
Expand Down
16 changes: 16 additions & 0 deletions src/js/_enqueues/lib/emoji-loader.js
Expand Up @@ -68,6 +68,22 @@

switch ( type ) {
case 'flag':
/*
* Test for Transgender flag compatibility. This flag is shortlisted for the Emoji 13 spec,
* but has landed in Twemoji early, so we can add support for it, too.
*
* To test for support, we try to render it, and compare the rendering to how it would look if
* the browser doesn't render it correctly (white flag emoji + transgender symbol).
*/
isIdentical = emojiSetsRenderIdentically(
[ 0x1F3F3, 0xFE0F, 0x200D, 0x26A7, 0xFE0F ],
[ 0x1F3F3, 0xFE0F, 0x200B, 0x26A7, 0xFE0F ]
);

if ( isIdentical ) {
return false;
}

/*
* Test for UN flag compatibility. This is the least supported of the letter locale flags,
* so gives us an easy test for full support.
Expand Down
4 changes: 2 additions & 2 deletions src/wp-includes/formatting.php

Large diffs are not rendered by default.

0 comments on commit c645936

Please sign in to comment.