From 8a5b2e774932ece77e29f89ac67c0911b4068ea5 Mon Sep 17 00:00:00 2001 From: Brandon Kraft Date: Fri, 4 Oct 2024 19:18:06 -0500 Subject: [PATCH] Blocks: provide nice error message for workaround in dev env (#39602) * Provide nice error message for workaround * typos will be the dealth of me --- projects/plugins/jetpack/changelog/add-nice-fatal-message | 5 +++++ projects/plugins/jetpack/class.jetpack-gutenberg.php | 4 ++++ 2 files changed, 9 insertions(+) create mode 100644 projects/plugins/jetpack/changelog/add-nice-fatal-message diff --git a/projects/plugins/jetpack/changelog/add-nice-fatal-message b/projects/plugins/jetpack/changelog/add-nice-fatal-message new file mode 100644 index 0000000000000..70f2483520a3d --- /dev/null +++ b/projects/plugins/jetpack/changelog/add-nice-fatal-message @@ -0,0 +1,5 @@ +Significance: patch +Type: other +Comment: Just adding a nicer error message that would only display in dev environments. + + diff --git a/projects/plugins/jetpack/class.jetpack-gutenberg.php b/projects/plugins/jetpack/class.jetpack-gutenberg.php index 7968f0452f7df..6fa4dd4ed04cf 100644 --- a/projects/plugins/jetpack/class.jetpack-gutenberg.php +++ b/projects/plugins/jetpack/class.jetpack-gutenberg.php @@ -674,6 +674,10 @@ public static function enqueue_block_editor_assets() { // wp-edit-post but wp-edit-post's styles break the Widget Editor and // Site Editor) until a real fix gets unblocked. // @todo Remove this once #20357 is properly fixed. + $wp_styles_fix = wp_styles()->query( 'jetpack-blocks-editor', 'registered' ); + if ( empty( $wp_styles_fix ) ) { + wp_die( 'Your installation of Jetpack is incomplete. Please run "jetpack build plugins/jetpack" in your dev env.' ); + } wp_styles()->query( 'jetpack-blocks-editor', 'registered' )->deps = array(); Assets::enqueue_script( 'jetpack-blocks-editor' );