-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix conflict between Chromium v77.0.3865.75 and Gutenberg (#2921)
* 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
1 parent
6a9cdb1
commit 565f02b
Showing
7 changed files
with
67 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters