<!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>[44114] trunk/tools/webpack/packages.js: Script loader: Register `@wordpress` scripts.</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 { white-space: pre-line; 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/44114">44114</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/44114","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>desrosj</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2018-12-13 16:49:58 +0000 (Thu, 13 Dec 2018)</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'>Script loader: Register `@wordpress` scripts.
This allows the packages to be consumed by plugins and core itself.
The code has been based on the work done in the Gutenberg plugin.
We've added an array with all the packages and the vendor packages to
loop through. This sets a convention so all packages will be
registered in the same way. This array can eventually be generated by
a webpack plugin.
We need to register TinyMCE explicitly. Previously TinyMCE was used
by inserting custom `<script>` tags into the relevant admin pages.
This is not suitable for the new editor, so we need to explicitly
register TinyMCE. We could, in the future, refactor the custom
`<script>` tags to use the registered TinyMCE script instead.
Polyfills are inserted into the page only when necessary using
`document.write`.
Props omarreiss, herregroen, youknowriad, gziolo, atimmer.
Merges <a href="https://core.trac.wordpress.org/changeset/43723">[43723]</a> to trunk.
Fixes <a href="https://core.trac.wordpress.org/ticket/45065">#45065</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesscriptloaderphp">trunk/src/wp-includes/script-loader.php</a></li>
<li><a href="#trunktoolswebpackpackagesjs">trunk/tools/webpack/packages.js</a></li>
</ul>
<h3>Property Changed</h3>
<ul>
<li><a href="#trunk">trunk/</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<span class="cx" style="display: block; padding: 0 10px">Index: trunk
</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 2018-12-13 16:29:57 UTC (rev 44113)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+++ trunk 2018-12-13 16:49:58 UTC (rev 44114)
</ins><a id="trunk"></a>
<div class="propset"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Property changes: trunk</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svnmergeinfo"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: svn:mergeinfo</h4></div>
<span class="cx" style="display: block; padding: 0 10px"> /branches/3.3:20543
</span><span class="cx" style="display: block; padding: 0 10px"> /branches/3.4:21757
</span><span class="cx" style="display: block; padding: 0 10px"> /branches/4.9:43557
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/branches/5.0:43681-43682,43684-43688,43719-43720,43726-43727,43729-43731,43734-43737,43739-43744
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/branches/5.0:43681-43682,43684-43688,43719-43720,43723,43726-43727,43729-43731,43734-43737,43739-43744
</ins><span class="cx" style="display: block; padding: 0 10px"> /trunk:18512
</span><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunksrcwpincludesscriptloaderphp"></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/script-loader.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/script-loader.php 2018-12-13 16:29:57 UTC (rev 44113)
+++ trunk/src/wp-includes/script-loader.php 2018-12-13 16:49:58 UTC (rev 44114)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -35,6 +35,496 @@
</span><span class="cx" style="display: block; padding: 0 10px"> require( ABSPATH . WPINC . '/functions.wp-styles.php' );
</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">+ * Registers TinyMCE scripts.
+ *
+ * @since 5.0.0
+ *
+ * @param WP_Scripts $scripts WP_Scripts object.
+ */
+function wp_register_tinymce_scripts( &$scripts ) {
+ global $tinymce_version, $concatenate_scripts, $compress_scripts;
+ $suffix = SCRIPT_DEBUG ? '' : '.min';
+ $compressed = $compress_scripts && $concatenate_scripts && isset( $_SERVER['HTTP_ACCEPT_ENCODING'] )
+ && false !== stripos( $_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip' );
+ // Load tinymce.js when running from /src, otherwise load wp-tinymce.js.gz (in production) or
+ // tinymce.min.js (when SCRIPT_DEBUG is true).
+ $mce_suffix = false !== strpos( get_bloginfo( 'version' ), '-src' ) ? '' : '.min';
+ if ( $compressed ) {
+ $scripts->add( 'wp-tinymce', includes_url( 'js/tinymce/' ) . 'wp-tinymce.php', array(), $tinymce_version );
+ } else {
+ $scripts->add( 'wp-tinymce-root', includes_url( 'js/tinymce/' ) . "tinymce{$mce_suffix}.js", array(), $tinymce_version );
+ $scripts->add( 'wp-tinymce', includes_url( 'js/tinymce/' ) . "plugins/compat3x/plugin{$suffix}.js", array( 'wp-tinymce-root' ), $tinymce_version );
+ }
+
+ $scripts->add( 'wp-tinymce-lists', includes_url( 'js/tinymce/plugins/lists/index' . $suffix . '.js', array( 'wp-tinymce' ), $tinymce_version ) );
+}
+
+/**
+ * Registers all the WordPress vendor scripts that are in the standardized
+ * `js/dist/vendor/` location.
+ *
+ * For the order of `$scripts->add` see `wp_default_scripts`.
+ *
+ * @since 5.0.0
+ *
+ * @param WP_Scripts $scripts WP_Scripts object.
+ */
+function wp_default_packages_vendor( &$scripts, $dev_suffix ) {
+ wp_register_tinymce_scripts( $scripts );
+
+ $vendor_scripts = array(
+ 'react',
+ 'react-dom' => array( 'react' ),
+ 'moment',
+ 'lodash',
+ 'wp-polyfill-fetch',
+ 'wp-polyfill-formdata',
+ 'wp-polyfill-node-contains',
+ 'wp-polyfill-element-closest',
+ 'wp-polyfill-ecmascript',
+ );
+
+ foreach ( $vendor_scripts as $handle => $dependencies ) {
+ if ( is_string( $dependencies ) ) {
+ $handle = $dependencies;
+ $dependencies = array();
+ }
+
+ $path = '/js/dist/vendor/' . $handle . $dev_suffix . '.js';
+
+ $scripts->add( $handle, $path, $dependencies, false, 1 );
+ }
+
+ $scripts->add( 'wp-polyfill', null, array( 'wp-polyfill-ecmascript' ) );
+ did_action( 'init' ) && $scripts->add_inline_script(
+ 'wp-polyfill',
+ 'data',
+ wp_get_script_polyfill(
+ $scripts,
+ array(
+ '\'fetch\' in window' => 'wp-polyfill-fetch',
+ 'document.contains' => 'wp-polyfill-node-contains',
+ 'window.FormData && window.FormData.prototype.keys' => 'wp-polyfill-formdata',
+ 'Element.prototype.matches && Element.prototype.closest' => 'wp-polyfill-element-closest',
+ )
+ )
+ );
+
+ did_action( 'init' ) && $scripts->add_inline_script( 'lodash', 'window.lodash = _.noConflict();' );
+}
+
+/**
+ * Returns contents of an inline script used in appending polyfill scripts for
+ * browsers which fail the provided tests. The provided array is a mapping from
+ * a condition to verify feature support to its polyfill script handle.
+ *
+ * @since 5.0.0
+ *
+ * @param WP_Scripts $scripts WP_Scripts object.
+ * @param array $tests Features to detect.
+ * @return string Conditional polyfill inline script.
+ */
+function wp_get_script_polyfill( $scripts, $tests ) {
+ $polyfill = '';
+ foreach ( $tests as $test => $handle ) {
+ if ( ! array_key_exists( $handle, $scripts->registered ) ) {
+ continue;
+ }
+
+ $polyfill .= (
+ // Test presence of feature...
+ '( ' . $test . ' ) || ' .
+ // ...appending polyfill on any failures. Cautious viewers may balk
+ // at the `document.write`. Its caveat of synchronous mid-stream
+ // blocking write is exactly the behavior we need though.
+ 'document.write( \'<script src="' .
+ esc_url( $scripts->registered[ $handle ]->src ) .
+ '"></scr\' + \'ipt>\' );'
+ );
+ }
+
+ return $polyfill;
+}
+
+/**
+ * Register all the WordPress packages scripts that are in the standardized
+ * `js/dist/` location.
+ *
+ * For the order of `$scripts->add` see `wp_default_scripts`.
+ *
+ * @since 5.0.0
+ *
+ * @param WP_Scripts $scripts WP_Scripts object.
+ * @param string $suffix The suffix to use before `.js`.
+ */
+function wp_default_packages_scripts( &$scripts, $suffix ) {
+ $packages_dependencies = array(
+ 'api-fetch' => array( 'wp-polyfill', 'wp-hooks', 'wp-i18n' ),
+ 'a11y' => array( 'wp-dom-ready', 'wp-polyfill' ),
+ 'autop' => array( 'wp-polyfill' ),
+ 'blob' => array( 'wp-polyfill' ),
+ 'blocks' => array(
+ 'wp-autop',
+ 'wp-blob',
+ 'wp-block-serialization-default-parser',
+ 'wp-data',
+ 'wp-deprecated',
+ 'wp-dom',
+ 'wp-element',
+ 'wp-hooks',
+ 'wp-i18n',
+ 'wp-is-shallow-equal',
+ 'wp-polyfill',
+ 'wp-shortcode',
+ 'lodash',
+ 'wp-rich-text',
+ ),
+ 'block-library' => array(
+ 'editor',
+ 'lodash',
+ 'moment',
+ 'wp-api-fetch',
+ 'wp-autop',
+ 'wp-blob',
+ 'wp-blocks',
+ 'wp-components',
+ 'wp-compose',
+ 'wp-core-data',
+ 'wp-data',
+ 'wp-editor',
+ 'wp-element',
+ 'wp-html-entities',
+ 'wp-i18n',
+ 'wp-keycodes',
+ 'wp-polyfill',
+ 'wp-url',
+ 'wp-viewport',
+ 'wp-rich-text',
+ ),
+ 'block-serialization-default-parser' => array(),
+ 'block-serialization-spec-parser' => array( 'wp-polyfill' ),
+ 'components' => array(
+ 'lodash',
+ 'moment',
+ 'wp-a11y',
+ 'wp-api-fetch',
+ 'wp-compose',
+ 'wp-deprecated',
+ 'wp-dom',
+ 'wp-element',
+ 'wp-hooks',
+ 'wp-html-entities',
+ 'wp-i18n',
+ 'wp-is-shallow-equal',
+ 'wp-keycodes',
+ 'wp-polyfill',
+ 'wp-url',
+ 'wp-rich-text',
+ ),
+ 'compose' => array( 'lodash', 'wp-element', 'wp-is-shallow-equal', 'wp-polyfill' ),
+ 'core-data' => array( 'wp-data', 'wp-api-fetch', 'wp-polyfill', 'wp-url', 'lodash' ),
+ 'data' => array(
+ 'lodash',
+ 'wp-compose',
+ 'wp-deprecated',
+ 'wp-element',
+ 'wp-is-shallow-equal',
+ 'wp-polyfill',
+ 'wp-redux-routine',
+ ),
+ 'date' => array( 'moment', 'wp-polyfill' ),
+ 'deprecated' => array( 'wp-polyfill', 'wp-hooks' ),
+ 'dom' => array( 'lodash', 'wp-polyfill', 'wp-tinymce' ),
+ 'dom-ready' => array( 'wp-polyfill' ),
+ 'edit-post' => array(
+ 'jquery',
+ 'lodash',
+ 'postbox',
+ 'media-models',
+ 'media-views',
+ 'wp-a11y',
+ 'wp-api-fetch',
+ 'wp-block-library',
+ 'wp-blocks',
+ 'wp-components',
+ 'wp-compose',
+ 'wp-core-data',
+ 'wp-data',
+ 'wp-deprecated',
+ 'wp-dom-ready',
+ 'wp-editor',
+ 'wp-element',
+ 'wp-embed',
+ 'wp-i18n',
+ 'wp-keycodes',
+ 'wp-nux',
+ 'wp-plugins',
+ 'wp-polyfill',
+ 'wp-url',
+ 'wp-viewport',
+ ),
+ 'editor' => array(
+ 'jquery',
+ 'lodash',
+ 'wp-tinymce-lists',
+ 'wp-a11y',
+ 'wp-api-fetch',
+ 'wp-blob',
+ 'wp-blocks',
+ 'wp-components',
+ 'wp-compose',
+ 'wp-core-data',
+ 'wp-data',
+ 'wp-date',
+ 'wp-deprecated',
+ 'wp-dom',
+ 'wp-element',
+ 'wp-hooks',
+ 'wp-html-entities',
+ 'wp-i18n',
+ 'wp-is-shallow-equal',
+ 'wp-keycodes',
+ 'wp-nux',
+ 'wp-polyfill',
+ 'wp-tinymce',
+ 'wp-token-list',
+ 'wp-url',
+ 'wp-viewport',
+ 'wp-wordcount',
+ 'wp-rich-text',
+ ),
+ 'element' => array( 'wp-polyfill', 'react', 'react-dom', 'lodash', 'wp-escape-html' ),
+ 'escape-html' => array( 'wp-polyfill' ),
+ 'hooks' => array( 'wp-polyfill' ),
+ 'html-entities' => array( 'wp-polyfill' ),
+ 'i18n' => array( 'wp-polyfill' ),
+ 'is-shallow-equal' => array( 'wp-polyfill' ),
+ 'keycodes' => array( 'lodash', 'wp-polyfill' ),
+ 'list-reusable-blocks' => array(
+ 'lodash',
+ 'wp-api-fetch',
+ 'wp-components',
+ 'wp-compose',
+ 'wp-element',
+ 'wp-i18n',
+ 'wp-polyfill',
+ ),
+ 'nux' => array(
+ 'wp-element',
+ 'wp-components',
+ 'wp-compose',
+ 'wp-data',
+ 'wp-i18n',
+ 'wp-polyfill',
+ 'lodash',
+ ),
+ 'plugins' => array( 'lodash', 'wp-compose', 'wp-element', 'wp-hooks', 'wp-polyfill' ),
+ 'redux-routine' => array( 'wp-polyfill' ),
+ 'rich-text' => array( 'wp-polyfill', 'wp-escape-html', 'lodash' ),
+ 'shortcode' => array( 'wp-polyfill', 'lodash' ),
+ 'token-list' => array( 'lodash', 'wp-polyfill' ),
+ 'url' => array( 'wp-polyfill' ),
+ 'viewport' => array( 'wp-polyfill', 'wp-element', 'wp-data', 'wp-compose', 'lodash' ),
+ 'wordcount' => array( 'wp-polyfill' ),
+ );
+
+ foreach ( $packages_dependencies as $package => $dependencies ) {
+ $handle = 'wp-' . $package;
+ $path = '/js/dist/' . $package . $suffix . '.js';
+
+ $scripts->add( $handle, $path, $dependencies, false, 1 );
+ }
+}
+
+/**
+ * Adds inline scripts required for the WordPress JavaScript packages.
+ *
+ * @since 5.0.0
+ *
+ * @param WP_Scripts $scripts WP_Scripts object.
+ */
+function wp_default_packages_inline_scripts( &$scripts ) {
+ global $wp_locale;
+
+ $scripts->add_inline_script(
+ 'wp-api-fetch',
+ sprintf(
+ 'wp.apiFetch.use( wp.apiFetch.createNonceMiddleware( "%s" ) );',
+ ( wp_installing() && ! is_multisite() ) ? '' : wp_create_nonce( 'wp_rest' )
+ ),
+ 'after'
+ );
+ $scripts->add_inline_script(
+ 'wp-api-fetch',
+ sprintf(
+ 'wp.apiFetch.use( wp.apiFetch.createRootURLMiddleware( "%s" ) );',
+ esc_url_raw( get_rest_url() )
+ ),
+ 'after'
+ );
+
+ $scripts->add_inline_script(
+ 'wp-data',
+ implode(
+ "\n",
+ array(
+ '( function() {',
+ ' var userId = ' . get_current_user_ID() . ';',
+ ' var storageKey = "WP_DATA_USER_" + userId;',
+ ' wp.data',
+ ' .use( wp.data.plugins.persistence, { storageKey: storageKey } )',
+ ' .use( wp.data.plugins.asyncGenerator )',
+ ' .use( wp.data.plugins.controls );',
+ '} )()',
+ )
+ )
+ );
+
+ $scripts->add_inline_script(
+ 'wp-date',
+ sprintf(
+ 'wp.date.setSettings( %s );',
+ wp_json_encode(
+ array(
+ 'l10n' => array(
+ 'locale' => get_user_locale(),
+ 'months' => array_values( $wp_locale->month ),
+ 'monthsShort' => array_values( $wp_locale->month_abbrev ),
+ 'weekdays' => array_values( $wp_locale->weekday ),
+ 'weekdaysShort' => array_values( $wp_locale->weekday_abbrev ),
+ 'meridiem' => (object) $wp_locale->meridiem,
+ 'relative' => array(
+ /* translators: %s: duration */
+ 'future' => __( '%s from now', 'default' ),
+ /* translators: %s: duration */
+ 'past' => __( '%s ago', 'default' ),
+ ),
+ ),
+ 'formats' => array(
+ 'time' => get_option( 'time_format', __( 'g:i a', 'default' ) ),
+ 'date' => get_option( 'date_format', __( 'F j, Y', 'default' ) ),
+ 'datetime' => __( 'F j, Y g:i a', 'default' ),
+ ),
+ 'timezone' => array(
+ 'offset' => get_option( 'gmt_offset', 0 ),
+ 'string' => get_option( 'timezone_string', 'UTC' ),
+ ),
+ )
+ )
+ ),
+ 'after'
+ );
+
+ // Loading the old editor and its config to ensure the classic block works as expected.
+ $scripts->add_inline_script(
+ 'editor',
+ 'window.wp.oldEditor = window.wp.editor;',
+ 'after'
+ );
+
+ $tinymce_settings = apply_filters(
+ 'tiny_mce_before_init',
+ array(
+ 'plugins' => implode(
+ ',',
+ array_unique(
+ apply_filters(
+ 'tiny_mce_plugins',
+ array(
+ 'charmap',
+ 'colorpicker',
+ 'hr',
+ 'lists',
+ 'media',
+ 'paste',
+ 'tabfocus',
+ 'textcolor',
+ 'fullscreen',
+ 'wordpress',
+ 'wpautoresize',
+ 'wpeditimage',
+ 'wpemoji',
+ 'wpgallery',
+ 'wplink',
+ 'wpdialogs',
+ 'wptextpattern',
+ 'wpview',
+ )
+ )
+ )
+ ),
+ 'toolbar1' => implode(
+ ',',
+ array_merge(
+ apply_filters(
+ 'mce_buttons',
+ array(
+ 'formatselect',
+ 'bold',
+ 'italic',
+ 'bullist',
+ 'numlist',
+ 'blockquote',
+ 'alignleft',
+ 'aligncenter',
+ 'alignright',
+ 'link',
+ 'unlink',
+ 'wp_more',
+ 'spellchecker',
+ 'wp_add_media',
+ ),
+ 'editor'
+ ),
+ array( 'kitchensink' )
+ )
+ ),
+ 'toolbar2' => implode(
+ ',',
+ apply_filters(
+ 'mce_buttons_2',
+ array(
+ 'strikethrough',
+ 'hr',
+ 'forecolor',
+ 'pastetext',
+ 'removeformat',
+ 'charmap',
+ 'outdent',
+ 'indent',
+ 'undo',
+ 'redo',
+ 'wp_help',
+ ),
+ 'editor'
+ )
+ ),
+ 'toolbar3' => implode( ',', apply_filters( 'mce_buttons_3', array(), 'editor' ) ),
+ 'toolbar4' => implode( ',', apply_filters( 'mce_buttons_4', array(), 'editor' ) ),
+ 'external_plugins' => apply_filters( 'mce_external_plugins', array() ),
+ ),
+ 'editor'
+ );
+
+ if ( isset( $tinymce_settings['style_formats'] ) && is_string( $tinymce_settings['style_formats'] ) ) {
+ // Decode the options as we used to recommende json_encoding the TinyMCE settings.
+ $tinymce_settings['style_formats'] = json_decode( $tinymce_settings['style_formats'] );
+ }
+
+ $scripts->localize(
+ 'wp-block-library',
+ 'wpEditorL10n',
+ array(
+ 'tinymce' => array(
+ 'baseURL' => includes_url( 'js/tinymce' ),
+ 'suffix' => SCRIPT_DEBUG ? '' : '.min',
+ 'settings' => $tinymce_settings,
+ ),
+ )
+ );
+}
+
+/**
</ins><span class="cx" style="display: block; padding: 0 10px"> * Register all WordPress scripts.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * Localizes some of them.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -720,6 +1210,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $scripts->add( 'wp-api', "/wp-includes/js/wp-api$suffix.js", array( 'jquery', 'backbone', 'underscore', 'wp-api-request' ), false, 1 );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wp_default_packages_vendor( $scripts, $dev_suffix );
+ wp_default_packages_scripts( $scripts, $suffix );
+ if ( did_action( 'init' ) ) {
+ wp_default_packages_inline_scripts( $scripts );
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( is_admin() ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $scripts->add( 'admin-tags', "/wp-admin/js/tags$suffix.js", array( 'jquery', 'wp-ajax-response' ), false, 1 );
</span><span class="cx" style="display: block; padding: 0 10px"> did_action( 'init' ) && $scripts->localize(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1237,6 +1733,50 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $styles->add_data( $rtl_style, 'suffix', $suffix );
</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">+
+ // Packages styles
+ $fonts_url = '';
+
+ /*
+ * Translators: If there are characters in your language that are not supported
+ * by Noto Serif, translate this to 'off'. Do not translate into your own language.
+ */
+ if ( 'off' !== _x( 'on', 'Noto Serif font: on or off' ) ) {
+ $fonts_url = 'https://fonts.googleapis.com/css?family=Noto+Serif%3A400%2C400i%2C700%2C700i';
+ }
+ $styles->add( 'wp-editor-font', $fonts_url );
+
+ $styles->add( 'wp-block-library-theme', '/styles/dist/block-library/theme.css' );
+ $styles->add_data( 'wp-block-library-theme', 'rtl', 'replace' );
+
+ $styles->add(
+ 'wp-edit-blocks',
+ '/styles/dist/block-library/editor.css',
+ array(
+ 'wp-components',
+ 'wp-editor',
+ // Always include visual styles so the editor never appears broken.
+ 'wp-block-library-theme',
+ )
+ );
+ $styles->add_data( 'wp-edit-blocks', 'rtl', 'replace' );
+
+ $package_styles = array(
+ 'block-library' => array(),
+ 'components' => array(),
+ 'edit-post' => array( 'wp-components', 'wp-editor', 'wp-edit-blocks', 'wp-block-library', 'wp-nux' ),
+ 'editor' => array( 'wp-components', 'wp-editor-font', 'wp-nux' ),
+ 'list-reusable-blocks' => array( 'wp-components' ),
+ 'nux' => array( 'wp-components' ),
+ );
+
+ foreach ( $package_styles as $package => $dependencies ) {
+ $handle = 'wp-' . $package;
+ $path = '/styles/dist/' . $package . '/style.css';
+
+ $styles->add( $handle, $path, $dependencies );
+ $styles->add_data( $handle, 'rtl', 'replace' );
+ }
</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></pre></div>
<a id="trunktoolswebpackpackagesjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tools/webpack/packages.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tools/webpack/packages.js 2018-12-13 16:29:57 UTC (rev 44113)
+++ trunk/tools/webpack/packages.js 2018-12-13 16:49:58 UTC (rev 44114)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -91,7 +91,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> const vendors = {
</span><span class="cx" style="display: block; padding: 0 10px"> 'lodash.js': 'lodash/lodash.js',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'wp-polyfill.js': '@babel/polyfill/dist/polyfill.js',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'wp-polyfill-ecmascript.js': '@babel/polyfill/dist/polyfill.js',
</ins><span class="cx" style="display: block; padding: 0 10px"> 'wp-polyfill-fetch.js': 'whatwg-fetch/dist/fetch.umd.js',
</span><span class="cx" style="display: block; padding: 0 10px"> 'wp-polyfill-element-closest.js': 'element-closest/element-closest.js',
</span><span class="cx" style="display: block; padding: 0 10px"> 'wp-polyfill-node-contains.js': 'polyfill-library/polyfills/Node/prototype/contains/polyfill.js',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -103,7 +103,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> const minifiedVendors = {
</span><span class="cx" style="display: block; padding: 0 10px"> 'lodash.min.js': 'lodash/lodash.min.js',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'wp-polyfill.min.js': '@babel/polyfill/dist/polyfill.min.js',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'wp-polyfill-ecmascript.min.js': '@babel/polyfill/dist/polyfill.min.js',
</ins><span class="cx" style="display: block; padding: 0 10px"> 'wp-polyfill-formdata.min.js': 'formdata-polyfill/formdata.min.js',
</span><span class="cx" style="display: block; padding: 0 10px"> 'moment.min.js': 'moment/min/moment.min.js',
</span><span class="cx" style="display: block; padding: 0 10px"> 'react.min.js': 'react/umd/react.production.min.js',
</span></span></pre>
</div>
</div>
</body>
</html>