Skip to content

Commit

Permalink
Fix conflict between Chromium v77.0.3865.75 and Gutenberg (#2921)
Browse files Browse the repository at this point in the history
* Fix conflict between Chromium v77.0.3865.75 and Gutenberg #2914

* Grunt fixes #2914

* Revert removed package tag #2914

* Target WP 5.0 <= X < 5.3 #2914

* Move echo statement inside version check #2914

* Do proper version checks #2914

* Fix phpDoc #2914
  • Loading branch information
arnaudbroes authored and michaeltorbert committed Sep 20, 2019
1 parent 6a9cdb1 commit 565f02b
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 5 deletions.
1 change: 0 additions & 1 deletion all_in_one_seo_pack.php
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,6 @@ function aioseop_init_class() {
add_action( 'init', array( $aiosp, 'add_hooks' ) );
add_action( 'plugins_loaded', array( $aioseop_updates, 'version_updates' ), 11 );


// phpcs:ignore Squiz.Commenting.InlineComment.InvalidEndChar
// add_action( 'admin_init', 'aioseop_review_plugin_notice' );
if ( defined( 'DOING_AJAX' ) && ! empty( $_POST ) && ! empty( $_POST['action'] ) && 'aioseop_ajax_scan_header' === $_POST['action'] ) {
Expand Down
2 changes: 1 addition & 1 deletion css/modules/aioseop_module-rtl.min.css

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

2 changes: 1 addition & 1 deletion css/modules/aioseop_module.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion inc/aioseop_updates_class.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function version_updates() {
set_transient( '_aioseop_activation_redirect', true, 30 ); // Sets 30 second transient for welcome screen redirect on activation.
}
delete_transient( 'aioseop_feed' );
//add_action( 'admin_init', array( $this, 'aioseop_welcome' ) ); //Uncomment for welcome screen.
// add_action( 'admin_init', array( $this, 'aioseop_welcome' ) ); //Uncomment for welcome screen.

}

Expand Down
62 changes: 62 additions & 0 deletions inc/compatability/compat-gutenberg.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?php
/**
* The compat-gutenberg.php file.
*
* Contains compatibility fixes for the Gutenberg editor.
*
* @package All_in_One_SEO_Pack
*
* @since 3.2.8
*/

/**
* The gutenberg_fix_metabox() function.
*
* Change height of a specific CSS class to fix an issue in Chrome 77 with Gutenberg.
*
* @see https://github.com/WordPress/gutenberg/issues/17406
* @link https://github.com/semperfiwebdesign/all-in-one-seo-pack/issues/2914
*
* @since 3.2.8
*
* @return void
*/
function gutenberg_fix_metabox() {
if ( false !== stripos( $_SERVER['HTTP_USER_AGENT'], 'Chrome/77.' ) ) {
add_action(
'admin_head',
static function () {
global $wp_version;

// Fix should be included in WP v5.3.
if ( ! version_compare( $wp_version, '5.0', '>=' ) && version_compare( $wp_version, '5.3', '<' ) ) {
return;
}

// CSS class renamed from 'editor' to 'block-editor' in WP v5.2.
if ( version_compare( $wp_version, '5.2', '<' ) ) {
gutenberg_fix_metabox_helper( 'editor-writing-flow' );
} elseif ( version_compare( $wp_version, '5.2', '>=' ) ) {
gutenberg_fix_metabox_helper( 'block-editor-writing-flow' );
}
}
);
}
}

/**
* The gutenberg_fix_metabox_helper() function.
*
* Overrides a Gutenberg CSS class using inline CSS.
* Helper method of gutenberg_fix_metabox().
*
* @since 3.2.8
*
* @param string $class_name
* @return void
*/
function gutenberg_fix_metabox_helper( $class_name ) {
echo '<style>.' . $class_name . ' { height: auto; }</style>';
}

gutenberg_fix_metabox();
1 change: 1 addition & 0 deletions inc/compatability/compat-init.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ public function remove_jetpack_sitemap( $modules ) {
* @since 2.3.12.3 WPML compatibility loaded.
*/
public function load_compatibility_classes() {
require_once( AIOSEOP_PLUGIN_DIR . 'inc/compatability/compat-gutenberg.php' );
require_once( AIOSEOP_PLUGIN_DIR . 'inc/compatability/compat-wpml.php' ); // Load classes.
// Evaluate classes and push them into array.
$target = new All_in_One_SEO_Pack_Wpml;
Expand Down
2 changes: 1 addition & 1 deletion modules/aioseop_opengraph.php
Original file line number Diff line number Diff line change
Expand Up @@ -1553,7 +1553,7 @@ function add_meta() {
$meta['facebook'] += array( 'thumbnail_1' => 'og:image:secure_url' );
$thumbnail_1 = $thumbnail;
$meta['facebook'] += array( 'video_1' => 'og:video:secure_url' );
$video_1 = $video;
$video_1 = $video;
}

$tags = array(
Expand Down

0 comments on commit 565f02b

Please sign in to comment.