<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[31779] trunk/src/wp-includes/js: Emoji:</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/31779">31779</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/31779","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>azaozz</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2015-03-14 23:49:00 +0000 (Sat, 14 Mar 2015)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Emoji:
- Move the TinyMCE plugin CSS to wp-content.css.
- Change the replacement images class to `wp-emoji` inside the editor.
- Clean up both the plugin and wp-emoji.js, abstract and restructure a bit.
See <a href="https://core.trac.wordpress.org/ticket/31242">#31242</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesjstinymcepluginswpemojipluginjs">trunk/src/wp-includes/js/tinymce/plugins/wpemoji/plugin.js</a></li>
<li><a href="#trunksrcwpincludesjstinymceskinswordpresswpcontentcss">trunk/src/wp-includes/js/tinymce/skins/wordpress/wp-content.css</a></li>
<li><a href="#trunksrcwpincludesjswpemojijs">trunk/src/wp-includes/js/wp-emoji.js</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li>trunk/src/wp-includes/js/tinymce/plugins/wpemoji/css/</li>
</ul>
<h3>Property Changed</h3>
<ul>
<li><a href="#trunksrcwpincludesjstinymcepluginswpemojipluginjs">trunk/src/wp-includes/js/tinymce/plugins/wpemoji/plugin.js</a></li>
<li><a href="#trunksrcwpincludesjstwemojijs">trunk/src/wp-includes/js/twemoji.js</a></li>
<li><a href="#trunksrcwpincludesjswpemojijs">trunk/src/wp-includes/js/wp-emoji.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesjstinymcepluginswpemojipluginjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/tinymce/plugins/wpemoji/plugin.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/tinymce/plugins/wpemoji/plugin.js 2015-03-14 20:11:42 UTC (rev 31778)
+++ trunk/src/wp-includes/js/tinymce/plugins/wpemoji/plugin.js 2015-03-14 23:49:00 UTC (rev 31779)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,29 +1,18 @@
</span><span class="cx" style="display: block; padding: 0 10px"> ( function( tinymce, wp ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- tinymce.PluginManager.add( 'wpemoji', function( editor, url ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ tinymce.PluginManager.add( 'wpemoji', function( editor ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> var typing,
</span><span class="cx" style="display: block; padding: 0 10px"> isMacWebKit = tinymce.Env.mac && tinymce.Env.webkit;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! wp.emoji.parseEmoji ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! wp || ! wp.emoji ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Loads stylesheet for custom styles within the editor
- editor.on( 'init', function() {
- var cssId = editor.dom.uniqueId();
- var linkElm = editor.dom.create( 'link', {
- id: cssId,
- rel: 'stylesheet',
- href: url + '/css/editor.css'
- });
- editor.getDoc().getElementsByTagName( 'head' )[0].appendChild( linkElm );
- } );
-
</del><span class="cx" style="display: block; padding: 0 10px"> editor.on( 'keydown keyup', function( event ) {
</span><span class="cx" style="display: block; padding: 0 10px"> typing = event.type === 'keydown';
</span><span class="cx" style="display: block; padding: 0 10px"> } );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> editor.on( 'input setcontent', function( event ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var selection, node, bookmark, imgs;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var selection, node, bookmark, images;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( typing && event.type === 'input' ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -36,16 +25,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> bookmark = selection.getBookmark();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- wp.emoji.parse( node );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wp.emoji.parse( node, { className: 'wp-emoji new-emoji' } );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- imgs = editor.dom.select( 'img.emoji', node );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ images = editor.dom.select( 'img.new-emoji', node );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- tinymce.each( imgs, function( elem ) {
- if ( ! elem.getAttribute( 'data-wp-emoji' ) ) {
- elem.setAttribute( 'data-mce-resize', 'false' );
- elem.setAttribute( 'data-mce-placeholder', '1' );
- elem.setAttribute( 'data-wp-emoji', elem.alt );
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ tinymce.each( images, function( image ) {
+ image.className = 'wp-emoji';
+ image.setAttribute( 'data-mce-resize', 'false' );
+ image.setAttribute( 'data-mce-placeholder', '1' );
+ image.setAttribute( 'data-wp-emoji', image.alt );
</ins><span class="cx" style="display: block; padding: 0 10px"> } );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // In IE all content in the editor is left selected aftrer wp.emoji.parse()...
</span><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/src/wp-includes/js/tinymce/plugins/wpemoji/plugin.js
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svnexecutable"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: svn:executable</h4></div>
<del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-*
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunksrcwpincludesjstinymceskinswordpresswpcontentcss"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/tinymce/skins/wordpress/wp-content.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/tinymce/skins/wordpress/wp-content.css 2015-03-14 20:11:42 UTC (rev 31778)
+++ trunk/src/wp-includes/js/tinymce/skins/wordpress/wp-content.css 2015-03-14 23:49:00 UTC (rev 31779)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -57,6 +57,18 @@
</span><span class="cx" style="display: block; padding: 0 10px"> font-size: inherit;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/* For emoji replacement images */
+img.wp-emoji {
+ height: 1em !important;
+ width: 1em !important;
+ margin: 0 0.07em !important;
+ vertical-align: -0.1em !important;
+ border: none !important;
+ padding: 0 !important;
+ -webkit-box-shadow: none !important;
+ box-shadow: none !important;
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> /* DFW mode */
</span><span class="cx" style="display: block; padding: 0 10px"> html.wp-fullscreen,
</span><span class="cx" style="display: block; padding: 0 10px"> html.wp-fullscreen body#tinymce {
</span><span class="cx" style="display: block; padding: 0 10px">Index: trunk/src/wp-includes/js/twemoji.js
</span><span class="cx" style="display: block; padding: 0 10px">===================================================================
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">--- trunk/src/wp-includes/js/twemoji.js 2015-03-14 20:11:42 UTC (rev 31778)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+++ trunk/src/wp-includes/js/twemoji.js 2015-03-14 23:49:00 UTC (rev 31779)
</ins></span></pre></div>
<a id="trunksrcwpincludesjstwemojijs"></a>
<div class="propset"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Property changes: trunk/src/wp-includes/js/twemoji.js</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunksrcwpincludesjswpemojijs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/wp-emoji.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/wp-emoji.js 2015-03-14 20:11:42 UTC (rev 31778)
+++ trunk/src/wp-includes/js/wp-emoji.js 2015-03-14 23:49:00 UTC (rev 31779)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,9 +1,8 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-window.wp = window.wp || {};
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-( function( window, wp, twemoji, settings ) {
- var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+( function( window, twemoji, settings ) {
+ function wpEmoji() {
+ var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver,
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var emoji = {
</del><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Flag to determine if we should parse all emoji characters into Twemoji images.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -11,7 +10,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @var Boolean
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- parseAllEmoji: false,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ parseAllEmoji = false,
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Flag to determine if we should consider parsing emoji characters into Twemoji images.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -20,7 +19,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @var Boolean
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- parseEmoji: false,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ parseEmoji = false,
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Flag to determine if we should parse flag characters into Twemoji images.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -29,31 +28,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @var Boolean
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- parseFlags: false,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ parseFlags = false;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Initialize our emoji support, and set up listeners.
- *
- * @since 4.2.0
- */
- init: function() {
- emoji.parseAllEmoji = ! emoji.browserSupportsEmoji();
- emoji.parseFlags = ! emoji.browserSupportsFlagEmoji();
- emoji.parseEmoji = emoji.parseAllEmoji || emoji.parseFlags;
-
- if ( window.addEventListener ) {
- window.addEventListener( 'load', emoji.load, false );
- } else if ( window.attachEvent ) {
- window.attachEvent( 'onload', emoji.load );
- }
- },
-
- /**
</del><span class="cx" style="display: block; padding: 0 10px"> * Runs when the document load event is fired, so we can do our first parse of the page.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 4.2.0
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- load: function() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function load() {
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( MutationObserver ) {
</span><span class="cx" style="display: block; padding: 0 10px"> new MutationObserver( function( mutationRecords ) {
</span><span class="cx" style="display: block; padding: 0 10px"> var i = mutationRecords.length,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -71,7 +53,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( node && node.nodeType === 1 ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- emoji.parse( node );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ parse( node );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -83,17 +65,19 @@
</span><span class="cx" style="display: block; padding: 0 10px"> } );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- emoji.parse( document.body );
- },
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ parse( document.body );
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Detect if the browser supports rendering emoji.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Detect if the browser supports rendering emoji or flag emoji. Flag emoji are a single glyph
+ * made of two characters, so some browsers (notably, Firefox OS X) don't support them.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 4.2.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param flagEmoji {Boolean} Whether to test for support of flag emoji.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return {Boolean} True if the browser can render emoji, false if it cannot.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- browserSupportsEmoji: function() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function browserSupportsEmoji( type ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> var canvas = document.createElement( 'canvas' ),
</span><span class="cx" style="display: block; padding: 0 10px"> context = canvas.getContext && canvas.getContext( '2d' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -101,50 +85,32 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /*
- * Chrome on OS X added native emoji rendering in M41. Unfortunately,
- * it doesn't work when the font is bolder than 500 weight. So, we
- * check for bold rendering support to avoid invisible emoji in Chrome.
- */
</del><span class="cx" style="display: block; padding: 0 10px"> context.textBaseline = 'top';
</span><span class="cx" style="display: block; padding: 0 10px"> context.font = '600 32px Arial';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- context.fillText( String.fromCharCode( 55357, 56835 ), 0, 0 );
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return context.getImageData( 16, 16, 1, 1 ).data[0] !== 0;
- },
-
- /**
- * Detect if the browser supports rendering flag emoji. Flag emoji are a single glyph
- * made of two characters, so some browsers (notably, Firefox OS X) don't support them.
- *
- * @since 4.2.0
- *
- * @return {Boolean} True if the browser renders flag characters as a flag glyph, false if it does not.
- */
- browserSupportsFlagEmoji: function() {
- var canvas = document.createElement( 'canvas' ),
- context = canvas.getContext && canvas.getContext( '2d' );
-
- if ( ! context || ! context.fillText ) {
- return false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( type === 'flag' ) {
+ /*
+ * This works because the image will be one of three things:
+ * - Two empty squares, if the browser doen't render emoji
+ * - Two squares with 'G' and 'B' in them, if the browser doen't render flag emoji
+ * - The British flag
+ *
+ * The first two will encode to small images (1-2KB data URLs), the third will encode
+ * to a larger image (4-5KB data URL).
+ */
+ context.fillText( String.fromCharCode( 55356, 56812, 55356, 56807 ), 0, 0 );
+ return canvas.toDataURL().length > 3000;
+ } else {
+ /*
+ * Chrome on OS X added native emoji rendering in M41. Unfortunately,
+ * it doesn't work when the font is bolder than 500 weight. So, we
+ * check for bold rendering support to avoid invisible emoji in Chrome.
+ */
+ context.fillText( String.fromCharCode( 55357, 56835 ), 0, 0 );
+ return context.getImageData( 16, 16, 1, 1 ).data[0] !== 0;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- context.textBaseline = 'top';
- context.font = '32px Arial';
- context.fillText( String.fromCharCode( 55356, 56812, 55356, 56807 ), 0, 0 );
-
- /*
- * This works because the image will be one of three things:
- * - Two empty squares, if the browser doen't render emoji
- * - Two squares with 'G' and 'B' in them, if the browser doen't render flag emoji
- * - The British flag
- *
- * The first two will encode to small images (1-2KB data URLs), the third will encode
- * to a larger image (4-5KB data URL).
- */
- return canvas.toDataURL().length > 3000;
- },
-
</del><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Given an element or string, parse any emoji characters into Twemoji images.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -152,14 +118,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param {HTMLElement|String} object The element or string to parse.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- parse: function( object ) {
- if ( ! emoji.parseEmoji ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function parse( object, options ) {
+ if ( ! parseEmoji ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return object;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var className = ( options && options.className ) || 'emoji';
+
</ins><span class="cx" style="display: block; padding: 0 10px"> return twemoji.parse( object, {
</span><span class="cx" style="display: block; padding: 0 10px"> base: settings.baseUrl,
</span><span class="cx" style="display: block; padding: 0 10px"> ext: settings.ext,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ className: className,
</ins><span class="cx" style="display: block; padding: 0 10px"> callback: function( icon, options ) {
</span><span class="cx" style="display: block; padding: 0 10px"> // Ignore some standard characters that TinyMCE recommends in its character map.
</span><span class="cx" style="display: block; padding: 0 10px"> switch ( icon ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -174,7 +143,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( emoji.parseFlags && ! emoji.parseAllEmoji &&
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( parseFlags && ! parseAllEmoji &&
</ins><span class="cx" style="display: block; padding: 0 10px"> ! /^1f1(?:e[6-9a-f]|f[1-9a-f])-1f1(?:e[6-9a-f]|f[1-9a-f])$/.test( icon ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -184,9 +153,31 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> } );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- emoji.init();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! twemoji || ! settings ) {
+ return;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- wp.emoji = emoji;
-} )( window, window.wp, window.twemoji, window._wpemojiSettings );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Initialize our emoji support, and set up listeners.
+ */
+ parseAllEmoji = ! browserSupportsEmoji();
+ parseFlags = ! browserSupportsEmoji( 'flag' );
+ parseEmoji = parseAllEmoji || parseFlags;
+
+ if ( window.addEventListener ) {
+ window.addEventListener( 'load', load, false );
+ } else if ( window.attachEvent ) {
+ window.attachEvent( 'onload', load );
+ }
+
+ return {
+ browserSupportsEmoji: browserSupportsEmoji,
+ parse: parse
+ };
+ }
+
+ window.wp = window.wp || {};
+ window.wp.emoji = new wpEmoji();
+
+} )( window, window.twemoji, window._wpemojiSettings );
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/src/wp-includes/js/wp-emoji.js
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span></div>
</body>
</html>