Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update WordPress packages #4408

Merged
merged 12 commits into from
May 2, 2020
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"root": true,
"extends": [
"plugin:@wordpress/eslint-plugin/recommended",
"plugin:@wordpress/eslint-plugin/recommended-with-formatting",
"plugin:import/recommended",
"plugin:eslint-comments/recommended"
],
Expand Down
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ module.exports = function( grunt ) {
'composer remove cweagans/composer-patches --update-no-dev -o',
'rm -r ' + productionVendorExcludedFilePatterns.join( ' ' ),
'if [ -d vendor/ampproject/common/vendor ]; then rm -r vendor/ampproject/common/vendor; fi',
'if [ -d vendor/ampproject/optimizer/vendor ]; then rm -r vendor/ampproject/optimizer/vendor; fi'
'if [ -d vendor/ampproject/optimizer/vendor ]; then rm -r vendor/ampproject/optimizer/vendor; fi',
].join( ' && ' ),
},
create_build_zip: {
Expand Down
6 changes: 3 additions & 3 deletions assets/src/admin/paired-browsing/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,9 @@ class PairedBrowsingApp {
this.removeAmpQueryVars( this.removeUrlHash( win.location.href ) )
)
) {
const url = oppositeWindow === this.ampIframe.contentWindow ?
this.addAmpQueryVar( win.location.href ) :
this.removeAmpQueryVars( win.location.href );
const url = oppositeWindow === this.ampIframe.contentWindow
? this.addAmpQueryVar( win.location.href )
: this.removeAmpQueryVars( win.location.href );

oppositeWindow.location.replace( url );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,19 +74,19 @@ export default ( InitialMediaUpload, minImageDimensions ) => {
states: [ new FeaturedImageLibrary(), new wp.media.controller.EditImage() ],
} );

this.frame.on( 'toolbar:create:featured-image', function ( toolbar ) {
this.frame.on( 'toolbar:create:featured-image', function( toolbar ) {
/**
* @this wp.media.view.MediaFrame.Select
*/
this.createSelectToolbar( toolbar, {
text: wp.media.view.l10n.setFeaturedImage,
state: this.options.state,
});
} );
}, this.frame );

this.frame.on( 'open', this.onOpen );

this.frame.state('featured-image').on( 'select', this.onSelectImage, this );
this.frame.state( 'featured-image' ).on( 'select', this.onSelectImage, this );

// See wp.media() for this.
wp.media.frame = this.frame;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export default createHigherOrderComponent(
<details className="amp-block-validation-errors">
<summary className="amp-block-validation-errors__summary">
{ sprintf(
/* translators: %s is the number of issues */
_n(
'There is %s issue from AMP validation.',
'There are %s issues from AMP validation.',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const ValidationErrorMessage = ( { title, message, code } ) => {
}

if ( title ) {
return <span dangerouslySetInnerHTML={ { __html: title } } />
return <span dangerouslySetInnerHTML={ { __html: title } } />;
}

return (
Expand Down
14 changes: 14 additions & 0 deletions includes/amp-helper-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,20 @@ function amp_register_default_scripts( $wp_scripts ) {
}
}

$vendor_scripts = [
'lodash' => [
'dependencies' => [],
'version' => '4.17.15',
],
];
foreach ( $vendor_scripts as $handle => $handle_data ) {
if ( ! isset( $wp_scripts->registered[ $handle ] ) ) {
$path = amp_get_asset_url( sprintf( 'js/vendor/%s.js', $handle ) );

$wp_scripts->add( $handle, $path, $handle_data['dependencies'], $handle_data['version'], 1 );
}
}

// AMP Runtime.
$handle = 'amp-runtime';
$wp_scripts->add(
Expand Down